Proofs: Karger's algorithm
These are the human proofs of Karger's algorithm, at full length.
Karger's algorithm returns a cut, and a minimum one with probability at least 2/(n(n-1)) per run full
This proof shows: correctness, success-probability.
Let be an undirected multigraph with vertices, and let be the size of a minimum cut, that is, the least number of edges with exactly one end in over all with . We use the pseudocode of the page. During a run, the classes of the union-find structure are the super-vertices. An edge is a loop if both its ends are in the same class.
Lemma 1 (each run returns a cut). CONTRACT returns with , , and equal to the number of edges with exactly one end in . So .
Proof. Line L9 merges two classes only when they differ, so comps is always the number of classes, and it never drops below 2: the loop of line L8 stops as soon as it reaches 2, and each step lowers it by at most 1. So at line L10 there are at least two classes, and the class of vertex 0 is not all of . Line L11 counts the crossing edges exactly.
Lemma 2 (degrees). At any moment, each super-vertex is incident to at least non-loop edges, so if super-vertices remain, there are at least non-loop edges.
Proof. The non-loop edges at are exactly the edges of with one end in and the other end outside . When at least two super-vertices remain, , so this number is a cut size and at least . Summing over the super-vertices counts each non-loop edge twice.
Lemma 3 (the shuffle is random contraction). Condition on the edges that the loop has read so far. The next edge that line L9 contracts is uniformly distributed over the non-loop edges at that moment.
Proof. Given the prefix of read so far, the remaining edges are in a uniformly random order, because is a uniform permutation. The edges read so far are all loops now: each one was either contracted or was already a loop. So the non-loop edges at this moment are exactly the remaining edges whose ends lie in different classes. Classes change only at a contraction, so the next contraction is the first edge in the random order of the remaining edges that belongs to this set. By symmetry of the uniform order, each edge of the set is equally likely to come first.
Lemma 4 (disconnected graphs). If , every run returns .
Proof. If the loop of line L8 reads all edges, each class is a connected component, since every edge was contracted or was a loop. There are then at least two classes, and no edge joins , the component of 0, to the rest, so . If the loop stops at two classes, each class is a connected set of vertices, so it lies inside one component. There are at least two components, and each component is a union of classes, so each of the two classes is a whole component, and again .
Theorem. Assume . Let with be a fixed minimum cut, and let be its crossing edges. One run of CONTRACT returns with probability at least .
Proof. As , the graph is connected, so the loop always ends with exactly two classes. If no edge of is ever contracted, every class stays inside or inside , so at the end the two classes are and , and . A contraction of an edge of puts a vertex of and a vertex outside it in one class, which never splits again, so the run cannot return . Hence the run returns exactly when no edge of is contracted.
There are contractions. Before the -th one, super-vertices remain, with . Let be the event that none of the first contractions takes an edge of . Given , all edges of are non-loop edges, and by Lemma 2 there are at least non-loop edges. By Lemma 3 the next contraction picks a uniform non-loop edge, so
Multiplying over , that is, over ,
The product telescopes: the numerators are and the denominators are .
Corollary 1 (amplification). KARGER-MIN-CUT with runs returns with probability at least , and it never returns a value below .
Proof. By Lemma 1 each run gives , and line L4 keeps the least , so the output is at least , and it is if some run returns a minimum cut. If , every run returns by Lemma 4. Otherwise the runs use independent permutations, so all of them miss the fixed cut with probability at most with , and .
Corollary 2 (number of minimum cuts). A connected multigraph with vertices has at most minimum cuts.
Proof. For distinct minimum cuts (each written with vertex 0 on its side), the events "one run returns " are disjoint, and each has probability at least by the theorem. Their probabilities sum to at most 1.