This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

TreeForm

TreeForm[expr]
displays expr as a tree with different levels at different depths.
TreeForm
displays expr as a tree only down to level n.
  • VertexLabeling->Automatic does not display expression fragments at each node, but still gives subtree expression as tooltips.
A symbolic expression formatted as a tree:
Show the tree form for the first two levels in the expression:
A graphics expression formatted as a tree:
A symbolic expression formatted as a tree:
In[1]:=
Click for copyable input
Out[1]//TreeForm=
 
Show the tree form for the first two levels in the expression:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]//TreeForm=
 
A graphics expression formatted as a tree:
In[1]:=
Click for copyable input
Out[1]//TreeForm=
A formatted symbolic expression with mathematical constants:
A formatted expression with symbolic, exact and inexact values:
A nested list:
An expression containing subscripted variables:
A formatted expression with a special superscript and OverBar:
A graphic object:
A Series expression:
An expression containing Hold:
Limit the levels shown:
By default a suitable aspect ratio is calculated for good visual appearance:
Change the aspect ratio:
Show directed edges:
Draw edges using blue arrows set back by 30%:
Draw vertices only:
Draw a tree with the first level of height 1, the second level 2, etc.:
Use different PlotRangePadding around the drawing:
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:
Display subtree expressions as tooltips:
Show no vertices:
Render vertices using a predefined graphic:
Explicitly specify all vertex coordinates:
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:
Compound heads are not laid out as trees:
A complete binary tree:
A complete ternary tree:
A symmetric tree:
An asymmetric tree:
New in 1 | Last modified in 6