TreePlot

TreePlot[{vi1->vj1, vi2->vj2, ...}]
generates a tree plot of the graph in which vertex is connected to vertex .

TreePlot[{{vi1->vj1, lbl1}, ...}]
associates labels with edges in the graph.

TreePlot[g, pos]
places roots of trees in the plot at position pos.

TreePlot[g, pos, vk]
uses vertex as the root node in the tree plot.

Details and OptionsDetails and Options

ExamplesExamplesopen allclose all

Basic Examples (7)Basic Examples (7)

Draw a tree:

In[1]:=
Click for copyable input
Out[1]=

Show direction of edges:

In[1]:=
Click for copyable input
Out[1]=

Include vertex labels:

In[1]:=
Click for copyable input
Out[1]=

Show edge labels:

In[1]:=
Click for copyable input
Out[1]=

Drawing a tree with different orientation from the default:

In[1]:=
Click for copyable input
Out[1]=

Specify the root node:

In[1]:=
Click for copyable input
Out[1]=

If the graph is not a tree, it is laid out based on a spanning tree of this graph:

In[1]:=
Click for copyable input
Out[1]=
New in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »