TreeLeafQ

TreeLeafQ[tree]

gives True if tree is a tree with no children, and gives False otherwise.

Details

Examples

open allclose all

Basic Examples  (1)

Test whether a tree is a leaf:

Scope  (1)

TreeLeafQ works for any expression:

Properties & Relations  (4)

In TreeLeafQ[tree], the tree must be an explicit TreeQ object:

TreeLeafQ[tree] gives True when TreeSize[tree] gives 1:

A leaf has zero children:

TreeLeaves[tree] returns the list of subtrees for which TreeLeafQ gives True:

Wolfram Research (2021), TreeLeafQ, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeLeafQ.html.

Text

Wolfram Research (2021), TreeLeafQ, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeLeafQ.html.

BibTeX

@misc{reference.wolfram_2021_treeleafq, author="Wolfram Research", title="{TreeLeafQ}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/TreeLeafQ.html}", note=[Accessed: 28-September-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_treeleafq, organization={Wolfram Research}, title={TreeLeafQ}, year={2021}, url={https://reference.wolfram.com/language/ref/TreeLeafQ.html}, note=[Accessed: 28-September-2021 ]}

CMS

Wolfram Language. 2021. "TreeLeafQ." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/TreeLeafQ.html.

APA

Wolfram Language. (2021). TreeLeafQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TreeLeafQ.html