TreeSize

TreeSize[tree]

gives the number of subtrees of the Tree object tree.

Details

  • In TreeSize[tree], tree must be a valid Tree object.
  • The number of subtrees of a Tree object is also the number of its nodes because each node is the root of a subtree of the original tree.
  • TreeSize[tree] is equivalent to TreeCount[tree,_].

Examples

open allclose all

Basic Examples  (1)

Count the subtrees in a tree:

Properties & Relations  (1)

TreeSize[tree] is equivalent to TreeCount[tree,_]:

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

Text

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

BibTeX

@misc{reference.wolfram_2021_treesize, author="Wolfram Research", title="{TreeSize}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/TreeSize.html}", note=[Accessed: 22-June-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_treesize, organization={Wolfram Research}, title={TreeSize}, year={2021}, url={https://reference.wolfram.com/language/ref/TreeSize.html}, note=[Accessed: 22-June-2021 ]}

CMS

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

APA

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