A Bit of History
David Karger introduced this randomized contraction algorithm in his 1993 Stanford PhD thesis and a related paper, showing — remarkably — that a purely random process could find the global minimum cut with high probability, in an algorithm dramatically simpler to state (though not necessarily faster in the worst case) than Stoer-Wagner's deterministic approach. Three years later, Karger and David Stein published the Karger-Stein algorithm (1996), a recursive refinement achieving near-optimal \(O(V^2 \log^3 V)\) expected running time — for years the fastest known algorithm for the global minimum cut problem.
Working Principle
The algorithm is disarmingly simple:
- While more than 2 vertices remain: pick an edge uniformly at random from the current (multi-)graph.
- Contract that edge — merge its two endpoints into a single vertex, keeping all other edges (including any resulting parallel edges/multi-edges, and removing only self-loops created by the contraction).
- When exactly 2 vertices (super-vertices) remain, the multi-edges between them form a cut — its size is the number of parallel edges connecting them.
A single run of this process might land on a poor cut by bad luck — but running it many times independently and keeping the smallest cut found dramatically increases the chance of finding the true global minimum.
Worked Example
On a small graph with a "weak link" — two dense clusters of vertices connected by just 2 edges — a lucky random run will happen to only contract edges within each cluster, never touching the 2 bridging edges, until each cluster has collapsed to a single super-vertex; the final cut between them is then exactly those 2 original bridging edges — the true minimum cut. An unlucky run might instead contract one of the bridging edges early, merging the two clusters together and hiding the true minimum cut forever in that particular run — which is precisely why the algorithm must be repeated many times.
Why It Works (Probabilistically)
Karger's key insight is a clean probability bound: if the graph has \(n\) vertices and its global minimum cut has \(k\) edges, then a single run of the algorithm finds that specific minimum cut with probability at least \(\binom{n}{2}^{-1} = \frac{2}{n(n-1)}\). The argument: since every vertex must have degree \(\geq k\) (else a smaller cut would isolate it), the graph has at least \(nk/2\) edges — so the chance of randomly picking one of the \(k\) minimum-cut edges at any single contraction step is at most \(k / (nk/2) = 2/n\), and multiplying these small "avoid the cut" probabilities across all \(n-2\) contraction steps yields the stated bound.
Key Insight
Since a single run succeeds with probability at least \(\frac{2}{n(n-1)}\), running the algorithm \(O(n^2 \log n)\) independent times and keeping the smallest cut found drives the failure probability down to below \(1/n\) — turning a weak per-run guarantee into an overwhelmingly reliable overall algorithm, entirely through repetition.
Complexity Analysis
A single contraction run takes \(O(V)\) contraction steps, each doable in \(O(V)\) time with a simple implementation, giving \(O(V^2)\) per run. Repeating \(O(V^2 \log V)\) times for high-probability correctness:
$$\text{Time (basic Karger): } O(V^4 \log V) \qquad \text{Time (Karger-Stein, 1996): } O(V^2 \log^3 V)$$
The Karger-Stein refinement achieves its dramatically better bound by recursively contracting down to \(n/\sqrt{2}\) vertices (where the failure probability is still manageable) before branching into two independent recursive sub-runs, rather than repeating the entire process from scratch every single time.
Implementation
Real-World Applications
Community Detection Validation in Massive Networks
Randomized min-cut algorithms are practically attractive for very large social or web-scale graphs precisely because each individual trial is extremely simple and fast, and (unlike deterministic algorithms) trivially parallelizable — thousands of independent random contraction runs can execute simultaneously on separate machines, with only the final "take the minimum across all trials" step requiring coordination, making Karger's approach a natural fit for distributed graph-processing systems from Part 23.
Exercises
- Run the provided implementation on a small graph with an obvious "weak bridge" edge, and verify across multiple executions that it reliably finds the correct minimum cut.
- Explain in your own words why the per-run success probability bound \(\frac{2}{n(n-1)}\) gets worse (smaller) as \(n\) grows, and why repeated trials are therefore essential rather than optional.
- Compare Karger's algorithm to Stoer-Wagner's: which is deterministic, and which trades a probabilistic guarantee for dramatically simpler logic?
- Challenge: Research the Karger-Stein recursive refinement and explain, at a high level, why contracting only down to \(n/\sqrt{2}\) vertices before recursing (rather than all the way to 2) improves the overall running time so significantly.
Limitations
Probabilistic, Not Guaranteed
The basic algorithm only finds the true minimum cut with a certain probability per run — it must be repeated enough times to make failure sufficiently unlikely, and there is always some (arbitrarily small, but technically nonzero) chance of missing the true minimum even after many trials. For applications requiring an absolute guarantee rather than overwhelming probability, Stoer-Wagner's deterministic algorithm remains the appropriate choice.