---
title: "TreeGraph"
language: "en"
type: "Symbol"
summary: "TreeGraph[{v1, v2, ...}, {u1, u2, ...}] yields a tree where ui is the predecessor of vi. TreeGraph[{e1, e2, ...}] yields a tree with edges ej. TreeGraph[{v1, v2, ...}, {e1, e2, ...}] yields a tree with vertices vi and edges ej. TreeGraph[{..., wi[vi, ...], ...}, {..., wj[ej, ...], ...}] yields a tree with vertex and edge properties defined by the symbolic wrappers wk. TreeGraph[{vi -> vj, ...}] uses rules vi -> vj to specify a tree."
keywords: 
- tree
- connected cycle free graph
- rooted tree
- unrooted tree
- binary tree
- ternary tree
- nary tree
- game tree
- decision tree
canonical_url: "https://reference.wolfram.com/language/ref/TreeGraph.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Graph Construction & Representation"
    link: "https://reference.wolfram.com/language/guide/GraphConstructionAndRepresentation.en.md"
  - 
    title: "Tree Construction & Representation"
    link: "https://reference.wolfram.com/language/guide/TreeConstructionAndRepresentation.en.md"
  - 
    title: "Discrete Mathematics"
    link: "https://reference.wolfram.com/language/guide/DiscreteMathematics.en.md"
  - 
    title: "Computation on Trees"
    link: "https://reference.wolfram.com/language/guide/ComputationOnTrees.en.md"
related_functions: 
  - 
    title: "Graph"
    link: "https://reference.wolfram.com/language/ref/Graph.en.md"
  - 
    title: "UndirectedEdge"
    link: "https://reference.wolfram.com/language/ref/UndirectedEdge.en.md"
  - 
    title: "DirectedEdge"
    link: "https://reference.wolfram.com/language/ref/DirectedEdge.en.md"
  - 
    title: "TreeGraphQ"
    link: "https://reference.wolfram.com/language/ref/TreeGraphQ.en.md"
  - 
    title: "KaryTree"
    link: "https://reference.wolfram.com/language/ref/KaryTree.en.md"
  - 
    title: "CompleteKaryTree"
    link: "https://reference.wolfram.com/language/ref/CompleteKaryTree.en.md"
  - 
    title: "StarGraph"
    link: "https://reference.wolfram.com/language/ref/StarGraph.en.md"
  - 
    title: "FindSpanningTree"
    link: "https://reference.wolfram.com/language/ref/FindSpanningTree.en.md"
  - 
    title: "TreePlot"
    link: "https://reference.wolfram.com/language/ref/TreePlot.en.md"
  - 
    title: "PathGraph"
    link: "https://reference.wolfram.com/language/ref/PathGraph.en.md"
  - 
    title: "PlanarGraph"
    link: "https://reference.wolfram.com/language/ref/PlanarGraph.en.md"
  - 
    title: "TextStructure"
    link: "https://reference.wolfram.com/language/ref/TextStructure.en.md"
  - 
    title: "Groupings"
    link: "https://reference.wolfram.com/language/ref/Groupings.en.md"
---
# TreeGraph

TreeGraph[{v1, v2, …}, {u1, u2, …}] yields a tree where ui is the predecessor of vi.

TreeGraph[{e1, e2, …}] yields a tree with edges ej.

TreeGraph[{v1, v2, …}, {e1, e2, …}] yields a tree with vertices vi and edges ej.

TreeGraph[{…, wi[vi, …], …}, {…, wj[ej, …], …}] yields a tree with vertex and edge properties defined by the symbolic wrappers wk.

TreeGraph[{vi -> vj, …}] uses rules vi -> vj to specify a tree.

## Details and Options

* ``TreeGraph`` generates a ``Graph`` object.

* ``TreeGraph`` supports the same vertices, edges, wrappers, and options as ``Graph``.

* A tree is a simple connected graph with no cycles.

* A tree is a connected graph with no cycles.

[image]

* ``TreeGraph`` can only represent trees.

### List of all options

|                        |                 |                                                                                    |
| ---------------------- | --------------- | ---------------------------------------------------------------------------------- |
| AlignmentPoint         | Center          | the default point in the graphic to align with                                     |
| AnnotationRules        | {}              | annotations for graph, edges and vertices                                          |
| AspectRatio            | Automatic       | ratio of height to width                                                           |
| Axes                   | False           | whether to draw axes                                                               |
| AxesLabel              | None            | axes labels                                                                        |
| AxesOrigin             | Automatic       | where axes should cross                                                            |
| AxesStyle              | {}              | style specifications for the axes                                                  |
| Background             | None            | background color for the plot                                                      |
| BaselinePosition       | Automatic       | how to align with a surrounding text baseline                                      |
| BaseStyle              | {}              | base style specifications for the graphic                                          |
| ContentSelectable      | Automatic       | whether to allow contents to be selected                                           |
| CoordinatesToolOptions | Automatic       | detailed behavior of the coordinates tool                                          |
| DirectedEdges          | Automatic       | whether to interpret Rule as DirectedEdge                                          |
| EdgeLabels             | None            | labels and label placements for edges                                              |
| EdgeLabelStyle         | Automatic       | style to use for edge labels                                                       |
| EdgeShapeFunction      | Automatic       | generate graphic shapes for edges                                                  |
| EdgeStyle              | Automatic       | style used for edges                                                               |
| EdgeWeight             | Automatic       | weights for edges                                                                  |
| Epilog                 | {}              | primitives rendered after the main plot                                            |
| FormatType             | TraditionalForm | the default format type for text                                                   |
| Frame                  | False           | whether to put a frame around the plot                                             |
| FrameLabel             | None            | frame labels                                                                       |
| FrameStyle             | {}              | style specifications for the frame                                                 |
| FrameTicks             | Automatic       | frame ticks                                                                        |
| FrameTicksStyle        | {}              | style specifications for frame ticks                                               |
| GraphHighlight         | {}              | graph elements to highlight                                                        |
| GraphHighlightStyle    | Automatic       | style for highlight                                                                |
| GraphLayout            | Automatic       | how to lay out vertices and edges                                                  |
| GridLines              | None            | grid lines to draw                                                                 |
| GridLinesStyle         | {}              | style specifications for grid lines                                                |
| ImageMargins           | 0.              | the margins to leave around the graphic                                            |
| ImagePadding           | All             | what extra padding to allow for labels etc.                                        |
| ImageSize              | Automatic       | the absolute size at which to render the graphic                                   |
| LabelStyle             | {}              | style specifications for labels                                                    |
| Method                 | Automatic       | details of graphics methods to use                                                 |
| PerformanceGoal        | Automatic       | aspects of performance to try to optimize                                          |
| PlotLabel              | None            | an overall label for the plot                                                      |
| PlotRange              | All             | range of values to include                                                         |
| PlotRangeClipping      | False           | whether to clip at the plot range                                                  |
| PlotRangePadding       | Automatic       | how much to pad the range of values                                                |
| PlotRegion             | Automatic       | the final display region to be filled                                              |
| PlotTheme              | \$PlotTheme     | overall theme for the graph                                                        |
| PreserveImageOptions   | Automatic       | whether to preserve image options when displaying new versions of the same graphic |
| Prolog                 | {}              | primitives rendered before the main plot                                           |
| RotateLabel            | True            | whether to rotate y labels on the frame                                            |
| Ticks                  | Automatic       | axes ticks                                                                         |
| TicksStyle             | {}              | style specifications for axes ticks                                                |
| VertexCoordinates      | Automatic       | coordinates for vertices                                                           |
| VertexLabels           | None            | labels and placements for vertices                                                 |
| VertexLabelStyle       | Automatic       | style to use for vertex labels                                                     |
| VertexShape            | Automatic       | graphic shape for vertices                                                         |
| VertexShapeFunction    | Automatic       | generate graphic shapes for vertices                                               |
| VertexSize             | Medium          | size of vertices                                                                   |
| VertexStyle            | Automatic       | styles for vertices                                                                |
| VertexWeight           | Automatic       | weights for vertices                                                               |

---

## Examples (121)

### Basic Examples (1)

A tree from pairs of children and parents:

```wl
In[1]:= TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}]

Out[1]= [image]
```

A tree from a list of vertices and edges:

```wl
In[2]:= TreeGraph[{1, 2, 3, 4}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[2]= [image]
```

### Scope (25)

#### Connectivity (6)

Create an undirected graph using ``\[UndirectedEdge]`` characters; enter the character as esc`` ue ``esc :

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[1]= [image]
```

---

Create a directed graph using ``\[DirectedEdge]`` characters; enter the character as esc`` de ``esc :

```wl
In[1]:= TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}]

Out[1]= [image]
```

---

Create a directed graph from a list of rules:

```wl
In[1]:= TreeGraph[{1 -> 2, 1 -> 3, 1 -> 4}]

Out[1]= [image]
```

Create an undirected graph from a list of rules:

```wl
In[2]:= TreeGraph[{1 -> 2, 1 -> 3, 1 -> 4}, DirectedEdges -> False]

Out[2]= [image]
```

---

Use ``VertexList`` and ``EdgeList`` to get vertices and edges:

```wl
In[1]:= {g1, g2} = {TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}], TreeGraph[{1\[UndirectedEdge]3, 1\[UndirectedEdge]2, 1\[UndirectedEdge]4}]}

Out[1]= {[image], [image]}
```

The ordering for edges is the order in which they were entered:

```wl
In[2]:= EdgeList /@ {g1, g2}

Out[2]= {{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, {1\[UndirectedEdge]3, 1\[UndirectedEdge]2, 1\[UndirectedEdge]4}}
```

The ordering for vertices is the order in which they were entered in the edges:

```wl
In[3]:= VertexList /@ {g1, g2}

Out[3]= {{1, 2, 3, 4}, {1, 3, 2, 4}}
```

---

Use an explicit vertex list to control the ordering used by ``VertexList``:

```wl
In[1]:= {g1, g2} = {TreeGraph[{1, 2, 3, 4}, {1\[UndirectedEdge]3, 1\[UndirectedEdge]2, 1\[UndirectedEdge]4}], TreeGraph[{3, 2, 1, 4}, {1\[UndirectedEdge]3, 1\[UndirectedEdge]2, 1\[UndirectedEdge]4}]}

Out[1]= {[image], [image]}
```

The input vertex list controls the resulting vertex order:

```wl
In[2]:= VertexList /@ {g1, g2}

Out[2]= {{1, 2, 3, 4}, {3, 2, 1, 4}}
```

---

Any expression can be used as vertices:

```wl
In[1]:=
{TreeGraph[{a\[UndirectedEdge]b, a\[UndirectedEdge]c}], TreeGraph[{"foo"\[UndirectedEdge]"bar", "foo"\[UndirectedEdge]"gnu"}], 
	TreeGraph[{[image]\[UndirectedEdge][image], [image]\[UndirectedEdge][image]}]}

Out[1]= {[image], [image], [image]}

In[2]:= VertexList /@ %

Out[2]= {{a, b, c}, {"foo", "bar", "gnu"}, {[image], [image], [image]}}
```

#### Wrappers (5)

Use wrappers on vertices or edges:

```wl
In[1]:= {TreeGraph[{Style[1, Red], 2, 3, 4}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}], TreeGraph[{1, 2, 3, 4}, {Style[1\[UndirectedEdge]2, Red], 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]}

Out[1]= {[image], [image]}
```

---

Wrappers can be nested:

```wl
In[1]:= {TreeGraph[{Labeled[Style[1, Red], "hello"], 2, 3, 4}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}], TreeGraph[{1, 2, 3, 4}, {Style[Labeled[1\[UndirectedEdge]2, "hello"], Red], 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]}

Out[1]= {[image], [image]}
```

---

Add interactive behavior by wrappers such as ``Tooltip``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, Tooltip[Style[1\[UndirectedEdge]4, Red], "hello"]}]

Out[1]= [image]
```

Any object can be used in the tooltip:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, Tooltip[Style[1\[UndirectedEdge]4, Red], Plot[Sin[x], {x, 0, 2Pi}]]}]

Out[2]= [image]
```

---

Use ``Button`` to trigger actions when clicking an edge or vertex:

```wl
In[1]:= {TreeGraph[{1\[UndirectedEdge]2, Button[Style[1\[UndirectedEdge]3, Red], Speak["Edge from 1 to 3"]]}], TreeGraph[{1, 2, Button[Style[3, Red], Speak["Vertex 3"]]}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3}, VertexSize -> Medium]}

Out[1]= {[image], [image]}
```

---

Use ``PopupWindow`` to provide information drilldown:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, PopupWindow[Style[1\[UndirectedEdge]4, Red], DateListPlot[FinancialData["IBM", "Jan. 1, 2004"]]]}]

Out[1]= [image]
```

#### Styling (8)

Set the style for all vertices or edges:

```wl
In[1]:= {TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexStyle -> Green], TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeStyle -> Green]}

Out[1]= {[image], [image]}
```

---

Style individual vertices or edges using options:

```wl
In[1]:= {TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexStyle -> {1 -> Green, Orange}], TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeStyle -> {1\[UndirectedEdge]2 -> Green, Orange}]}

Out[1]= {[image], [image]}
```

Use wrappers for individual styling:

```wl
In[2]:= {TreeGraph[{Style[1, Green], 2, 3}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexStyle -> Orange], TreeGraph[{Style[1\[UndirectedEdge]2, Green], 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeStyle -> Orange]}

Out[2]= {[image], [image]}
```

---

Adjust the size of vertices using symbolic sizes:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, PlotLabel -> s], {s, {Tiny, Small, Medium, Large}}]

Out[1]= {[image], [image], [image], [image]}
```

Or use sizes in terms of the smallest distance between vertex centers:

```wl
In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, PlotLabel -> s], {s, {0.1, 0.2, 0.5, 1}}]

Out[2]= {[image], [image], [image], [image]}
```

---

Use built-in collections for ``VertexShapeFunction``:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> s, VertexSize -> 0.2, PlotLabel -> s], {s, {"Triangle", "Square", "Rectangle", "Pentagon", "Hexagon", "Octagon"}}]

Out[1]= {[image], [image], [image], [image], [image], [image]}
```

Rounded shapes:

```wl
In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> s, VertexSize -> 0.2, PlotLabel -> s], {s, ResourceData["VertexShapeFunction", "Rounded"]}]

Out[2]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

Concave shapes:

```wl
In[3]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> s, VertexSize -> 0.2, PlotLabel -> s], {s, ResourceData["VertexShapeFunction", "Concave"]}]

Out[3]= {[image], [image], [image], [image], [image]}
```

---

Draw individual vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> { 1 -> "Square"}, VertexSize -> 0.2]

Out[1]= [image]
```

Combine with a default vertex function:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> { 1 -> "Square", "Triangle"}, VertexSize -> 0.2]

Out[2]= [image]
```

---

Use any ``Graphics``, ``Image``, or ``Graphics3D`` as a vertex shape:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShape -> s, VertexSize -> Medium], {s, {[image], [image], [image]}}]

Out[1]= {[image], [image], [image]}
```

---

Use built-in collections for ``EdgeShapeFunction``:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, {"BoxLine", "DiamondLine", "DotLine"}}]

Out[1]= {[image], [image], [image]}
```

Directed edges including solid arrows:

```wl
In[2]:= Table[TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]

Out[2]= {[image], [image], [image], [image], [image], [image]}
```

Line arrows:

```wl
In[3]:= Table[TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "UnfilledArrow"]}]

Out[3]= {[image], [image], [image], [image], [image], [image]}
```

Open arrows:

```wl
In[4]:= Table[TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "CarvedArrow"]}]

Out[4]= {[image], [image], [image], [image]}
```

---

Specify an edge function for an individual edge:

```wl
In[1]:= TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {1\[DirectedEdge]2 -> "UnfilledArrow"}]

Out[1]= [image]
```

Combine with a different default edge function:

```wl
In[2]:= TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {1\[DirectedEdge]2 -> "FilledArrow", "CarvedArrow"}]

Out[2]= [image]
```

#### Labeling (6)

Label any edge or vertex:

```wl
In[1]:= {TreeGraph[{Labeled[1\[UndirectedEdge]2, "hello"], 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}], TreeGraph[{Labeled[1, "hello"], 2, 3}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]}

Out[1]= {[image], [image]}
```

---

Use any expression as a label:

```wl
In[1]:= Table[TreeGraph[{1, 2, Labeled[3, l]}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}], {l, {Sin[x], [image], [image]}}]

Out[1]= {[image], [image], [image]}

In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, Labeled[1\[UndirectedEdge]4, l]}], {l, {Sin[x], [image], [image]}}]

Out[2]= {[image], [image], [image]}
```

---

Control the placement of vertex labels using ``Placed``, including symbolic inside positions:

```wl
In[1]:= Table[TreeGraph[{1, 2, Labeled[3, Placed["■■", p]]}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3}, PlotLabel -> p, VertexSize -> 0.25, VertexShapeFunction -> "Square"], {p, {Left, Right, Top, Bottom}}]

Out[1]= {[image], [image], [image], [image]}
```

Symbolic outside positions:

```wl
In[2]:= Table[TreeGraph[{1, 2, Labeled[3, Placed["■■", p]]}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3}, PlotLabel -> p, VertexSize -> Small, VertexShapeFunction -> "Square"], {p, {Before, After, Below, Above}}]

Out[2]= {[image], [image], [image], [image]}
```

Coordinate-based positions:

```wl
In[3]:= Table[TreeGraph[{1, 2, Labeled[3, Placed["■", p]]}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3}, VertexSize -> 0.25, VertexShapeFunction -> "Square", PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Out[3]= {[image], [image], [image]}
```

---

Place multiple labels using ``Placed`` in a wrapper:

```wl
In[1]:= TreeGraph[{1, 2, 3, Labeled[4, Placed[{"lbl1", "lbl2"}, {Above, Below}]]}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[1]= [image]
```

Any number of labels can be used:

```wl
In[2]:= TreeGraph[{1, 2, 3, Labeled[4, Placed[{"lbl1", "lbl2", "lbl3", "lbl4"}, {Above, After, Below, Before}]]}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[2]= [image]
```

Place multiple labels using ``VertexLabels``:

```wl
In[3]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> {4 -> Placed[{"lbl1", "lbl2"}, {Above, Below}]}]

Out[3]= [image]
```

---

Use ``Placed`` with symbolic locations to control label placement along an edge:

```wl
In[1]:= Table[TreeGraph[{Labeled[1\[UndirectedEdge]2, Placed["■■", p]], 1\[UndirectedEdge]3}, PlotLabel -> p, VertexSize -> Small], {p, {"Start", "Middle", "End"}}]

Out[1]= {[image], [image], [image]}
```

Use explicit coordinates to place labels:

```wl
In[2]:= Table[TreeGraph[{Labeled[1\[UndirectedEdge]2, Placed["■■", p]], 1\[UndirectedEdge]3}, PlotLabel -> p, VertexSize -> Small, BaselinePosition -> Bottom], {p, {0, 1 / 4, 1 / 3}}]

Out[2]= {[image], [image], [image]}
```

---

Place multiple labels using ``Placed`` in a wrapper:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, Labeled[1\[UndirectedEdge]4, Placed[{"lbl1", "lbl2"}, {"Start", "End"}]]}]

Out[1]= [image]
```

Any number of labels can be used:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, Labeled[1\[UndirectedEdge]4, Placed[{"lbl1", "lbl2", "lbl3"}, {"Start", "Middle", "End"}]]}]

Out[2]= [image]
```

Place multiple labels using ``EdgeLabels``:

```wl
In[3]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> {1\[UndirectedEdge]4 -> Placed[{"lbl1", "lbl2"}, {"Start", "End"}]}]

Out[3]= [image]
```

### Options (82)

#### AnnotationRules (3)

Specify an annotation for vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, AnnotationRules -> {1 -> {VertexLabels -> "hello"}}]

Out[1]= [image]
```

---

Edges:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, AnnotationRules -> {1\[UndirectedEdge]2 -> {EdgeLabels -> "hello"}}]

Out[1]= [image]
```

---

Graph itself:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, AnnotationRules -> {"GraphProperties" -> {"Message" -> "hello"}}]

Out[1]= [image]

In[2]:= AnnotationValue[%, "Message"]

Out[2]= "hello"
```

#### DirectedEdges (2)

By default, a directed tree is generated when giving a list of rules:

```wl
In[1]:= TreeGraph[{1 -> 2, 1 -> 3, 1 -> 4}, EdgeStyle -> Arrowheads[Medium], EdgeShapeFunction -> "Arrow"]

Out[1]= [image]
```

Use ``DirectedEdges -> False`` to interpret rules as undirected edges:

```wl
In[2]:= TreeGraph[{1 -> 2, 1 -> 3, 1 -> 4}, DirectedEdges -> False]

Out[2]= [image]
```

---

Use ``DirectedEdge`` or ``UndirectedEdge`` to directly specify whether a graph is directed or not:

```wl
In[1]:= {TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeStyle -> Arrowheads[Medium], EdgeShapeFunction -> "Arrow"], TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]}

Out[1]= {[image], [image]}
```

#### EdgeLabels (7)

Label the edge ``1\[UndirectedEdge]2``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> {1\[UndirectedEdge]2 -> "Hello"}]

Out[1]= [image]
```

---

Label all edges:

```wl
In[1]:= el = {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4};

In[2]:= TreeGraph[el, EdgeLabels -> Table[el[[i]] -> Subscript["e", i], {i, Length[el]}]]

Out[2]= [image]
```

---

Use any expression as a label:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> {1\[UndirectedEdge]2 -> [image], 1\[UndirectedEdge]3 -> [image], 1\[UndirectedEdge]4 -> [image]}]

Out[1]= [image]
```

---

Use ``Placed`` with symbolic locations to control label placement along an edge:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> {1\[UndirectedEdge]2 -> Placed["■■■", p]}, PlotLabel -> p], {p, {"Start", "Middle", "End"}}]

Out[1]= {[image], [image], [image]}
```

---

Use explicit coordinates to place labels:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> {1\[UndirectedEdge]2 -> Placed["■■■", p]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {0, 1 / 3, 1 / 4}}]

Out[1]= {[image], [image], [image]}
```

Vary positions within the label:

```wl
In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> {1\[UndirectedEdge]2 -> Placed["■■■", {1 / 2, p}]}, PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Out[2]= {[image], [image], [image]}
```

---

Place multiple labels using ``Placed`` in a wrapper:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, Labeled[1\[UndirectedEdge]4, Placed[{"lbl1", "lbl2"}, {"Start", "End"}]]}]

Out[1]= [image]
```

Any number of labels can be used:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, Labeled[1\[UndirectedEdge]4, Placed[{"lbl1", "lbl2", "lbl3"}, {"Start", "Middle", "End"}]]}]

Out[2]= [image]
```

Place multiple labels using ``EdgeLabels``:

```wl
In[3]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> {1\[UndirectedEdge]4 -> Placed[{"lbl1", "lbl2"}, {"Start", "End"}]}]

Out[3]= [image]
```

---

Use automatic labeling by values through ``Tooltip`` and ``StatusArea``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> Placed["Name", Tooltip]]

Out[1]= [image]

In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeLabels -> Placed["Name", StatusArea]]

Out[2]= [image]
```

#### EdgeShapeFunction (6)

Get a list of built-in settings for ``EdgeShapeFunction``:

```wl
In[1]:= ResourceData["EdgeShapeFunction"]

Out[1]= {"Arrow", "BoxLine", "CarvedArcArrow", "CarvedArrow", "DashedLine", "DiamondLine", "DotLine", "DottedLine", "FilledArcArrow", "FilledArrow", "HalfFilledArrow", "HalfFilledDoubleArrow", "HalfUnfilledArrow", "HalfUnfilledDoubleArrow", "Line", "ShortCarvedArcArrow", "ShortCarvedArrow", "ShortFilledArcArrow", "ShortFilledArrow", "ShortUnfilledArcArrow", "ShortUnfilledArrow", "UnfilledArcArrow", "UnfilledArrow"}
```

---

Undirected edges including the basic line:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeShapeFunction -> "Line"]

Out[1]= [image]
```

Lines with different glyphs on the edges:

```wl
In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, {"BoxLine", "DiamondLine", "DotLine"}}]

Out[2]= {[image], [image], [image]}
```

---

Directed edges including solid arrows:

```wl
In[1]:= Table[TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]

Out[1]= {[image], [image], [image], [image], [image], [image]}
```

Line arrows:

```wl
In[2]:= Table[TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "UnfilledArrow"]}]

Out[2]= {[image], [image], [image], [image], [image], [image]}
```

Open arrows:

```wl
In[3]:= Table[TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "CarvedArrow"]}]

Out[3]= {[image], [image], [image], [image]}
```

---

Specify an edge function for an individual edge:

```wl
In[1]:= TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {1\[DirectedEdge]2 -> "FilledArcArrow"}]

Out[1]= [image]
```

Combine with a different default edge function:

```wl
In[2]:= TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1\[DirectedEdge]4}, EdgeShapeFunction -> {1\[DirectedEdge]2 -> "FilledArcArrow", "CarvedArrow"}]

Out[2]= [image]
```

---

Draw edges by running a program:

```wl
In[1]:=
ef[pts_List, e_] := 
	Block[{s = 0.015, g = [image]}, {Arrowheads[{{s, 0.33, g}, {s, 0.67, g}}], Arrow[pts]}]

In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeShapeFunction -> ef]

Out[2]= [image]
```

---

``EdgeShapeFunction`` can be combined with ``EdgeStyle``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeStyle -> Blue, EdgeShapeFunction -> (Line[#1]&)]

Out[1]= [image]
```

``EdgeShapeFunction`` has higher priority than ``EdgeStyle``:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeStyle -> Blue, EdgeShapeFunction -> ({Red, Line[#1]}&)]

Out[2]= [image]
```

#### EdgeStyle (2)

Style all edges:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeStyle -> style, PlotLabel -> style], {style, {Gray, Dashed, Thick}}]

Out[1]= {[image], [image], [image]}
```

---

Style individual edges:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeStyle -> {1\[UndirectedEdge]2 -> Blue, 1\[UndirectedEdge]3 -> Dashed}]

Out[1]= [image]
```

#### EdgeWeight (2)

Specify the weight for all edges:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeWeight -> RandomInteger[5, 3]]

Out[1]= [image]

In[2]:= WeightedAdjacencyMatrix[%]//MatrixForm

Out[2]//MatrixForm=
(⁠|   |   |   |   |
| - | - | - | - |
| 0 | 4 | 5 | 3 |
| 4 | 0 | 0 | 0 |
| 5 | 0 | 0 | 0 |
| 3 | 0 | 0 | 0 |⁠)
```

---

Use any numeric expression as a weight:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, EdgeWeight -> {a, b, c}]

Out[1]= [image]

In[2]:= WeightedAdjacencyMatrix[%]//MatrixForm

Out[2]//MatrixForm=
(⁠|   |   |   |   |
| - | - | - | - |
| 0 | a | b | c |
| a | 0 | 0 | 0 |
| b | 0 | 0 | 0 |
| c | 0 | 0 | 0 |⁠)
```

#### GraphHighlight (3)

Highlight the vertex ``1`` :

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> Medium, GraphHighlight -> {1}]

Out[1]= [image]
```

---

Highlight the edge ``1\[UndirectedEdge]3`` :

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> Tiny, GraphHighlight -> {1\[UndirectedEdge]3}]

Out[1]= [image]
```

---

Highlight vertices and edges:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> Tiny, GraphHighlight -> {1, 2, 1\[UndirectedEdge]2, 1\[UndirectedEdge]3}]

Out[1]= [image]
```

#### GraphHighlightStyle (2)

Get a list of built-in settings for ``GraphHighlightStyle``:

```wl
In[1]:= ResourceData["GraphHighlightStyle"]

Out[1]= {Automatic, "Dashed", "Dotted", "Thick", "VertexConcaveDiamond", "VertexDiamond", "VertexTriangle", "DehighlightFade", "DehighlightGray", "DehighlightHide"}
```

---

Use built-in settings for ``GraphHighlightStyle`` :

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, GraphHighlight -> {1, 1\[UndirectedEdge]3}, VertexSize -> Small, GraphHighlightStyle -> #, PlotLabel -> #]& /@ Select[ResourceData["GraphHighlightStyle"], # =!= Automatic&]

Out[1]= {[image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

#### GraphLayout (5)

By default, the layout is chosen automatically:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, GraphLayout -> Automatic]

Out[1]= [image]
```

---

Specify layouts on special curves:

```wl
In[1]:= Table[TreeGraph[Table[i\[UndirectedEdge]i + 1, {i, 20}], GraphLayout -> l, PlotLabel -> l], {l, {"CircularEmbedding", "SpiralEmbedding"}}]

Out[1]= {[image], [image]}
```

---

Specify layouts that satisfy optimality criteria:

```wl
In[1]:= el = EdgeList@CompleteKaryTree[4, 5];

In[2]:= Table[TreeGraph[el, GraphLayout -> l, PlotLabel -> l], {l, {"SpringEmbedding", "SpringElectricalEmbedding", "HighDimensionalEmbedding"}}]

Out[2]= {[image], [image], [image]}
```

---

``VertexCoordinates`` overrides ``GraphLayout`` coordinates:

```wl
In[1]:=
{TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, GraphLayout -> "SpringElectricalEmbedding"], 
	TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, GraphLayout -> "SpringElectricalEmbedding", VertexCoordinates -> Table[{i, i}, {i, 0, 3}]]}

Out[1]= {[image], [image]}
```

---

Use ``AbsoluteOptions`` to extract ``VertexCoordinates`` computed using a layout algorithm:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[1]= [image]

In[2]:= AbsoluteOptions[%, VertexCoordinates]

Out[2]= {VertexCoordinates -> {{0.774597, 0.774597}, {0., 0.}, {0.774597, 0.}, {1.54919, 0.}}}
```

#### PlotTheme (4)

##### Base Themes (2)

---

Use a common base theme:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, PlotTheme -> "Business"]

Out[1]= [image]
```

---

Use a monochrome theme:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, PlotTheme -> "Monochrome"]

Out[1]= [image]
```

##### Feature Themes (2)

---

Use a large graph theme:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, PlotTheme -> "LargeGraph"]

Out[1]= [image]
```

---

Use a classic diagram theme:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, PlotTheme -> "ClassicDiagram"]

Out[1]= [image]
```

#### VertexCoordinates (3)

By default, any vertex coordinates are computed automatically:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[1]= [image]
```

Extract the resulting vertex coordinates using ``AbsoluteOptions``:

```wl
In[2]:= AbsoluteOptions[%, VertexCoordinates]

Out[2]= {VertexCoordinates -> {{0.774597, 0.774597}, {0., 0.}, {0.774597, 0.}, {1.54919, 0.}}}
```

---

Specify a layout function along an ellipse:

```wl
In[1]:= ellipseLayout[n_, {a_, b_}] := Table[{a Cos[2Pi / n u], b Sin[2Pi / n u]}, {u, 1, n}]

In[2]:= Graphics[Point[ellipseLayout[20, {2, 1}]]]

Out[2]= [image]
```

Use it to generate vertex coordinates for a graph:

```wl
In[3]:= TreeGraph[Table[1\[UndirectedEdge]i, {i, 2, 20}], VertexCoordinates -> ellipseLayout[20, {2, 1}]]

Out[3]= [image]
```

---

``VertexCoordinates`` has higher priority than ``GraphLayout`` :

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexCoordinates -> Table[{i, i}, {i, 4}], GraphLayout -> "CircularEmbedding"]

Out[1]= [image]
```

#### VertexLabels (13)

Use vertex names as labels:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> "Name"]

Out[1]= [image]
```

---

Label individual vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> {2 -> "one"}]

Out[1]= [image]
```

---

Label all vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> Table[i -> Subscript[v, i], {i, 4}]]

Out[1]= [image]
```

---

Use any expression as a label:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3}, VertexLabels -> {1 -> [image], 2 -> [image], 3 -> [image]}, ImagePadding -> 30]

Out[1]= [image]
```

---

Use ``Placed`` with symbolic locations to control label placement, including outside positions:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■■■", p], {i, 4}], PlotLabel -> p], {p, {Before, After, Below, Above}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Symbolic outside-corner positions:

```wl
In[1]:= pl = {{Before, Below}, {After, Below}, {Before, Above}, {After, Above}};

In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■■■", p], {i, 4}], PlotLabel -> p], {p, pl}]

Out[2]= {[image], [image], [image], [image]}
```

---

Symbolic inside positions:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.35, VertexLabels -> Table[i -> Placed["■■■", p], {i, 4}], VertexShapeFunction -> "Square", PlotLabel -> p], {p, {Left, Top, Right, Bottom}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Symbolic inside-corner positions:

```wl
In[1]:= pl = {{Left, Bottom}, {Right, Bottom}, {Left, Top}, {Right, Top}};

In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.35, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■■■", p], {i, 4}], PlotLabel -> p], {p, pl}]

Out[2]= {[image], [image], [image], [image]}
```

---

Use explicit coordinates to place the center of labels:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.25, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 4}], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Out[1]= {[image], [image], [image]}
```

---

Place all labels at the upper-right corner of the vertex and vary the coordinates within the label:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.35, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], {{1, 1}, p}], {i, 4}], PlotLabel -> p, BaselinePosition -> Bottom], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

Out[1]= {[image], [image], [image]}
```

---

Place multiple labels using ``Placed`` in a wrapper:

```wl
In[1]:= TreeGraph[{1, 2, 3, Labeled[4, Placed[{"lbl1", "lbl2"}, {Above, Below}]]}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[1]= [image]
```

Any number of labels can be used:

```wl
In[2]:= TreeGraph[{1, 2, 3, Labeled[4, Placed[{"lbl1", "lbl2", "lbl3", "lbl4"}, {Above, After, Below, Before}]]}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}]

Out[2]= [image]
```

Place multiple labels using ``VertexLabels``:

```wl
In[3]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> {4 -> Placed[{"lbl1", "lbl2"}, {Above, Below}]}]

Out[3]= [image]
```

---

Use the argument to ``Placed`` to control formatting including ``Tooltip``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> Placed["Name", Tooltip]]

Out[1]= [image]
```

Or ``StatusArea``:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> Placed["Name", StatusArea]]

Out[2]= [image]
```

---

Use more elaborate formatting functions:

```wl
In[1]:= rotateLabel[lab_] := Rotate[lab, 45Degree]

In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> Table[i -> Placed["xxx", Below, rotateLabel], {i, 4}]]

Out[2]= [image]

In[3]:= panelLabel[lab_] := Panel[lab, FrameMargins -> 0, Background -> Lighter[Yellow, 0.7]]

In[4]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> Table[i -> Placed["xxx", Center, panelLabel], {i, 4}]]

Out[4]= [image]

In[5]:= hyperlinkLabel[lab_] := Hyperlink[lab, "http://www.wolfram.com"]

In[6]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexLabels -> Table[i -> Placed["xxx", Center, hyperlinkLabel], {i, 4}]]

Out[6]= [image]
```

#### VertexShape (5)

Use any ``Graphics``, ``Image``, or ``Graphics3D`` as a vertex shape:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShape -> s, VertexSize -> 0.3], {s, {[image], [image], [image]}}]

Out[1]= {[image], [image], [image]}
```

---

Specify vertex shapes for individual vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShape -> {2 -> [image]}, VertexSize -> 0.3]

Out[1]= [image]
```

---

``VertexShape`` can be combined with ``VertexSize``:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {Medium, Large}}]

Out[1]= {[image], [image]}
```

---

``VertexShape`` is not affected by ``VertexStyle``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.3, VertexShape -> [image], VertexStyle -> Blue]

Out[1]= [image]
```

---

``VertexShapeFunction`` has higher priority than ``VertexShape`` :

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.2, VertexShapeFunction -> "Square", VertexShape -> [image]]

Out[1]= [image]
```

#### VertexShapeFunction (10)

Get a list of built-in collections for ``VertexShapeFunction``:

```wl
In[1]:= ResourceData["VertexShapeFunction"]

Out[1]= {"Capsule", "Circle", "ConcaveDiamond", "ConcaveHexagon", "ConcavePentagon", "ConcaveSquare", "ConcaveTriangle", "Diamond", "DownTrapezoid", "FiveDown", "Hexagon", "Octagon", "Parallelogram", "Pentagon", "Point", "Rectangle", "RoundedDiamond", "RoundedDownTrapezoid", "RoundedFiveDown", "RoundedHexagon", "RoundedParallelogram", "RoundedPentagon", "RoundedRectangle", "RoundedSquare", "RoundedTriangle", "RoundedUpTrapezoid", "Square", "Star", "Triangle", "UpTrapezoid"}
```

---

Use built-in settings for ``VertexShapeFunction`` in the ``"Basic"`` collection:

```wl
In[1]:= ResourceData["VertexShapeFunction", "Basic"]

Out[1]= {"Capsule", "Circle", "Diamond", "DownTrapezoid", "FiveDown", "Hexagon", "Octagon", "Parallelogram", "Pentagon", "Point", "Rectangle", "Square", "Star", "Triangle", "UpTrapezoid"}
```

Simple basic shapes:

```wl
In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"Triangle", "Square", "Rectangle", "Pentagon", "Hexagon", "Octagon"}}]

Out[2]= {[image], [image], [image], [image], [image], [image]}
```

Common basic shapes:

```wl
In[3]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, {"DownTrapezoid", "UpTrapezoid", "Parallelogram", "FiveDown", "Circle", "Diamond", "Star", "Capsule"}}]

Out[3]= {[image], [image], [image], [image], [image], [image], [image], [image]}
```

---

Use built-in settings for ``VertexShapeFunction`` in the ``"Rounded"`` collection:

```wl
In[1]:= ResourceData["VertexShapeFunction", "Rounded"]

Out[1]= {"RoundedDiamond", "RoundedDownTrapezoid", "RoundedFiveDown", "RoundedHexagon", "RoundedParallelogram", "RoundedPentagon", "RoundedRectangle", "RoundedSquare", "RoundedTriangle", "RoundedUpTrapezoid"}

In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Rounded"]}]

Out[2]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

---

Use built-in settings for ``VertexShapeFunction`` in the ``"Concave"`` collection:

```wl
In[1]:= ResourceData["VertexShapeFunction", "Concave"]

Out[1]= {"ConcaveDiamond", "ConcaveHexagon", "ConcavePentagon", "ConcaveSquare", "ConcaveTriangle"}

In[2]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Concave"]}]

Out[2]= {[image], [image], [image], [image], [image]}
```

---

Draw individual vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> { 1 -> "Square"}, VertexSize -> 0.2]

Out[1]= [image]
```

Combine with a default vertex function:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> { 1 -> "Square", "Triangle"}, VertexSize -> 0.2]

Out[2]= [image]
```

---

Draw vertices using a predefined graphic:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> (Inset[[image], #]&)]

Out[1]= [image]
```

---

Draw vertices by running a program:

```wl
In[1]:=
vf[{xc_, yc_}, name_, {w_, h_}] := 
	Block[{xmin = xc - w, xmax = xc + w, ymin = yc - h, ymax = yc + h}, 
	Polygon[{{xmin, ymin}, {xmax, ymax}, {xmin, ymax}, {xmax, ymin}}]
	];

In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> vf, VertexSize -> 0.2]

Out[2]= [image]
```

---

``VertexShapeFunction`` can be combined with ``VertexStyle``:

```wl
In[1]:= vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]

In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]

Out[2]= [image]
```

``VertexShapeFunction`` has higher priority than ``VertexStyle``:

```wl
In[3]:= vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}

In[4]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]

Out[4]= [image]
```

---

``VertexShapeFunction`` can be combined with ``VertexSize``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexShapeFunction -> "Star", VertexSize -> {1 -> Small, Medium}]

Out[1]= [image]
```

---

``VertexShapeFunction`` has higher priority than ``VertexShape``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.3, VertexShapeFunction -> "Star", VertexShape -> [image]]

Out[1]= [image]
```

#### VertexSize (8)

By default, the size of vertices is computed automatically:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> Automatic]

Out[1]= [image]
```

---

Specify the size of all vertices using symbolic vertex size:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, PlotLabel -> s], {s, {Tiny, Small, Medium, Large}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Use a fraction of the minimum distance between vertex coordinates:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, PlotLabel -> s], {s, 0.1, 1, 0.3}]

Out[1]= {[image], [image], [image], [image]}
```

---

Use a fraction of the overall diagonal for all vertex coordinates:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> {"Scaled", s}, PlotLabel -> {"Scaled", s}], {s, 0.1, 1, 0.3}]

Out[1]= {[image], [image], [image], [image]}
```

---

Specify size in both the $x$ and $y$ directions:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, PlotLabel -> s], {s, {{0.1, 0.2}, {0.2, 0.1}}}]

Out[1]= {[image], [image]}
```

---

Specify the sizes for individual vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> {1 -> 0.2, 2 -> 0.3}]

Out[1]= [image]
```

---

``VertexSize`` can be combined with ``VertexShapeFunction`` :

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, VertexShapeFunction -> "Square", PlotLabel -> s], {s, {0.05, 0.1, 0.2}}]

Out[1]= {[image], [image], [image]}
```

---

``VertexSize`` can be combined with ``VertexShape`` :

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> s, VertexShape -> [image], PlotLabel -> s], {s, {0.1, 0.2, 0.4}}]

Out[1]= {[image], [image], [image]}
```

#### VertexStyle (5)

Style all vertices:

```wl
In[1]:= Table[TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexStyle -> style, VertexSize -> 0.3, PlotLabel -> style], {style, {Yellow, EdgeForm[Dashed]}}]

Out[1]= {[image], [image]}
```

---

Style individual vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexStyle -> {1 -> Blue, 2 -> Red}, VertexSize -> 0.2]

Out[1]= [image]
```

---

``VertexShapeFunction`` can be combined with ``VertexStyle``:

```wl
In[1]:= vf1[{xc_, yc_}, name_, {w_, h_}] := Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]

In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]

Out[2]= [image]
```

``VertexShapeFunction`` has higher priority than ``VertexStyle``:

```wl
In[3]:= vf2[{xc_, yc_}, name_, {w_, h_}] := {Red, Rectangle[{xc - w, yc - h}, {xc + w, yc + h}]}

In[4]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]

Out[4]= [image]
```

---

``VertexStyle`` can be combined with ``BaseStyle``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexStyle -> LightBlue, BaseStyle -> EdgeForm[Dotted], VertexSize -> 0.2]

Out[1]= [image]
```

``VertexStyle`` has higher priority than ``BaseStyle``:

```wl
In[2]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexStyle -> LightBlue, BaseStyle -> Gray, VertexSize -> 0.2]

Out[2]= [image]
```

---

``VertexShape`` is not affected by ``VertexStyle``:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexSize -> 0.3, VertexShape -> [image], VertexStyle -> Blue]

Out[1]= [image]
```

#### VertexWeight (2)

Set the weight for all vertices:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexWeight -> {2, 3, 4, 5}]

Out[1]= [image]

In[2]:= AnnotationValue[{%, 1}, VertexWeight]

Out[2]= 2
```

---

Use any numeric expression as a weight:

```wl
In[1]:= TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 1\[UndirectedEdge]4}, VertexWeight -> {a, b, c, d}]

Out[1]= [image]

In[2]:= AnnotationValue[{%, 1}, VertexWeight]

Out[2]= a
```

### Applications (4)

Generate a random tree:

```wl
In[1]:= g = TreeGraph[RandomInteger[#] \[UndirectedEdge] # + 1 & /@ Range[0, 30], VertexSize -> 0.4]

Out[1]= [image]
```

Highlight the ``GraphCenter`` and ``GraphPeriphery`` :

```wl
In[2]:= {HighlightGraph[g, GraphCenter[g]], HighlightGraph[g, GraphPeriphery[g]]}

Out[2]= {[image], [image]}
```

---

The ``VertexEccentricity`` :

```wl
In[1]:= g = TreeGraph[RandomInteger[#] \[UndirectedEdge] # + 1 & /@ Range[0, 30], VertexSize -> 0.4];

In[2]:= VertexEccentricity[g, #]& /@ Range[3]

Out[2]= {5, 6, 7}
```

Highlight the vertex eccentricity path:

```wl
In[3]:=
FindVertexEccentricityPath[g_ ? UndirectedGraphQ, u_] /; MemberQ[VertexList[g], u] := Module[{d = GraphDistanceMatrix[g], posu, posv, vl = VertexList[g]}, posu = VertexIndex[g, u];
	posv = First@First@Position[d[[posu]], Max[d[[posu]]]];
	PathGraph[FindShortestPath[g, u, vl[[posv]]]]]

In[4]:= Table[HighlightGraph[g, FindVertexEccentricityPath[g, u]], {u, Range[3]}]

Out[4]= {[image], [image], [image]}
```

---

The ``GraphRadius`` :

```wl
In[1]:= g = TreeGraph[RandomInteger[#] \[UndirectedEdge] # + 1 & /@ Range[0, 30], VertexSize -> 0.4];

In[2]:= GraphRadius[g]

Out[2]= 6
```

Highlight the radius path:

```wl
In[3]:=
FindRadiusPath[g_ ? UndirectedGraphQ] := Module[{c = First@GraphCenter[g], d, v, pos}, d = Table[GraphDistance[g, c, u], {u, VertexList[g]}];
	pos = First@Position[d, Max[d]];
	v = First@Part[VertexList[g], pos];
	PathGraph[FindShortestPath[g, c, v]]]

In[4]:= HighlightGraph[g, FindRadiusPath[g]]

Out[4]= [image]
```

---

The ``GraphDiameter`` :

```wl
In[1]:= g = TreeGraph[RandomInteger[#] \[UndirectedEdge] # + 1 & /@ Range[0, 30], VertexSize -> 0.4];

In[2]:= GraphDiameter[g]

Out[2]= 8
```

Highlight the diameter path:

```wl
In[3]:=
FindDiameterPath[g_ ? UndirectedGraphQ] := Module[{d = GraphDistanceMatrix[g], u, v, pos}, pos = First@Position[d, Max[d]];
	{u, v} = Part[VertexList[g], pos];
	PathGraph[FindShortestPath[g, u, v]]]

In[4]:= HighlightGraph[g, FindDiameterPath[g]]

Out[4]= [image]
```

### Properties & Relations (9)

Use ``VertexCount`` and ``EdgeCount`` to count vertices and edges:

```wl
In[1]:= g = CompleteKaryTree[3, 3]

Out[1]= [image]

In[2]:= {VertexCount[g], EdgeCount[g]}

Out[2]= {13, 12}
```

---

Use ``VertexList`` and ``EdgeList`` to enumerate vertices and edges in standard order:

```wl
In[1]:= g = TreeGraph[{1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 3\[UndirectedEdge]4}];

In[2]:= {VertexList[g], EdgeList[g]}

Out[2]= {{1, 2, 3, 4}, {1\[UndirectedEdge]2, 1\[UndirectedEdge]3, 3\[UndirectedEdge]4}}
```

Edges and vertices are given in the order they are input:

```wl
In[3]:= g1 = TreeGraph[{3\[UndirectedEdge]4, 1\[UndirectedEdge]2, 1\[UndirectedEdge]3}];

In[4]:= {VertexList[g1], EdgeList[g1]}

Out[4]= {{3, 4, 1, 2}, {3\[UndirectedEdge]4, 1\[UndirectedEdge]2, 1\[UndirectedEdge]3}}
```

---

Compute the ``AdjacencyMatrix`` from a graph:

```wl
In[1]:= g = TreeGraph[{1\[DirectedEdge]2, 1\[DirectedEdge]3, 1 -> 4}, EdgeStyle -> Arrowheads[Medium], EdgeShapeFunction -> "Arrow"]

Out[1]= [image]

In[2]:= (a = AdjacencyMatrix[g]//Normal)//MatrixForm

Out[2]//MatrixForm=
(⁠|   |   |   |   |
| - | - | - | - |
| 0 | 1 | 1 | 1 |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 0 |⁠)
```

---

A tree graph is connected:

```wl
In[1]:= CompleteKaryTree[3, 3]

Out[1]= [image]

In[2]:= {ConnectedGraphQ[%], TreeGraphQ[%]}

Out[2]= {True, True}
```

---

A tree graph does not have any loops or cycles:

```wl
In[1]:= TreeGraph[Range[8], {1, 1, 2, 1, 4, 2, 3, 1}]

Out[1]= [image]

In[2]:= {LoopFreeGraphQ[%], AcyclicGraphQ[%], TreeGraphQ[%]}

Out[2]= {True, True, True}
```

---

A tree graph with $n$ vertices has $n-1$ edges:

```wl
In[1]:= TreeGraph[{1 -> 2, 1 -> 3, 2 -> 4, 2 -> 5, 3 -> 6}]

Out[1]= [image]

In[2]:= VertexCount[%] - EdgeCount[%]

Out[2]= 1
```

---

A tree graph is a bipartite graph:

```wl
In[1]:= CompleteKaryTree[3, 3]

Out[1]= [image]

In[2]:= { TreeGraphQ[%], BipartiteGraphQ[%]}

Out[2]= {True, True}
```

---

A tree graph with $n$ vertices with $n>1$ has at least two and at most $n-1$ vertices of degree 1:

```wl
In[1]:= TreeGraph[{1 -> 2, 1 -> 3}]

Out[1]= [image]

In[2]:= VertexDegree[%]

Out[2]= {2, 1, 1}

In[3]:= CompleteKaryTree[2, 6]

Out[3]= [image]

In[4]:= VertexDegree[%]

Out[4]= {6, 1, 1, 1, 1, 1, 1}
```

---

A star graph is a tree graph:

```wl
In[1]:= StarGraph[10]

Out[1]= [image]

In[2]:= TreeGraphQ[%]

Out[2]= True
```

## See Also

* [`Graph`](https://reference.wolfram.com/language/ref/Graph.en.md)
* [`UndirectedEdge`](https://reference.wolfram.com/language/ref/UndirectedEdge.en.md)
* [`DirectedEdge`](https://reference.wolfram.com/language/ref/DirectedEdge.en.md)
* [`TreeGraphQ`](https://reference.wolfram.com/language/ref/TreeGraphQ.en.md)
* [`KaryTree`](https://reference.wolfram.com/language/ref/KaryTree.en.md)
* [`CompleteKaryTree`](https://reference.wolfram.com/language/ref/CompleteKaryTree.en.md)
* [`StarGraph`](https://reference.wolfram.com/language/ref/StarGraph.en.md)
* [`FindSpanningTree`](https://reference.wolfram.com/language/ref/FindSpanningTree.en.md)
* [`TreePlot`](https://reference.wolfram.com/language/ref/TreePlot.en.md)
* [`PathGraph`](https://reference.wolfram.com/language/ref/PathGraph.en.md)
* [`PlanarGraph`](https://reference.wolfram.com/language/ref/PlanarGraph.en.md)
* [`TextStructure`](https://reference.wolfram.com/language/ref/TextStructure.en.md)
* [`Groupings`](https://reference.wolfram.com/language/ref/Groupings.en.md)

## Related Guides

* [Graph Construction & Representation](https://reference.wolfram.com/language/guide/GraphConstructionAndRepresentation.en.md)
* [Tree Construction & Representation](https://reference.wolfram.com/language/guide/TreeConstructionAndRepresentation.en.md)
* [Discrete Mathematics](https://reference.wolfram.com/language/guide/DiscreteMathematics.en.md)
* [Computation on Trees](https://reference.wolfram.com/language/guide/ComputationOnTrees.en.md)

## History

* [Introduced in 2010 (8.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn80.en.md) \| [Updated in 2015 (10.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn103.en.md)