TreeForm
TreeForm[expr]
displays expr as a tree with different levels at different depths.
TreeForm[expr,n]
displays expr as a tree only down to level n.
Details and Options

- With a notebook front end, TreeForm displays as a graphical tree in StandardForm and TraditionalForm.
- TreeForm takes the same options as TreePlot.
- VertexLabeling->Automatic does not display expression fragments at each node, but still gives subtree expression as tooltips.
- VertexLabeling->False does not give expression fragments or tooltips.
- The typeset form of TreeForm[expr] is interpreted the same as expr when used in input. »
- When an input evaluates to TreeForm[expr], TreeForm does not appear in the output. »
Examples
open allclose allBasic Examples (3)
Scope (9)
Options (14)
AspectRatio (2)
PlotRangePadding (1)
Use different PlotRangePadding around the drawing:
PlotStyle (3)
Specify an overall style for the drawing:
PlotStyle can be combined with VertexRenderingFunction, which has higher priority:
PlotStyle can be combined with EdgeRenderingFunction, which has higher priority:
Properties & Relations (6)
FullForm gives a linear expression similar to TreeForm:
OutputForm of TreeForm gives a textual display of the expression:
Use TreePlot to plot a tree graph:
Use GraphPlot or GraphPlot3D for general undirected graphs:
Use LayeredGraphPlot for hierarchical-style drawing of directed graphs:
The typeset form of TreeForm[expr] is interpreted the same as expr when used in input:
Copy the output and paste it into an input cell. The is interpreted as x2:
When an input evaluates to TreeForm[expr], TreeForm does not appear in the output:
Possible Issues (2)
Compound heads are not laid out as trees:
Even when an output omits TreeForm from the top level, it is not stripped from subexpressions:
The output does not have TreeForm in it:
However, the variable e does have TreeForm in it, which may affect subsequent evaluations:
The product is not evaluated due to the intervening TreeForm:
Assign variables first and then apply TreeForm to the result to maintain computability:
Text
Wolfram Research (1988), TreeForm, Wolfram Language function, https://reference.wolfram.com/language/ref/TreeForm.html (updated 2007).
CMS
Wolfram Language. 1988. "TreeForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/TreeForm.html.
APA
Wolfram Language. (1988). TreeForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TreeForm.html