8.4 Graph Theory, Networks, Trees & Algorithms
Key Takeaways
- A graph G = (V, E) consists of vertices and edges; the Handshaking Lemma dictates that the sum of all vertex degrees equals twice the total number of edges (∑ deg(v) = 2|E|), proving that every graph must possess an even number of odd-degree vertices.
- An Euler circuit traverses every edge of a graph exactly once and returns to the origin, which exists in a connected graph if and only if every vertex has an even degree; an Euler path exists if and only if exactly two vertices have odd degree.
- A Hamiltonian cycle visits every vertex of a graph exactly once before returning to the start; unlike Eulerian traversability, Hamiltonian cycle determination is an NP-complete problem with no simple degree-parity criterion.
- Planar graphs can be embedded in the Euclidean plane without intersecting edges, satisfying Euler's Formula V - E + F = 2 for connected planar graphs, from which the edge bound E ≤ 3V - 6 proves the non-planarity of K_5 and K_{3,3} via Kuratowski's Theorem.
- A tree is a connected acyclic graph on n vertices possessing exactly n - 1 edges; greedy network optimization algorithms include Kruskal's and Prim's algorithms for Minimum Spanning Trees (MST) and Dijkstra's algorithm for shortest paths with non-negative edge weights.
8.4 Graph Theory, Networks, Trees & Algorithms
Graph theory is the mathematical study of structural connections between discrete objects. Originating in Leonhard Euler's 1736 resolution of the Königsberg bridge problem, modern graph theory underpins telecommunication networks, transport logistics, circuit design, and computer science algorithms. In secondary mathematics instruction (grades 9–12), graph theory provides an intuitive yet analytically rigorous playground for developing topological proofs, recursive structures, algorithmic thinking, and discrete optimization models.
1. Graph Fundamentals, Degree Sequences & The Handshaking Lemma
A graph $G = (V, E)$ is an ordered pair comprising a set of vertices (or nodes) $V$ and a set of edges (or links) $E$, where each edge $e \in E$ connects an unordered pair of vertices ${u, v}$. In a simple graph, loops (edges connecting a vertex to itself) and multiple edges between the same pair of vertices are forbidden.
Vertex Degree and Degree Sequences
The degree of a vertex $v$, denoted $\operatorname{deg}(v)$, is the number of edges incident to $v$ (with self-loops contributing 2). The ordered list of vertex degrees, typically in non-increasing order, forms the degree sequence of the graph.
The Handshaking Lemma (Euler's Degree-Sum Theorem)
The foundational theorem of graph theory links vertex degrees directly to edge cardinality:
[!IMPORTANT] Theorem (The Handshaking Lemma): In any graph $G = (V, E)$:
Proof: Each edge $e = {u, v}$ possesses exactly two endpoints. When calculating the sum of degrees across all vertices, edge $e$ is counted exactly twice: once in $\operatorname{deg}(u)$ and once in $\operatorname{deg}(v)$. Thus, the sum of all degrees equals twice the number of edges.
Fundamental Parity Corollary
An immediate and powerful corollary governs odd-degree vertices:
Corollary: Every graph must contain an even number of vertices of odd degree.
Proof: Partition $V$ into $V_{\text{even}}$ and $V_{\text{odd}}$. Then: The total sum $2|E|$ is even, and the sum over $V_{\text{even}}$ is even. Therefore, the sum $\sum_{v \in V_{\text{odd}}} \operatorname{deg}(v)$ must be even. A sum of odd integers can be even if and only if there is an even number of terms. Hence, $|V_{\text{odd}}|$ is even.
2. Walks, Paths, Circuits & Eulerian vs. Hamiltonian Traversability
Navigating network topology requires precise distinctions among route classifications:
- Walk: An alternating sequence of vertices and edges $v_0, e_1, v_1, e_2, \dots, e_k, v_k$.
- Trail: A walk with no repeated edges.
- Path: A walk with no repeated vertices (and consequently no repeated edges).
- Circuit: A closed trail (starts and ends at the same vertex, $v_0 = v_k$, with no repeated edges).
- Cycle: A closed path (starts and ends at the same vertex, with no other repeated vertices).
Eulerian Graphs (Edge-Focused Traversability)
An Euler trail (or path) visits every edge of a graph exactly once. An Euler circuit is an Euler trail that starts and terminates at the same vertex.
[!IMPORTANT] Euler's Theorem (Eulerian Graphs): Let $G$ be a connected graph (or connected up to isolated vertices):
- $G$ contains an Euler circuit if and only if every vertex has an even degree.
- $G$ contains an Euler trail (open path) if and only if exactly two vertices have odd degree. The trail must begin at one odd vertex and end at the other.
The Seven Bridges of Königsberg (1736): Four landmasses were connected by seven bridges over the Pregel River. The corresponding multigraph had 4 vertices with degrees $3, 3, 3, 5$. Because all 4 vertices had odd degrees (exceeding the allowable 0 or 2), Euler proved that traversing all seven bridges without retracing any bridge was physically impossible.
+-----------------------------------------------------------------------------+
| EULERIAN VS. HAMILTONIAN TRAVERSABILITY |
| |
| Feature Eulerian Routing Hamiltonian Routing |
| ----------------------------------------------------------------------- |
| Traversal Goal Every EDGE exactly once Every VERTEX exactly once
| Algorithmic Check Degree parity check: No necessary/sufficient |
| All even (circuit) or degree parity criteria; |
| exactly two odd (trail) NP-complete problem |
| Computational Time Polynomial O(|E|) (Fleury) Exponential in general |
| Real-World Context Street sweeper, mail carrier, Traveling Salesperson, |
| snowplow route, pipe inspector delivery truck route |
+-----------------------------------------------------------------------------+
Hamiltonian Graphs (Vertex-Focused Traversability)
A Hamiltonian path visits every vertex in $G$ exactly once. A Hamiltonian cycle is a closed cycle visiting every vertex once and returning to the starting vertex.
Computational Contrast: While Eulerian traversability is solvable in polynomial time $O(|E|)$ by inspecting degree parities, determining whether an arbitrary graph contains a Hamiltonian cycle is NP-complete. No simple local degree condition characterizes Hamiltonian graphs. However, classic sufficient theorems exist:
- Dirac's Theorem (1952): If $G$ is a simple graph with $n \ge 3$ vertices, and $\operatorname{deg}(v) \ge n/2$ for every vertex $v$, then $G$ is Hamiltonian.
- Ore's Theorem (1960): If $G$ is a simple graph with $n \ge 3$ vertices, and $\operatorname{deg}(u) + \operatorname{deg}(v) \ge n$ for every pair of non-adjacent vertices $u, v$, then $G$ is Hamiltonian.
3. Planar Graphs & Euler's Polyhedral Formula
A graph $G$ is planar if it can be drawn (embedded) in the Euclidean plane $\mathbb{R}^2$ such that no two edges intersect except at their common incident vertices. A planar drawing divides the plane into contiguous regions called faces ($F$), including the unbounded exterior face.
Euler's Formula for Planar Graphs
[!IMPORTANT] Theorem (Euler's Planar Formula): For any connected planar graph with $V$ vertices, $E$ edges, and $F$ faces:
Planarity Edge Bounds
In any simple planar graph with $V \ge 3$, every face boundary must consist of at least 3 edges. Since each edge borders at most 2 faces, $2E \ge 3F \implies F \le \frac{2}{3}E$. Substituting into Euler's formula: For bipartite planar graphs (which contain no odd cycles, so every face has at least 4 boundary edges, $2E \ge 4F \implies F \le \frac{1}{2}E$):
Proving Non-Planarity of $K_5$ and $K_{3,3}$
- Complete Graph $K_5$: $V = 5, E = \binom{5}{2} = 10$. The planar bound requires $E \le 3(5) - 6 = 9$. Because $10 > 9$, $K_5$ is non-planar.
- Complete Bipartite Graph $K_{3,3}$ (Utility Graph): $V = 6, E = 3 \times 3 = 9$. Since $K_{3,3}$ is bipartite (triangle-free), it requires $E \le 2(6) - 4 = 8$. Because $9 > 8$, $K_{3,3}$ is non-planar.
Kuratowski's Theorem (1930): A graph is planar if and only if it contains no subgraph that is a subdivision of (or homeomorphic to) $K_5$ or $K_{3,3}$.
4. Trees, Spanning Trees & Minimum Spanning Tree (MST) Algorithms
A tree is a connected, acyclic, undirected simple graph. A forest is a disjoint collection of trees.
Equivalent Characterizations of Trees
For a graph $T$ with $n$ vertices, the following statements are mathematically equivalent:
- $T$ is connected and contains no cycles.
- $T$ has no cycles and has exactly $n - 1$ edges.
- $T$ is connected and has exactly $n - 1$ edges.
- There is a unique simple path between any pair of vertices in $T$.
- $T$ is minimally connected (removing any edge disconnects the graph).
- $T$ is maximally acyclic (adding any edge between non-adjacent vertices creates a unique cycle).
Spanning Trees and Minimum Spanning Trees (MST)
A spanning tree of a connected graph $G = (V, E)$ is a subgraph $T = (V, E_T)$ that is a tree and includes every vertex in $V$. If $G$ has non-negative edge weights $w(e)$, a Minimum Spanning Tree (MST) minimizes the total weight $\sum_{e \in E_T} w(e)$.
Greedy MST Algorithms
- Kruskal's Algorithm (Edge-Centric Greedy):
- Sort all edges in $E$ in non-decreasing order of weight: $w(e_1) \le w(e_2) \le \dots \le w(e_m)$.
- Initialize $T$ as an empty forest containing all vertices.
- Iterate through the sorted edges: add edge $e_i$ to $T$ if and only if adding $e_i$ does not create a cycle (managed via Disjoint-Set / Union-Find data structures).
- Terminate when $T$ contains exactly $n - 1$ edges.
- Prim's Algorithm (Vertex-Centric Greedy):
- Start with an arbitrary root vertex $r \in V$; set $V_T = {r}$ and $E_T = \emptyset$.
- At each step, find the minimum-weight edge $e = {u, v}$ such that $u \in V_T$ and $v \in V \setminus V_T$.
- Add $v$ to $V_T$ and $e$ to $E_T$.
- Repeat until $V_T = V$.
5. Shortest Path Optimization: Dijkstra's Algorithm
While MST algorithms connect all vertices with minimum total network cost, finding the shortest path between two specific vertices requires a different optimization.
Dijkstra's Single-Source Shortest Path Algorithm
Given a weighted graph $G = (V, E)$ with non-negative edge weights ($w(u, v) \ge 0$) and a designated source vertex $s$:
- Initialization: Set $\operatorname{dist}(s) = 0$ and $\operatorname{dist}(v) = \infty$ for all $v \ne s$. Let unvisited set $Q = V$.
- Selection: Extract vertex $u \in Q$ with the minimum tentative distance $\operatorname{dist}(u)$.
- Relaxation: For each unvisited neighbor $v$ of $u$: If $\text{alt} < \operatorname{dist}(v)$, update $\operatorname{dist}(v) = \text{alt}$ and set predecessor $\operatorname{prev}(v) = u$.
- Iteration: Remove $u$ from $Q$. Repeat steps 2–3 until $Q = \emptyset$.
Limitation: Dijkstra's algorithm fails in the presence of negative edge weights (which require the Bellman-Ford algorithm).
6. Secondary Pedagogical Traps & Instructional Interventions
Accomplished mathematics teachers anticipate common student hurdles in graph theory:
Misconception 1: Conflating Eulerian and Hamiltonian Routing
Students habitually confuse the edge-traversal requirement of Euler circuits with the vertex-traversal requirement of Hamiltonian cycles, attempting to apply vertex degree parity tests to Traveling Salesperson problems.
- Pedagogical Intervention: Utilize concrete occupational metaphors. Euler problems represent "The Street Inspector / Snowplow Problem": every road (edge) must be plowed or inspected, regardless of how many times the plow passes through an intersection (vertex). Hamiltonian problems represent "The Delivery Van / School Bus Problem": the driver must stop at each house or store (vertex) exactly once, skipping unnecessary connecting streets. Emphasize that Euler routing is computationally simple ($O(|E|)$ degree inspection), whereas Hamiltonian routing is an NP-complete search problem.
Misconception 2: Forgetting the Exterior Face in Euler's Formula
When verifying $V - E + F = 2$, students consistently count only the bounded interior polygons and omit the surrounding unbounded infinite region, obtaining $V - E + F = 1$.
- Pedagogical Intervention: Connect planar graphs to spherical polyhedra. Model a graph drawn on the surface of a globe. Puncturing the center of one face and stretching the spherical skin flat onto a table transforms the punctured face into the vast exterior boundary surrounding the planar drawing. This demonstrates why the exterior region is an authentic, topologically necessary face.
Misconception 3: Cyclic Edge Inclusion in Kruskal's Algorithm
Students executing Kruskal's algorithm mechanically select the next smallest available edge, forgetting to verify whether that edge links two vertices that already belong to the same connected component.
- Pedagogical Intervention: Require students to maintain a connected component table or use colored highlighters during manual execution. When considering an edge, check if both endpoints share the same color. If both endpoints are already green, adding the edge creates a cycle $\implies$ reject the edge.
A connected communications network consists of 12 routers (vertices). Four of the routers each connect to 5 neighbors (degree 5), five routers each connect to 4 neighbors (degree 4), and three routers each connect to 2 neighbors (degree 2). How many communication links (edges) exist in this network, and is it mathematically possible for a different graph to have a degree sequence consisting of (5, 5, 5, 4, 2, 2)?
A connected planar graph G has 10 vertices and divides the plane into 7 faces (including the unbounded exterior face). Furthermore, G is an Eulerian graph possessing an Euler circuit. How many edges does G have, and what can be deduced about the degrees of the vertices of G?
A secondary mathematics teacher introduces two practical municipal routing problems to an advanced discrete mathematics class:
Several students attempt to solve Problem B by checking vertex degree parities using Euler's Theorem. Which pedagogical intervention best addresses this confusion?