# Directed graph

> Five vertices on a pentagon with directed edges, a curved pair, and a self-loop. A Graphs and networks example with its LaTeX source.

A Graphs and networks example in the TeXeR TikZ library: https://texer.org/library/graphs/directed-graph

Package: [Graphs and networks](https://texer.org/library/graphs.md), on CTAN at https://ctan.org/pkg/pgf.

Tags: directed graph, digraph, loop

## Source

```latex
\usetikzlibrary{arrows.meta}

\begin{tikzpicture}[
  >={Stealth[length=2.5mm]},
  vertex/.style={circle, draw, thick, minimum size=8mm},
]
  \foreach \i in {1,...,5}
  \node[vertex] (v\i) at ({90 + 72*(\i-1)}:2cm) {$v_{\i}$};
  \path[->, thick]
  (v1) edge (v2)
  (v2) edge (v3)
  (v3) edge (v4)
  (v4) edge (v5)
  (v5) edge (v1)
  (v1) edge (v3)
  (v2) edge[bend left=15] (v5)
  (v5) edge[bend left=15] (v2)
  (v4) edge[loop below] (v4);
\end{tikzpicture}
```

## As a complete document

The same example in a document that compiles on its own with pdfLaTeX:

```latex
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usetikzlibrary{arrows.meta}

\begin{document}

\begin{tikzpicture}[
  >={Stealth[length=2.5mm]},
  vertex/.style={circle, draw, thick, minimum size=8mm},
]
  \foreach \i in {1,...,5}
  \node[vertex] (v\i) at ({90 + 72*(\i-1)}:2cm) {$v_{\i}$};
  \path[->, thick]
  (v1) edge (v2)
  (v2) edge (v3)
  (v3) edge (v4)
  (v4) edge (v5)
  (v5) edge (v1)
  (v1) edge (v3)
  (v2) edge[bend left=15] (v5)
  (v5) edge[bend left=15] (v2)
  (v4) edge[loop below] (v4);
\end{tikzpicture}
\end{document}
```
