Teori Graf

Titik, sisi, ketetanggaan, jalur, siklus, dan bilangan kromatik.

Graph theory symbols in LaTeX: vertices, edges, degree and coloring

Graph theory notation in LaTeX is mostly standard letters and built-in operators. A graph is G = (V, E), adjacency is u \sim v, the degree of a vertex is \deg(v) (the \deg operator is built in), and complete and complete bipartite graphs are K_n and K_{m,n}. Graph invariants use Greek letters: chromatic number \chi(G), clique number \omega(G), independence number \alpha(G), and maximum and minimum degree \Delta(G) and \delta(G). To draw the graph itself, use TikZ. The table lists the graph theory symbols people use most; all are built in, and the full list follows below.

Quick reference: the most used graph theory symbols

SymbolCommandUsePackageCopy
G=(V,E)G = (V, E)
G = (V, E)Graph with vertex set V and edge set Ebuilt in
u∼vu \sim v
u \sim vu is adjacent to vbuilt in
deg⁡(v)\deg(v)
\deg(v)Degree of a vertexbuilt in
deg⁡+(v)\deg^{+}(v)
\deg^{+}(v)Out-degree (\deg^{-} for in-degree)built in
N(v)N(v)
N(v)Neighbourhood of vbuilt in
KnK_n
K_nComplete graphbuilt in
Km,nK_{m,n}
K_{m,n}Complete bipartite graphbuilt in
χ(G)\chi(G)
\chi(G)Chromatic numberbuilt in
ω(G)\omega(G)
\omega(G)Clique numberbuilt in
α(G)\alpha(G)
\alpha(G)Independence numberbuilt in
Δ(G)\Delta(G)
\Delta(G)Maximum degree (\delta(G) for minimum)built in
G≅HG \cong H
G \cong HIsomorphic graphsbuilt in

Drawing a graph with TikZ

Place vertices as nodes and connect them with \draw. The TikZ graphs library and the tkz-graph package offer shorter syntax for larger graphs:

\usepackage{tikz}

\begin{tikzpicture}
  \node[circle,draw] (a) at (0,0) {a};
  \node[circle,draw] (b) at (2,0) {b};
  \node[circle,draw] (c) at (1,1.5) {c};
  \draw (a) -- (b) -- (c) -- (a);
\end{tikzpicture}

Frequently asked questions about graph theory in LaTeX

How do I write the degree of a vertex in LaTeX?
Use the built-in operator \deg, which prints an upright deg with correct spacing: $\deg(v)$. For directed graphs, \deg^{+}(v) and \deg^{-}(v) give out-degree and in-degree, and the handshake lemma reads \sum_{v \in V} \deg(v) = 2|E|.
How do I draw a graph in LaTeX?
Load \usepackage{tikz}, place vertices with \node[circle,draw] (a) at (0,0) {a}; and connect them with \draw (a) -- (b);. For larger graphs, the TikZ graphs library and the tkz-graph package shorten the syntax.
How do I write the chromatic number in LaTeX?
The chromatic number is \chi(G), a Greek chi. The chromatic index (edge chromatic number) is often written \chi'(G), the clique number \omega(G) and the independence number \alpha(G). All are built in.
vv
ee
G=(V,E)G = (V, E)

Graph

G = (V, E)
V(G)V(G)
E(G)E(G)
u∼vu \sim v

Adjacency

u \sim v
deg⁡(v)\deg(v)

Degree

\deg(v)
deg⁡−(v)\deg^{-}(v)

In-Degree

\deg^{-}(v)
deg⁡+(v)\deg^{+}(v)

Out-Degree

\deg^{+}(v)
PnP_n

Path

P_n
CnC_n
KnK_n
Km,nK_{m,n}

Bipartite

K_{m,n}
AijA_{ij}
u↔vu \leftrightarrow v

Connected

u \leftrightarrow v
TT
FF
χ(G)\chi(G)
ω(G)\omega(G)

Clique

\omega(G)
α(G)\alpha(G)
G↪R2G \hookrightarrow \mathbb{R}^2

Planar Graph

G \hookrightarrow \mathbb{R}^2