# Simple graph

> Four vertices and five edges, placed by hand: the smallest useful starting point. A Graphs and networks example with its LaTeX source.

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

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

Tags: graph, vertices, edges

## Source

```latex
\begin{tikzpicture}[vertex/.style={circle, draw, minimum size=7mm}]
  \node[vertex] (a) at (0,0) {$a$};
  \node[vertex] (b) at (2,0) {$b$};
  \node[vertex] (c) at (2,2) {$c$};
  \node[vertex] (d) at (0,2) {$d$};
  \draw (a) -- (b) -- (c) -- (d) -- (a) -- (c);
\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}

\begin{document}
\begin{tikzpicture}[vertex/.style={circle, draw, minimum size=7mm}]
  \node[vertex] (a) at (0,0) {$a$};
  \node[vertex] (b) at (2,0) {$b$};
  \node[vertex] (c) at (2,2) {$c$};
  \node[vertex] (d) at (0,2) {$d$};
  \draw (a) -- (b) -- (c) -- (d) -- (a) -- (c);
\end{tikzpicture}
\end{document}
```
