

RootTree
Details and Options

- RootTree[Tree[data,{subtree1,subtree2,…}]] returns Tree[data,{}].
- RootTree[Tree[data,None]] gives Tree[data,None].
- RootTree[tree,n] removes all subtrees on levels below level n.
- In RootTree[tree,n], the level n can be any machine integer or Infinity.
- A positive level n+1 consists of all subtrees of tree that are children of subtrees on level n.
- Level 0 corresponds to the root of the tree.
- Level -1 corresponds to the leaves.
- A negative level -(n+1) consists of all subtrees whose children are on levels -1, -2, …, -n, with highest level -n.
- RootTree takes the same options as Tree.

Examples
open all close allBasic Examples (3)
Options (9)
Styling Individual Tree Elements (2)
Styling Entire Tree (4)
Tree Layout and Graphics Options (3)
Properties & Relations (4)
RootTree[tree] gives Tree[TreeData[tree],None] when TreeChildren[tree] gives None:
RootTree[tree] gives Tree[TreeData[tree],{}] when TreeChildren[tree] gives a list:
RootTree[tree] gives Tree[TreeData[tree],<||>] when TreeChildren[tree] gives an association:
RootTree[tree,-1] gives the whole tree:
Related Guides
History
Text
Wolfram Research (2022), RootTree, Wolfram Language function, https://reference.wolfram.com/language/ref/RootTree.html.
CMS
Wolfram Language. 2022. "RootTree." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/RootTree.html.
APA
Wolfram Language. (2022). RootTree. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/RootTree.html
BibTeX
@misc{reference.wolfram_2025_roottree, author="Wolfram Research", title="{RootTree}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/RootTree.html}", note=[Accessed: 11-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_roottree, organization={Wolfram Research}, title={RootTree}, year={2022}, url={https://reference.wolfram.com/language/ref/RootTree.html}, note=[Accessed: 11-August-2025]}