Graph Theory
Graph theory studies graphs — collections of objects (vertices) connected pairwise by relations (edges). One-line statement: a graph encodes which pairs of a set are related. Key result in words: deep structure (connectivity, colorability, planarity, matchings, flows) follows from simple combinatorial axioms. Applies in computer science, networks, chemistry, operations research, and discrete optimization. Founded by Leonhard Euler in 1736 with the Königsberg bridges problem; matured in the 19th–20th centuries.A graph is a pair where is a finite set of vertices and is a set of edges, each edge joining two vertices. Graph theory matters because an enormous variety of structures — road networks, molecules, social ties, circuit layouts, scheduling constraints — reduce to vertices-and-edges, so a single theory yields algorithms and theorems usable across disciplines. The field studies invariants (degree, connectivity, chromatic number), structural decompositions (trees, planar embeddings), and optimization (shortest paths, flows, matchings). A surprising fact: whether a graph can be drawn in the plane without edge crossings is characterized by forbidding just two graphs as minors (Kuratowski's Theorem / Wagner's theorem) — an infinite family of constraints collapses to a finite one. Graph theory sits at the boundary of pure combinatorics and applied computer science.
The Core Insight
Almost any system of pairwise relations can be abstracted to a graph, and once abstracted, the same combinatorial tools apply regardless of the original domain. The structure of a graph is governed by local data (vertex degrees, neighborhoods) that constrains global properties (connectivity, cycles, colorability). The art of graph theory is translating a question — "Can we schedule these exams?", "Is this network robust?", "Can this molecule exist?" — into a statement about vertices and edges, then exploiting universal theorems.
Formal Statement
Graph
A (simple, undirected) graph is an ordered pair where:
- is a finite nonempty set of vertices (also nodes),
- is a set of edges, each an unordered pair of distinct vertices.
We write for the order and for the size. Two vertices joined by an edge are adjacent; an edge is incident to its endpoints. Variants:
- A multigraph allows multiple edges between the same pair.
- A graph with loops allows edges .
- A directed graph (digraph) uses ordered pairs (arcs).
- A weighted graph assigns .
Degree
The degree of a vertex is the number of edges incident to it. In a simple graph,
The minimum and maximum degrees are and .
Handshaking Lemma
For any finite graph ,
A corollary: the number of vertices of odd degree is even.
Adjacency Matrix
For , the adjacency matrix is the matrix with
The number of walks of length from to equals the entry of :
Connectivity and Paths
A walk is an alternating sequence of vertices and edges; a path is a walk with no repeated vertex; a cycle is a closed path. is connected if every pair of vertices is joined by a path. A maximal connected subgraph is a connected component. The distance is the length of a shortest – path (or ).
Why It Holds / Derivation
Handshaking Lemma
We prove equation [2].
- Consider the set of incidences .
- Count by vertices. For each vertex , the number of incidences involving is exactly (one per incident edge). Hence .
- Count by edges. Each edge has exactly two endpoints, contributing exactly incidences. Hence .
- Equating the two counts: .
Walk-Counting Formula
We prove [5] by induction on .
- Base : counts the walks of length 1 (single edges) from to . True.
- Inductive step: Assume counts walks of length from to . A walk of length from to is a walk of length from to some intermediate vertex , followed by an edge .
- Summing over all valid :
- The right side counts exactly all length- walks, completing the induction.
Leonhard Euler | 1707–1783
Euler launched graph theory in 1736 by solving the Seven Bridges of Königsberg: could a citizen cross each of the city's seven bridges exactly once and return home? Euler abstracted the four landmasses into vertices and the bridges into edges, then showed the walk is impossible because more than two vertices had odd degree. This established the principle — still central — that the answer depends only on the abstract incidence structure, not on geometry. Euler also gave the polyhedral formula , foundational to planar graph theory and topology. His genius was recognizing that a physical puzzle reduces to a counting argument over degrees.
Building Intuition
Think of a graph as a "relationship diagram." Vertices are entities; an edge means "these two are directly linked." Almost every property has a tangible reading:
- Degree = popularity / number of direct connections.
- Connected = you can travel between any two points.
- Path = a route with no backtracking through the same place.
- Cycle = a round trip returning to start.
- Bipartite = the entities split into two camps, with links only between camps (think jobs vs. applicants).
- Tree = a minimally connected network — remove any edge and it falls apart; add any edge and you create a loop.
The handshaking lemma is just "at a party, the total number of handshake-ends is twice the number of handshakes." The adjacency-matrix power trick says "to count -step journeys, multiply the one-step map by itself times" — propagation of reachability through repeated composition.
A simple graph with five vertices, showing degrees and a highlighted cycle
Worked Examples
Verifying the Handshaking Lemma
Given: A graph on with edges . So . Step 1 — compute degrees.- : edges →
- : edges →
- : edges →
- : edges →
- : edges →
Counting walks via matrix powers
Given: A path graph on vertices with adjacency matrixCommon Misconceptions
"A walk, path, trail, and cycle are the same thing." They are not:- Walk: vertices/edges may repeat.
- Trail: no repeated edge (vertices may repeat).
- Path: no repeated vertex (hence no repeated edge).
- Cycle/Circuit: closed; a cycle additionally has no repeated internal vertex.
Confusing these breaks theorems: an Eulerian trail uses every edge once; a Hamiltonian path uses every vertex once. These are vastly different in difficulty — Eulerian existence is decided instantly by degree parity, while Hamiltonicity is NP-complete.
Degree sequence does not determine the graph
Two graphs can have identical degree sequences yet not be isomorphic. Consider degree sequence on six vertices:
- Graph A: a single 6-cycle .
- Graph B: two disjoint triangles .
Both have every vertex of degree 2 and satisfy [2] (, ). But is connected while is not — they are not isomorphic. Hence the degree sequence is a necessary but not sufficient invariant for graph identity.
Connections
Graph theory connects to many areas:
- Linear Algebra: the adjacency and Laplacian Matrix turn graph questions into eigenvalue problems (spectral graph theory); eigenvalues bound connectivity, expansion, and colorability.
- Topology: planar graphs and the Euler characteristic link to surfaces and embeddings; graph minors relate to topological structure.
- Combinatorics: enumeration (counting trees via Cayley's Formula), extremal results (Turán-type theorems), and Ramsey theory all live here.
- Probability Theory: random graphs exhibit sharp threshold phenomena and underlie network science.
- Computational Complexity: many canonical NP-complete problems (Hamiltonian cycle, graph coloring, clique) are graph problems; others (shortest path, max flow) are polynomial.
- Group Theory: the automorphism group of a graph and Cayley graphs bridge algebra and combinatorics.
Real-World Applications
- Internet routing (OSPF, BGP): networks modeled as weighted graphs; Dijkstra's and Bellman–Ford algorithms compute shortest paths for packet delivery.
- Google's PageRank: the web is a directed graph; importance is the dominant eigenvector of a stochastic adjacency-derived matrix — spectral graph theory in production.
- Compiler register allocation: variables are vertices, "alive simultaneously" is an edge; assigning CPU registers without conflict is graph coloring of the interference graph.
- Chemistry (molecular graphs): atoms are vertices, bonds are edges; isomer enumeration, the Wiener index, and QSAR property prediction use graph invariants.
- Project scheduling (PERT/CPM): tasks form a directed acyclic graph; the critical path (longest path) determines minimum project duration.
- Social network analysis: centrality, community detection, and influence spread are graph algorithms on friendship/follower graphs.
- VLSI circuit layout & airline scheduling: planarity testing minimizes wire crossings; bipartite matching assigns crews to flights optimally.
Historical Development
- 1736 — Euler solves the Seven Bridges of Königsberg, founding graph theory and characterizing Eulerian walks via degree parity.
- 1750 — Euler states the polyhedral formula , later central to planar graphs.
- 1847 — Gustav Kirchhoff applies tree-counting to electrical networks (Kirchhoff's matrix-tree theorem).
- 1852 — Francis Guthrie poses the Four Color Problem (can every planar map be colored with four colors?).
- 1857 — Arthur Cayley studies trees while enumerating chemical isomers; later proves labeled trees.
- 1936 — Dénes Kőnig publishes the first textbook on graph theory, consolidating the field.
- 1930 — Kazimierz Kuratowski characterizes planar graphs by forbidden subgraphs and .
- 1956 — Edsger Dijkstra (pub. 1959) and contemporaries develop shortest-path and max-flow (Ford–Fulkerson, 1956) algorithms, launching algorithmic graph theory.
- 1976 — Appel and Haken prove the Four Color Theorem with computer assistance — the first major theorem requiring a computer.
- 1983–2004 — Robertson and Seymour's Graph Minors project proves every minor-closed family is characterized by finitely many forbidden minors.
Subtleties & Limits
Several deep questions remain partly open or computationally hard:
- Graph Isomorphism: is there a polynomial-time algorithm to decide whether two graphs are isomorphic? Babai (2015) gave a quasi-polynomial algorithm, but its exact complexity status (P vs NP-intermediate) is unresolved.
- Hamiltonicity & the Traveling Salesman: deciding whether a Hamiltonian cycle exists is NP-complete; no efficient characterization analogous to Eulerian degree-parity is known.
- Reconstruction Conjecture (Kelly–Ulam, 1942): is every graph on vertices uniquely determined (up to isomorphism) by its multiset of vertex-deleted subgraphs? Still open.
- Chromatic number bounds: while always holds (and Brooks's theorem refines it), computing exactly is NP-hard, and structural conjectures (e.g., Hadwiger's conjecture relating to minors) remain unproven in general.