---
title: "Graph"
language: "en"
type: "Symbol"
summary: "Graph[{e1, e2, ...}] yields a graph with edges ej. Graph[{v 1, v 2, ...}, {e1, e2, ...}] yields the graph with vertices vi and edges ej. Graph[{..., wi[vi, ...], ...}, {..., wj[ej, ...], ...}] yields a graph with vertex and edge properties defined by the symbolic wrappers wk. Graph[data] yields a graph from data."
keywords: 
- network
- graph
- directed graph
- undirected graph
- simple graph
- directed acyclic graph
- dag
- tree graph
- multi graph
- multiple edge graph
- multi edge graph
- sociogram
canonical_url: "https://reference.wolfram.com/language/ref/Graph.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Graph Construction & Representation"
    link: "https://reference.wolfram.com/language/guide/GraphConstructionAndRepresentation.en.md"
  - 
    title: "Graph Visualization"
    link: "https://reference.wolfram.com/language/guide/GraphVisualization.en.md"
  - 
    title: "Graphs & Networks"
    link: "https://reference.wolfram.com/language/guide/GraphsAndNetworks.en.md"
  - 
    title: "Discrete Mathematics"
    link: "https://reference.wolfram.com/language/guide/DiscreteMathematics.en.md"
  - 
    title: "Social Network Analysis"
    link: "https://reference.wolfram.com/language/guide/SocialNetworks.en.md"
  - 
    title: "Graph Layouts"
    link: "https://reference.wolfram.com/language/guide/GraphLayouts.en.md"
  - 
    title: "WDF (Wolfram Data Framework)"
    link: "https://reference.wolfram.com/language/guide/WDFWolframDataFramework.en.md"
  - 
    title: "Life Sciences & Medicine: Data & Computation"
    link: "https://reference.wolfram.com/language/guide/LifeSciencesAndMedicineDataAndComputation.en.md"
  - 
    title: "Scientific Models"
    link: "https://reference.wolfram.com/language/guide/ScientificModels.en.md"
  - 
    title: "Molecular Structure & Computation"
    link: "https://reference.wolfram.com/language/guide/MolecularStructureAndComputation.en.md"
  - 
    title: "Scientific Data Analysis"
    link: "https://reference.wolfram.com/language/guide/ScientificDataAnalysis.en.md"
  - 
    title: "Database Connectivity"
    link: "https://reference.wolfram.com/language/guide/DatabaseConnectivity.en.md"
  - 
    title: "Wolfram Data Repository"
    link: "https://reference.wolfram.com/language/guide/WolframDataRepository.en.md"
---
# Graph

Graph[{e1, e2, …}] yields a graph with edges ej.

Graph[{v1, v2, …}, {e1, e2, …}] yields the graph with vertices vi and edges ej. 

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

Graph[data] yields a graph from data.

## Details and Options

* ``Graph[…]`` displays in a notebook as a plot of a graph.

[image]

* ``Graph[…]`` is always converted to an optimized standard form with structure ``Graph[vertices, edges, …]``.

* ``Graph`` is treated as a raw object by functions like ``AtomQ``, and for purposes of pattern matching.

* An undirected edge between ``u`` and ``v`` can be given as ``u\[UndirectedEdge]v``, ``u <-> v``, ``UndirectedEdge[u, v]`` or ``TwoWayRule[u, v]``. The character ``\[UndirectedEdge]`` can be entered as esc`` ue ``esc.

* A directed edge from ``u`` to ``v`` can be given as ``u\[DirectedEdge]v``, ``u -> v``, ``DirectedEdge[u, v]``, or ``Rule[u, v]``. The character ``\[DirectedEdge]`` can be entered as esc`` de ``esc.

* A tagged edge from ``u`` to ``v`` can be given as ``uOverscript[\[UndirectedEdge], t]v``, ``uOverscript[\[DirectedEdge], t]v``, ``UndirectedEdge[u, v, t]`` or ``DirectedEdge[u, v, t]``.

* An undirected graph is specified using a collection of undirected edges.

* A directed graph is specified using a collection of directed edges.

* A mixed graph is specified using a collection of directed and undirected edges.

* The following special wrappers can be used for vertices and edges:

|                      |                                                            |
| -------------------- | ---------------------------------------------------------- |
| Annotation[a, label] | provide an annotation                                      |
| Button[a, action]    | define an action to execute when the element is clicked    |
| EventHandler[a, …]   | define a general event handler for the element             |
| Hyperlink[a, uri]    | make the element act as a hyperlink                        |
| Labeled[a, …]        | display the element with labeling                          |
| PopupWindow[a, cont] | attach a popup window to the element                       |
| StatusArea[a, label] | display in the status area when the element is moused over |
| Style[a, opts]       | show the element using the specified styles                |
| Tooltip[a, label]    | attach an arbitrary tooltip to the element                 |

* The possible label placements are given in ``VertexLabels`` and ``EdgeLabels``, respectively.

* ``Annotation`` can be used to associate annotations with vertices and edges:

|                              |                                                          |
| ---------------------------- | -------------------------------------------------------- |
| Annotation[v, name -> value] | associate the annotation name -> value with the vertex v |
| Annotation[e, name -> value] | associate the annotation name -> value with the edge e   |

* The ``data`` can be any of the following:

|         |                                |
| ------- | ------------------------------ |
| [image] | an Entity of type "Graph"      |
| [image] | arbitrary Graph object         |
| [image] | a Molecule object              |
| [image] | a Tree expression              |
| [image] | a DiscreteMarkovProcess object |

* The following standard properties are supported for vertices:

|                      |                                         |
| -------------------- | --------------------------------------- |
| VertexLabels         | labels and label placement for vertices |
| VertexCoordinates    | center coordinates for vertices         |
| VertexShape          | graphic shape used for vertices         |
| VertexSize           | size used for vertices                  |
| VertexStyle          | style used for vertices                 |
| VertexShapeFunction  | shape-rendering function for vertex     |
| VertexWeight         | weights for vertices                    |

* The following standard properties are supported for edges:

|                   |                                      |
| ----------------- | ------------------------------------ |
| EdgeLabels        | labels and label placement for edges |
| EdgeStyle         | style used for edges                 |
| EdgeShapeFunction | shape-rendering function for edge    |
| EdgeWeight        | weights for edges                    |

* ``Graph`` has the same options as ``Graphics``, with the following additions and changes:  []

|                     |             |                                           |
| ------------------- | ----------- | ----------------------------------------- |
| AnnotationRules     | {}          | annotations for graph, edges and vertices |
| 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                         |
| GraphHighlight      | {}          | graph elements to highlight               |
| GraphHighlightStyle | Automatic   | style for highlight                       |
| GraphLayout         | Automatic   | how to lay out vertices and edges         |
| PerformanceGoal     | Automatic   | aspects of performance to try to optimize |
| PlotTheme           | \$PlotTheme | overall theme for the graph               |
| 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                      |

* Possible settings for ``PlotTheme`` include common base themes, color feature themes, font features themes, and size features themes.

* Graph feature themes affect the plots of vertices and edges. Feature themes include:

|         |                  |                     |
| ------- | ---------------- | ------------------- |
| [image] | "LargeGraph"     | large graph         |
| [image] | "ClassicLabeled" | classic graph       |
| [image] | "IndexLabeled"   | index labeled graph |
| [image] | "NameLabeled"    | name labeled graph  |

* ``AnnotationRules -> {a -> {name1 -> val1, …}, …}`` associates the property ``name1 -> val1`` etc. with ``a`` that can be a vertex, edge, or the graph itself. The following strings for ``a`` have special meanings:

|                           |                                 |
| ------------------------- | ------------------------------- |
| "DefaultEdgeProperties"   | default edge properties         |
| "DefaultVertexProperties" | default vertex properties       |
| "GraphProperties"         | properties for the graph itself |

* With the setting ``VertexCoordinates -> Automatic``, the placement of vertices and routing of edges is computed automatically, based on the setting for ``GraphLayout``.

* Style and other specifications for edges are effectively applied in the order ``PlotTheme``, ``EdgeStyle``, ``GraphHighlightStyle``, ``Style`` and other wrappers, and ``EdgeShapeFunction``, with later specifications overriding earlier ones.

* Style and other specifications for vertices are effectively applied in the order ``PlotTheme``, ``VertexStyle``, ``GraphHighlightStyle``, ``Style`` and other wrappers, and ``VertexShapeFunction``, with later specifications overriding earlier ones.

* Label style and other specifications for edge labels are effectively applied in the order ``PlotTheme``, ``EdgeLabelStyle``, ``GraphHighlightStyle``, ``Labeled``, and ``EdgeLabels``, with later specifications overriding earlier ones.

* Label style and other specifications for vertex labels are effectively applied in the order ``PlotTheme``, ``VertexLabelStyle``, ``GraphHighlightStyle``, ``Labeled``, and ``VertexLabels``, with later specifications overriding earlier ones.

### 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 (126)

### Basic Examples (5)

An undirected graph:

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

Out[1]= [image]
```

---

A directed graph:

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

Out[1]= [image]
```

---

Style vertices and edges:

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

Out[1]= [image]
```

Use wrappers to input directly:

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

Out[2]= [image]
```

---

Label vertices and edges:

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

Out[1]= [image]
```

---

Use different vertices and edges:

```wl
In[1]:= Graph[{1\[DirectedEdge]2, 2\[DirectedEdge]3, 3\[DirectedEdge]1}, VertexShapeFunction -> "Diamond", VertexSize -> Medium]

Out[1]= [image]

In[2]:= Graph[{1\[DirectedEdge]2, 2\[DirectedEdge]3, 3\[DirectedEdge]1}, EdgeShapeFunction -> "CarvedArcArrow"]

Out[2]= [image]
```

### Scope (27)

#### Connectivity (8)

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

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

Out[1]= [image]
```

---

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

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

Out[1]= [image]
```

---

Create a directed graph from a list of rules:

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

Out[1]= [image]
```

Create an undirected graph from a list of rules:

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

Out[2]= [image]
```

---

Specify a graph with isolated vertices by giving an explicit list of vertices:

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

Out[1]= [image]
```

---

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

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

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, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, {2\[UndirectedEdge]3, 1\[UndirectedEdge]2, 3\[UndirectedEdge]1}}
```

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}, {2, 3, 1}}
```

---

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

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

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

The input vertex list controls the resulting vertex order:

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

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

---

Create undirected or directed graphs with self-loops:

```wl
In[1]:= {Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]2}], Graph[{1\[DirectedEdge]2, 2\[DirectedEdge]2}]}

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

---

Any expression can be used as vertices:

```wl
In[1]:=
{Graph[{a\[UndirectedEdge]b, b\[UndirectedEdge]c, c\[UndirectedEdge]a}], Graph[{"foo"\[UndirectedEdge]"bar", "bar"\[UndirectedEdge]"gnu", "gnu"\[UndirectedEdge]"foo"}], 
	Graph[{[image]\[UndirectedEdge][image], [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]:= {Graph[{Style[1, Red], 2, 3}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}], Graph[{1, 2, 3}, {Style[1\[UndirectedEdge]2, Red], 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}]}

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

---

Wrappers can be nested:

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

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

---

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

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

Out[1]= [image]
```

Any object can be used in the tooltip:

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

Out[2]= [image]
```

---

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

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

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

---

Use ``PopupWindow`` to provide information drilldown:

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

Out[1]= [image]
```

#### Styling (8)

Set the style for all vertices or edges:

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

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

---

Style individual vertices or edges using options:

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

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

Use wrappers for individual styling:

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

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

---

Adjust the size of vertices using symbolic sizes:

```wl
In[1]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexShapeFunction -> s, VertexSize -> 0.2, PlotLabel -> Style[s, 9]], {s, ResourceData["VertexShapeFunction", "Rounded"]}]

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

Concave shapes:

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

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

---

Draw individual vertices:

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

Out[1]= [image]
```

Combine with a default vertex function:

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

Out[2]= [image]
```

---

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

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

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

---

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

```wl
In[1]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[DirectedEdge]2, 2\[DirectedEdge]3, 3\[DirectedEdge]1}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> Style[ef, 9]], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]

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

Line arrows:

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

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

Open arrows:

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

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

---

Specify an edge function for an individual edge:

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

Out[1]= [image]
```

Combine with a different default edge function:

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

Out[2]= [image]
```

#### Labeling (6)

Label any edge or vertex:

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

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

---

Use any expression as a label:

```wl
In[1]:= Table[Graph[{1, 2, Labeled[3, l]}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, ImagePadding -> 25], {l, {Sin[x], [image], [image]}}]

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

In[2]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, Labeled[3\[UndirectedEdge]1, 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[Graph[{1, 2, Labeled[3, Placed["■■", p]]}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, PlotLabel -> p, VertexSize -> Large, VertexShapeFunction -> "Square"], {p, {Left, Right, Bottom, Top}}]

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

Symbolic outside positions:

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

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

Coordinate-based positions:

```wl
In[3]:= Table[Graph[{1, 2, Labeled[3, Placed["■", p]]}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.25, VertexShapeFunction -> "Square", PlotLabel -> p, BaselinePosition -> Axis], {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]:= Graph[{1, 2, Labeled[3, Placed[{"lbl1", "lbl2"}, {Above, Below}]]}, {1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}]

Out[1]= [image]
```

Any number of labels can be used:

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

Out[2]= [image]
```

Place multiple labels using ``VertexLabels``:

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

Out[3]= [image]
```

---

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

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

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

Use explicit coordinates to place labels:

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

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

---

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

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

Out[1]= [image]
```

Any number of labels can be used:

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

Out[2]= [image]
```

Place multiple labels using ``EdgeLabels``:

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

Out[3]= [image]
```

### Options (85)

#### AnnotationRules (2)

Specify an annotation for vertices:

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

Out[1]= [image]
```

---

Edges:

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

Out[1]= [image]
```

#### DirectedEdges (2)

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

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

Out[1]= [image]
```

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

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

Out[2]= [image]
```

---

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

```wl
In[1]:= {Graph[{1\[DirectedEdge]2, 2\[DirectedEdge]3, 3\[DirectedEdge]1}], Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}]}

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

#### EdgeLabels (7)

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

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

Out[1]= [image]
```

---

Label all edges individually:

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

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

Out[2]= [image]
```

---

Use any expression as a label:

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

Out[1]= [image]
```

---

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

```wl
In[1]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, EdgeLabels -> {1\[UndirectedEdge]2 -> Placed["■■■", p]}, PlotLabel -> p, BaselinePosition -> Axis], {p, {0, 1 / 3, 1 / 4}}]

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

Vary positions within the label:

```wl
In[2]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, EdgeLabels -> {1\[UndirectedEdge]3 -> Placed["■■■", {1 / 2, p}]}, PlotLabel -> p, BaselinePosition -> Axis], {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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, Labeled[3\[UndirectedEdge]1, Placed[{"lbl1", "lbl2"}, {"Start", "End"}]]}]

Out[1]= [image]
```

Any number of labels can be used:

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

Out[2]= [image]
```

Place multiple labels using ``EdgeLabels``:

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

Out[3]= [image]
```

---

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

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

Out[1]= [image]

In[2]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, EdgeShapeFunction -> "Line"]

Out[1]= [image]
```

Lines with different glyphs on the edges:

```wl
In[2]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[DirectedEdge]2, 2\[DirectedEdge]3, 3\[DirectedEdge]1}, EdgeShapeFunction -> {{ef, "ArrowSize" -> 0.1}}, PlotLabel -> Style[ef, 10]], {ef, ResourceData["EdgeShapeFunction", "FilledArrow"]}]

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

Line arrows:

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

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

Open arrows:

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

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

---

Specify an edge function for an individual edge:

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

Out[1]= [image]
```

Combine with a different default edge function:

```wl
In[2]:= Graph[{1\[DirectedEdge]2, 2\[DirectedEdge]3, 3\[DirectedEdge]1}, EdgeShapeFunction -> {1\[DirectedEdge]2 -> "FilledArrow", "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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, EdgeShapeFunction -> ef]

Out[2]= [image]
```

---

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

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

Out[1]= [image]
```

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

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

Out[2]= [image]
```

#### EdgeStyle (4)

Style all edges:

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

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

---

Style individual edges:

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

Out[1]= [image]
```

---

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

```wl
In[1]:= ef1[el_, ___] := Arrow[el, 0.1]

In[2]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, EdgeStyle -> Blue, EdgeShapeFunction -> ef1]

Out[2]= [image]
```

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

```wl
In[3]:= ef2[el_, ___] := {Red, Arrow[el, 0.1]}

In[4]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, EdgeStyle -> Blue, EdgeShapeFunction -> ef2]

Out[4]= [image]
```

---

``EdgeStyle`` can be combined with ``BaseStyle``:

```wl
In[1]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, BaseStyle -> Red, EdgeStyle -> Dashed]

Out[1]= [image]
```

``EdgeStyle`` has higher priority than ``BaseStyle``:

```wl
In[2]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, BaseStyle -> Red, EdgeStyle -> Blue]

Out[2]= [image]
```

#### EdgeWeight (2)

Specify a weight for all edges:

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

Out[1]= [image]

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

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

---

Use any numeric expression as a weight:

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

Out[1]= [image]

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

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

#### GraphHighlight (3)

Highlight the vertex ``1`` :

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

Out[1]= [image]
```

---

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

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

Out[1]= [image]
```

---

Highlight vertices and edges:

```wl
In[1]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> Tiny, GraphHighlight -> {1, 2, 1\[UndirectedEdge]3, 2\[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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, GraphHighlight -> {1, 2\[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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, GraphLayout -> Automatic]

Out[1]= [image]
```

---

Specify layouts on special curves:

```wl
In[1]:= Table[Graph[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@GridGraph[{10, 10}];

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

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

---

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

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

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

---

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

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

Out[1]= [image]

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

Out[2]= {VertexCoordinates -> {{-0.866025, -0.5}, {0.866025, -0.5}, {1.8369701987210297`*^-16, 1.}}}
```

#### PlotTheme (4)

##### Base Themes (2)

Use a common base theme:

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

Out[1]= [image]
```

---

Use a monochrome theme:

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

Out[1]= [image]
```

##### Feature Themes (2)

Use a large graph theme:

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

Out[1]= [image]
```

---

Use a classic diagram theme:

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

Out[1]= [image]
```

#### VertexCoordinates (3)

By default, any vertex coordinates are computed automatically:

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

Out[1]= [image]
```

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

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

Out[2]= {VertexCoordinates -> {{-0.866025, -0.5}, {0.866025, -0.5}, {1.8369701987210297`*^-16, 1.}}}
```

---

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]:= Graph[Table[i\[UndirectedEdge]Mod[i + 1, 20, 1], {i, 20}], VertexCoordinates -> ellipseLayout[20, {2, 1}]]

Out[3]= [image]
```

---

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

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

Out[1]= [image]
```

#### VertexLabels (14)

Use vertex names as labels:

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

Out[1]= [image]
```

---

Label individual vertices:

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

Out[1]= [image]
```

---

Label all vertices:

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

Out[1]= [image]
```

---

Use any expression as a label:

```wl
In[1]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■", p], {i, 3}], 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.1, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed["■", p], {i, 3}], PlotLabel -> p], {p, pl}]

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

---

Symbolic inside positions:

```wl
In[1]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.25, VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.25, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p], {p, pl}]

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

---

Use explicit coordinates to place the center of labels:

```wl
In[1]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.25, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], p], {i, 3}], PlotLabel -> p, BaselinePosition -> Axis], {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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.35, VertexShapeFunction -> "Square", VertexLabels -> Table[i -> Placed[[image], {{1, 1}, p}], {i, 3}], PlotLabel -> p, BaselinePosition -> Axis], {p, {{0, 0}, {1 / 2, 1 / 2}, {1, 1}}}]

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

---

Place all labels at the center of vertices:

```wl
In[1]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.35, VertexLabels -> Placed[[image], Center], VertexShapeFunction -> "Square"]

Out[1]= [image]
```

---

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

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

Out[1]= [image]
```

Any number of labels can be used:

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

Out[2]= [image]
```

Place multiple labels using ``VertexLabels``:

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

Out[3]= [image]
```

---

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

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

Out[1]= [image]
```

Or ``StatusArea``:

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

Out[2]= [image]
```

---

Use more elaborate formatting functions:

```wl
In[1]:= rotateLabel[lbl_] := Rotate[lbl, 45Degree]

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

Out[2]= [image]

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

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

Out[4]= [image]

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

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

Out[6]= [image]
```

#### VertexShape (5)

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

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

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

---

Specify vertex shapes for individual vertices:

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

Out[1]= [image]
```

---

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

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

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

---

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

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

Out[1]= [image]
```

---

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

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

Out[1]= [image]
```

#### VertexShapeFunction (11)

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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> Style[vf, 9]], {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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexShapeFunction -> vf, VertexSize -> 0.2, PlotLabel -> vf], {vf, ResourceData["VertexShapeFunction", "Concave"]}]

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

---

Draw individual vertices:

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

Out[1]= [image]
```

Combine with a default vertex function:

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

Out[2]= [image]
```

---

Draw vertices using a predefined graphic:

```wl
In[1]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf1]

Out[2]= [image]
```

---

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

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

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

Out[2]= [image]
```

---

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

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

Out[1]= [image]
```

---

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

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

Out[1]= [image]
```

#### VertexSize (8)

By default, the size of vertices is computed automatically:

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

Out[1]= [image]
```

---

Specify the size of all vertices using symbolic vertex size:

```wl
In[1]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> s, PlotLabel -> s], {s, {{0.1, 0.2}, {0.2, 0.1}}}]

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

---

Specify the size for individual vertices:

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

Out[1]= [image]
```

---

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

```wl
In[1]:= Table[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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[Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexStyle -> style, VertexSize -> 0.2], {style, {Yellow, EdgeForm[Dashed]}}]

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

---

Style individual vertices:

```wl
In[1]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, 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]:= Graph[{1\[UndirectedEdge]2, 2\[UndirectedEdge]3, 3\[UndirectedEdge]1}, VertexSize -> 0.2, VertexStyle -> Blue, VertexShapeFunction -> vf2]

Out[4]= [image]
```

---

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

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

Out[1]= [image]
```

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

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

Out[2]= [image]
```

---

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

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

Out[1]= [image]
```

#### VertexWeight (2)

Set the weight for all vertices:

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

Out[1]= [image]

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

Out[2]= 2
```

---

Use any numeric expression as a weight:

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

Out[1]= [image]

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

Out[2]= a
```

### Applications (4)

Build a graph of a finite mapping:

```wl
In[1]:= Graph[Table[i -> Mod[i^2, 74], {i, 100}]]

Out[1]= [image]
```

---

Draw the graph of a random permutation:

```wl
In[1]:= Graph[Thread[Range[20] -> RandomSample[Range[20]]]]

Out[1]= [image]
```

---

Use ``Table`` to set similar annotations for many items:

```wl
In[1]:= Graph[Table[Annotation[v, {VertexSize -> 0.2 + 0.2Mod[v, 5], VertexStyle -> Hue[(v/15), 1, 1]}], {v, 0, 14}], Table[v\[UndirectedEdge]Mod[v + 1, 15], {v, 0, 14}]]

Out[1]= [image]
```

---

Generate a network of "nearby" words in a dictionary:

```wl
In[1]:= words = DictionaryLookup["wol*"];

In[2]:= Flatten[Map[(Thread[#\[DirectedEdge]DeleteCases[Nearest[words, #, 3], #]])&, words]];

In[3]:= Graph[%, VertexLabels -> "Name", ImageSize -> 450]

Out[3]= [image]
```

### Properties & Relations (3)

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

```wl
In[1]:= g = Graph[Table[i\[UndirectedEdge]Mod[i + 1, 2], {i, 20}]]

Out[1]= [image]

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

Out[2]= {21, 20}
```

---

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

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

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

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

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

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

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

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

In[5]:= g2 = Graph[{3\[UndirectedEdge]1, 2\[UndirectedEdge]3, 1\[UndirectedEdge]2}];

In[6]:= {VertexList[g2], EdgeList[g2]}

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

---

Compute the ``AdjacencyMatrix`` from a graph:

```wl
In[1]:= g = Graph[{a\[DirectedEdge]b, b\[DirectedEdge]c, c\[DirectedEdge]a}];

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

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

The row-column ordering is given by ``VertexList``:

```wl
In[3]:= VertexList[g]

Out[3]= {a, b, c}

In[4]:= Position[m, 1, {2}]

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

### Possible Issues (2)

``Graph`` objects are atomic raw objects:

```wl
In[1]:= g = Graph[{1 -> 2, 2 -> 3, 3 -> 1}];

In[2]:= AtomQ[g]

Out[2]= True
```

Use ``GraphQ`` to test whether it is a graph:

```wl
In[3]:= MatchQ[g, _ ? GraphQ]

Out[3]= True
```

---

Parallel edges are undistinguishable in ``Graph``:

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

Out[1]= [image]
```

Use ``EdgeTaggedGraph`` to assign a unique tag to each edge:

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

Out[2]= [image]

In[3]:= EdgeList[%]

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

## See Also

* [`TreeGraph`](https://reference.wolfram.com/language/ref/TreeGraph.en.md)
* [`PathGraph`](https://reference.wolfram.com/language/ref/PathGraph.en.md)
* [`AdjacencyGraph`](https://reference.wolfram.com/language/ref/AdjacencyGraph.en.md)
* [`IncidenceGraph`](https://reference.wolfram.com/language/ref/IncidenceGraph.en.md)
* [`GraphData`](https://reference.wolfram.com/language/ref/GraphData.en.md)
* [`Graph3D`](https://reference.wolfram.com/language/ref/Graph3D.en.md)
* [`Graph`](https://reference.wolfram.com/language/ref/entity/Graph.en.md)
* [`Graph`](https://reference.wolfram.com/language/ref/interpreter/Graph.en.md)
* [`ComputedGraph`](https://reference.wolfram.com/language/ref/interpreter/ComputedGraph.en.md)
* [`Graphlet`](https://reference.wolfram.com/language/ref/format/Graphlet.en.md)
* [`DOT`](https://reference.wolfram.com/language/ref/format/DOT.en.md)
* [`GraphML`](https://reference.wolfram.com/language/ref/format/GraphML.en.md)

## Related Guides

* [Graph Construction & Representation](https://reference.wolfram.com/language/guide/GraphConstructionAndRepresentation.en.md)
* [Graph Visualization](https://reference.wolfram.com/language/guide/GraphVisualization.en.md)
* [Graphs & Networks](https://reference.wolfram.com/language/guide/GraphsAndNetworks.en.md)
* [Discrete Mathematics](https://reference.wolfram.com/language/guide/DiscreteMathematics.en.md)
* [Social Network Analysis](https://reference.wolfram.com/language/guide/SocialNetworks.en.md)
* [Graph Layouts](https://reference.wolfram.com/language/guide/GraphLayouts.en.md)
* [WDF (Wolfram Data Framework)](https://reference.wolfram.com/language/guide/WDFWolframDataFramework.en.md)
* [Life Sciences & Medicine: Data & Computation](https://reference.wolfram.com/language/guide/LifeSciencesAndMedicineDataAndComputation.en.md)
* [Scientific Models](https://reference.wolfram.com/language/guide/ScientificModels.en.md)
* [Molecular Structure & Computation](https://reference.wolfram.com/language/guide/MolecularStructureAndComputation.en.md)
* [Scientific Data Analysis](https://reference.wolfram.com/language/guide/ScientificDataAnalysis.en.md)
* [Database Connectivity](https://reference.wolfram.com/language/guide/DatabaseConnectivity.en.md)
* [Wolfram Data Repository](https://reference.wolfram.com/language/guide/WolframDataRepository.en.md)

## Related Links

* [An Elementary Introduction to the Wolfram Language: Graphs and Networks](https://www.wolfram.com/language/elementary-introduction/21-graphs-and-networks.html)

## History

* [Introduced in 2010 (8.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn80.en.md) \| [Updated in 2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md) ▪ [2016 (10.4)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn104.en.md) ▪ [2017 (11.2)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn112.en.md) ▪ [2021 (13.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn130.en.md) ▪ [2022 (13.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn131.en.md)