Trees and Networks - Applications
Kruskal's algorithm efficiently finds minimum spanning trees, with correctness following from the greedy choice property and the cut property.
Given a connected weighted graph , Kruskal's algorithm finds a minimum spanning tree:
- Sort edges by weight: where
- Initialize (empty forest)
- For each edge in sorted order:
- If adding to doesn't create a cycle, add it:
- Return
Correctness Proof (Cut Property):
Lemma (Cut Property): Let be a proper subset. Let be a minimum-weight edge with one endpoint in and one in . Then some MST contains .
Proof of lemma: Let be any MST. If , we're done. Otherwise, adding to creates a cycle. This cycle must cross the cut at least twice (once via , once via another edge ).
Remove from to get a spanning tree . Since (by minimality of across the cut), we have . Since is an MST, is also an MST, and it contains .
Main Proof: Kruskal's algorithm maintains a forest . We prove by induction that at each step, is contained in some MST.
Base: is in every MST.
Inductive step: Suppose is in some MST . When we consider edge :
- If creates a cycle in , skip it (can't be in any spanning tree extending )
- If doesn't create a cycle, and are in different components of . Let be the component containing .
The edge crosses the cut . Among edges considered so far (including ), is the minimum-weight edge crossing this cut (edges are sorted). By the cut property, some MST contains .
Moreover, this MST can be chosen to contain : if an MST contains , we can modify it to include (as shown in the cut property proof). Thus is in some MST.
By induction, when the algorithm terminates with a spanning tree, it's an MST.
With and :
- Sorting edges:
- Processing each edge with Union-Find: where is the inverse Ackermann function (effectively constant)
Total: since , so .
For dense graphs (), Prim's algorithm with Fibonacci heaps achieves , which is better.
The greedy approach works for MST because the matroid structure: forests form an independence system where the greedy algorithm yields optimal solutions. This extends to other matroid optimization problems. The reverse-delete algorithm (dual to Kruskal's) also works: sort edges in decreasing weight order, remove edges that don't disconnect the graph. Minimum spanning tree algorithms have applications in network design, clustering (single-linkage hierarchical clustering), and approximation algorithms (e.g., 2-approximation for TSP on metric spaces via MST).