represents a tree with a list of child subtrees subtreei.


represents a tree containing data in its root, with children given by subtrees.


  • Tree objects represent rooted, ordered, labeled trees. Standard examples include XML trees, file systems and Wolfram Language expressions.
  • In Tree[data,subtrees], the subtrees are other Tree expressions or general expressions that are interpreted as leaves.
  • Tree[] displays in a notebook as a plot of a tree graph.
  • Tree[] is always converted to a standard form with structure Tree[data,subtrees].
  • Tree[subtrees] is equivalent to Tree[Null,subtrees]
  • Tree is treated as a raw object by functions like AtomQ.


open allclose all

Basic Examples  (4)

A tree with two leaves:

A tree with multiple levels:

A tree with data in the leaves:

A tree containing another tree as data:

Scope  (2)

Represent a leaf with no child:

Specify children in a list:

Properties & Relations  (6)

A root node of a tree does not need to have data:

RulesTree returns a Tree expression:

Check whether an expression with head Tree is a valid Tree object:

This is not a valid Tree object:

However, this is a valid Tree object that contains a child with an invalid Tree expression as data:

Construct a Tree expression with ExpressionTree:

Construct a Tree expression with GraphTree:

Wolfram Research (2021), Tree, Wolfram Language function,


Wolfram Research (2021), Tree, Wolfram Language function,


@misc{reference.wolfram_2021_tree, author="Wolfram Research", title="{Tree}", year="2021", howpublished="\url{}", note=[Accessed: 22-June-2021 ]}


@online{reference.wolfram_2021_tree, organization={Wolfram Research}, title={Tree}, year={2021}, url={}, note=[Accessed: 22-June-2021 ]}


Wolfram Language. 2021. "Tree." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2021). Tree. Wolfram Language & System Documentation Center. Retrieved from