gives a tree whose root contains data and that has children specified by the rulei.


  • RulesTree gives a Tree object.
  • The children of RulesTree[data{rule1,rule2,}] are given by the list {RulesTree[rule1],RulesTree[rule2],}.
  • The children of RulesTree[data<|key1rule1,key2rule2,|>] are given by the association <|key1RulesTree[rule1],key2RulesTree[rules2],|>.
  • RulesTree[data] for data not of the form {}, <||> or None is equivalent to RulesTree[dataNone]. »
  • RulesTree takes the same options as Tree.


open allclose all

Basic Examples  (3)

Construct a tree with three leaves:

Construct a tree with several levels:

Construct a tree with named edges:

Scope  (4)

Construct a leaf with no child:

Construct an inner node with no children:

Specify a list of children:

Specify an association of children:

Options  (9)

Styling Individual Tree Elements  (2)

Specify the label for the generated tree element:

Specify labels and styles for subtrees by position:

Styling Entire Tree  (4)

Specify labels and styles for all subtrees:

Specify the base style:

Specify the styles for both the edges and the edges of the tree elements:

Specify the base style and styles for individual tree elements:

Tree Layout and Graphics Options  (3)

Specify the orientation for the root:

Specify a named embedding:

Specify Graphics options:

Properties & Relations  (2)

RulesTree constructs a tree associated with the given rules:

Use TreeRules on the result to recover the original rules:

RulesTree can be computed with NestTree:

Possible Issues  (1)

RulesTree[exprNone] is generally equivalent to RulesTree[expr]:

However, the None is necessary to specify a tree with data of the form lhs{e1,e2,} or lhsNone:

Without the None, this would be treated as a tree whose root contains lhs with children {RulesTree[e1],RulesTree[e2],}:

Wolfram Research (2021), RulesTree, Wolfram Language function, (updated 2022).


Wolfram Research (2021), RulesTree, Wolfram Language function, (updated 2022).


Wolfram Language. 2021. "RulesTree." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022.


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


@misc{reference.wolfram_2022_rulestree, author="Wolfram Research", title="{RulesTree}", year="2022", howpublished="\url{}", note=[Accessed: 30-September-2022 ]}


@online{reference.wolfram_2022_rulestree, organization={Wolfram Research}, title={RulesTree}, year={2022}, url={}, note=[Accessed: 30-September-2022 ]}