TreePlot

TreePlot[g]
generates a tree plot of the graph g.

TreePlot[{vi 1vj 1,vi 2vj 2,}]
generates a tree plot of the graph in which vertex is connected to vertex .

TreePlot[{{vi 1vj 1,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]=
Introduced in 2007
(6.0)
| Updated in 2014
(10.0)