Introduction

A graph models objects and pairwise connections between them: computers and links, cities and roads, tasks and conflicts, states and transitions. Graph theory supplies the vocabulary (degree, path, cycle, tree, planar) and the counting facts used in connectivity, matching and colouring. Algorithms on graphs (search, shortest paths, spanning trees) build on the same definitions, and the way a graph is stored in memory is covered in Graph Representations.

Prerequisites

  • Sets: a graph is a pair of sets; (n2)\binom{n}{2} counts 2-element subsets.

Core concepts

Definitions and conventions

A graph G=(V,E)G = (V, E) has a set VV of vertices and a set EE of edges; each edge joins two vertices, its endpoints. We write n=∣V∣n = |V| and m=∣E∣m = |E|.

Graph conventions used in these notes.

  • Unless stated otherwise, "graph" means a simple undirected graph: no loops (edge from a vertex to itself) and no multiple edges between the same pair. Then an edge is a 2-element subset {u,v}\{u, v\} and m≤(n2)m \le \binom{n}{2}.
  • A multigraph allows multiple edges; a pseudograph also allows loops. A directed graph (digraph) has ordered pairs (u,v)(u, v) as arcs.
  • Degree deg⁡(v)\deg(v) is the number of edge ends at vv. A loop counts twice toward the degree of its vertex, so the handshake lemma below holds for pseudographs too.
  • In a digraph, deg⁡−(v)\deg^{-}(v) (in-degree) and deg⁡+(v)\deg^{+}(v) (out-degree) count arcs entering and leaving vv.

Further terms: uu and vv are adjacent if {u,v}∈E\{u, v\} \in E; the edge is incident to both. δ(G)\delta(G) and Δ(G)\Delta(G) denote the minimum and maximum degree. A vertex of degree 0 is isolated; of degree 1, a leaf (pendant vertex). A graph is kk-regular if every vertex has degree kk.

The handshake lemma

∑v∈Vdeg⁡(v)=2m.\sum_{v \in V} \deg(v) = 2m .

Each edge contributes exactly 2 to the sum (one to each end, or 2 to one vertex if it is a loop). Consequences:

  • The number of odd-degree vertices is even.
  • A kk-regular graph on nn vertices has m=kn/2m = kn/2 edges, so knkn must be even (no 3-regular graph on 7 vertices exists).
  • For a digraph, ∑deg⁡−(v)=∑deg⁡+(v)=m\sum \deg^{-}(v) = \sum \deg^{+}(v) = m.
  • Average degree is 2m/n2m/n, so δ≤2m/n≤Δ\delta \le 2m/n \le \Delta.

Degree sequences

The degree sequence lists degrees in non-increasing order. A sequence is graphic if some simple graph realises it. Necessary conditions: even sum, every entry at most n−1n - 1. They are not sufficient: (3,3,1,1)(3, 3, 1, 1) has even sum and entries at most 3 but is not graphic (two vertices of degree 3 must each be adjacent to all three others, forcing the last two vertices to degree at least 2).

Havel-Hakimi test: a non-increasing sequence d1,d2,…,dnd_1, d_2, \ldots, d_n with d1≥1d_1 \ge 1 is graphic if and only if the sequence obtained by deleting d1d_1 and subtracting 1 from each of the next d1d_1 entries is graphic. Repeat until all entries are 0 (graphic) or some entry becomes negative or the first entry exceeds the number of remaining entries (not graphic).

Example: (3,3,2,2,2)→(2,1,1,2)=(2,2,1,1)→(1,0,1)=(1,1,0)→(0,0)(3, 3, 2, 2, 2) \to (2, 1, 1, 2) = (2, 2, 1, 1) \to (1, 0, 1) = (1, 1, 0) \to (0, 0): graphic.

Special graphs

GraphDescriptionnnmmDegrees
Complete graph KnK_nevery pair adjacentnnn(n−1)/2n(n-1)/2all n−1n - 1
Cycle CnC_n, n≥3n \ge 3one cycle through all verticesnnnnall 2
Path PnP_nnn vertices in a linennn−1n - 1for n≥2n\ge2: two of degree 1, rest 2; P1P_1: one vertex of degree 0
Wheel WnW_n, n≥3n \ge 3CnC_n plus a hub joined to alln+1n + 12n2nhub nn, rim 3
Complete bipartite Kr,sK_{r,s}parts of size r,sr, s, all cross edgesr+sr + srsrsss in one part, rr in the other
Hypercube QkQ_kbit strings of length kk, adjacent if they differ in one bit2k2^kk2k−1k 2^{k-1}all kk
Star K1,sK_{1,s}one centre joined to ss leavess+1s + 1sscentre ss, leaves 1

Index conventions vary: some books write WnW_n for the wheel with nn vertices in total. The notation used is WnW_n = hub + CnC_n (as in Rosen).

Special graphs: complete, bipartite, cycle, wheel and the cube Q₃
Figure 1. K5K_5, K3,3K_{3,3}, C6C_6, W5W_5 and Q3Q_3, each labelled with its numbers of vertices and edges.

Bipartite graphs

GG is bipartite if VV splits into two sets X,YX, Y such that every edge has one end in each. Theorem: a graph is bipartite if and only if it has no cycle of odd length. A breadth-first search that 2-colours vertices by level parity tests this in O(n+m)O(n + m) time. A bipartite graph on nn vertices has at most ⌊n2/4⌋\lfloor n^2/4 \rfloor edges (attained by K⌊n/2⌋,⌈n/2⌉K_{\lfloor n/2 \rfloor, \lceil n/2 \rceil}).

Subgraphs, complements, isomorphism

  • HH is a subgraph of GG if V(H)⊆V(G)V(H) \subseteq V(G) and E(H)⊆E(G)E(H) \subseteq E(G). It is induced if it contains every edge of GG between its vertices; spanning if V(H)=V(G)V(H) = V(G).
  • The complement G‾\overline{G} has the same vertices and exactly the edges missing from GG: m(G)+m(G‾)=(n2)m(G) + m(\overline{G}) = \binom{n}{2}. A self-complementary graph is isomorphic to its complement, which forces (n2)\binom{n}{2} even, so n≡0n \equiv 0 or 1(mod4)1 \pmod 4.
  • GG and HH are isomorphic if a bijection f:V(G)→V(H)f : V(G) \to V(H) preserves adjacency in both directions. Invariants (equal in isomorphic graphs): nn, mm, degree sequence, number of cycles of each length, connectedness, bipartiteness. Matching invariants do not prove isomorphism; one differing invariant disproves it.
  • The number of labelled simple graphs on a fixed set of nn vertices is 2(n2)2^{\binom{n}{2}}; the number with exactly mm edges is ((n2)m)\binom{\binom{n}{2}}{m}.

Walks, paths, cycles

  • A walk is a sequence of vertices with consecutive ones adjacent; its length is the number of edges.
  • A trail repeats no edge; a path repeats no vertex. A cycle is a closed path of length at least 3.
  • The number of walks of length kk from uu to vv is the (u,v)(u, v) entry of AkA^k, where AA is the adjacency matrix.
  • If every vertex has degree at least 2, the graph contains a cycle. A connected graph with nn vertices and no cycle is a tree and has exactly n−1n - 1 edges; a forest with cc components has n−cn - c edges. Trees are developed in Trees and Binary Trees.

Euler and Hamiltonian graphs

  • An Euler circuit traverses every edge exactly once and returns to its start; an Euler path (trail) traverses every edge exactly once.
  • Euler's theorem. A connected (multi)graph, ignoring isolated vertices, has an Euler circuit if and only if every vertex has even degree, and an Euler path but no Euler circuit if and only if exactly two vertices have odd degree (the path starts at one and ends at the other).
  • A Hamiltonian cycle visits every vertex exactly once and returns; a Hamiltonian path visits every vertex exactly once. No simple necessary-and-sufficient condition is known, and deciding it is NP-complete.
  • Sufficient conditions (simple graph, n≥3n \ge 3): Dirac: δ(G)≥n/2\delta(G) \ge n/2. Ore: deg⁡(u)+deg⁡(v)≥n\deg(u) + \deg(v) \ge n for every pair of non-adjacent u,vu, v. These are not necessary: CnC_n is Hamiltonian with all degrees 2.
  • Necessary condition: for every nonempty S⊆VS\subseteq V in a Hamiltonian graph, c(G−S)≤∣S∣c(G-S)\le|S|. A bipartite graph with unequal part sizes has no Hamiltonian cycle.
Euler versus Hamiltonian examples
Figure 2. Left: a graph with exactly two odd-degree vertices and an Euler path between them. Right: the Petersen graph, which is 3-regular but has no Hamiltonian cycle.

Planar graphs

A graph is planar if it can be drawn in the plane with no crossing edges. A planar drawing divides the plane into faces (regions), including the unbounded outer face.

  • Euler's formula: for a connected planar graph, n−m+f=2n - m + f = 2; with cc components, n−m+f=1+cn - m + f = 1 + c.
  • For a simple connected planar graph with n≥3n \ge 3: m≤3n−6m \le 3n - 6. If it also has no triangle (for example, if it is bipartite): m≤2n−4m \le 2n - 4.
  • Consequences: K5K_5 (m=10>9m = 10 > 9) and K3,3K_{3,3} (m=9>8m = 9 > 8) are non-planar. Every simple planar graph has a vertex of degree at most 5.
  • Kuratowski's theorem: a graph is planar if and only if it has no subgraph that is a subdivision of K5K_5 or K3,3K_{3,3}.
  • The bounds m≤3n−6m \le 3n - 6 and m≤2n−4m \le 2n - 4 are necessary, not sufficient: satisfying them does not prove planarity.

Worked examples

Example 1: handshake

A simple graph has 12 edges, 2 vertices of degree 4, 4 vertices of degree 3, and all others of degree 2. Sum of degrees =24=8+12+2k= 24 = 8 + 12 + 2k, so k=2k = 2 vertices of degree 2 and n=8n = 8.

Example 2: planar faces

A connected planar simple graph has 10 vertices, each of degree 3. Then m=15m = 15 and f=2−n+m=7f = 2 - n + m = 7.

Example 3: Euler paths

The graph of the seven bridges of Konigsberg has four land masses with degrees 5, 3, 3, 3: four odd vertices, so neither an Euler circuit nor an Euler path exists. KnK_n has an Euler circuit if and only if nn is odd (all degrees n−1n - 1 even). Kr,sK_{r,s} has an Euler circuit if and only if rr and ss are both even.

Example 4: counting graphs

On the vertex set {1,2,3,4}\{1, 2, 3, 4\} there are 26=642^6 = 64 labelled simple graphs, (63)=20\binom{6}{3} = 20 of them with exactly 3 edges. Up to isomorphism there are only 11 simple graphs on 4 vertices.

Important properties and observations

  • In any simple graph with n≥2n \ge 2, two vertices have the same degree (pigeonhole: degrees 0 and n−1n - 1 cannot both occur).
  • GG or G‾\overline{G} is connected (for every GG).
  • QkQ_k is bipartite (split by parity of the number of 1 bits) and Hamiltonian for k≥2k \ge 2 (Gray code).
  • A tree with n≥2n \ge 2 vertices has at least two leaves.
  • KnK_n has n!/(2n)=(n−1)!/2n!/(2n) = (n-1)!/2 distinct Hamiltonian cycles for n≥3n \ge 3.

GATE examination perspective

  • Counting edges and vertices. Handshake lemma, special-graph formulas, Euler's formula for planar graphs.
  • Degree-sequence questions. Check parity, maximum degree, then Havel-Hakimi.
  • Euler and Hamilton. Euler: parity of degrees, an exact characterisation. Hamilton: only sufficient conditions (Dirac, Ore) and necessary obstacles.
  • Planarity. Use m≤3n−6m \le 3n - 6 (or 2n−42n - 4 without triangles) to rule out planarity.
  • Trap: whether loops count once or twice. These notes count a loop twice.
  • Trap: Dirac's and Ore's conditions are sufficient, not necessary.

Summary

Sources

  1. K. H. Rosen, Discrete Mathematics and Its Applications, 7th ed., McGraw-Hill, 2012: Sections 10.1 to 10.5 and 10.7 (graphs and graph models, graph terminology and special types of graphs, representing graphs and graph isomorphism, connectivity, Euler and Hamilton paths, planar graphs).
  2. D. B. West, Introduction to Graph Theory, 2nd ed., Prentice Hall, 2001: Chapter 1 (Fundamental Concepts).

Next steps