Algorithm Search⌘K

Proofs: Karger-Stein algorithm

These are the human proofs of Karger-Stein algorithm, at full length.

Recursive contraction finds a minimum cut with probability Ω(1/log n) in O(n^2 log n) time full

This proof shows: correctness, termination, complexity.

Setting. GG is an undirected graph on n≥2n \ge 2 vertices with weights w≥0w \ge 0, parallel edges summed, no self-loops. λ\lambda is the weight of a minimum cut. A contracted graph HH has vertices that are disjoint groups of original vertices covering VV, and wH(X,Y)=w(X,Y)w_H(X, Y) = w(X, Y) for groups X≠YX \ne Y. A cut of HH is a union of groups, so it is a cut of GG with the same weight; hence λ(H)≥λ\lambda(H) \ge \lambda. A cut CC of GG survives in HH if every group lies inside CC or inside V∖CV \setminus C; then CC is a cut of HH.

Lemma 1 (soundness). Every pair (k,S)(k, S) returned is a cut of GG with weight exactly kk; so the result is never below λ\lambda.

Proof. Line L6 returns a cut of the current graph with its weight, and a zero-weight return after W=0W = 0 is a single group with no edge leaving it. Both are cuts of GG of the same weight. Lines L9 and L3 only choose among such pairs. □\square

Lemma 2 (one contraction). If HH has k≥3k \ge 3 vertices, W>0W > 0, and a minimum cut CC of GG survives in HH, then one contraction of line L11 destroys CC with probability at most 2/k2/k.

Proof. The weighted degree of each vertex XX of HH is the weight of the cut XX of GG, so it is at least λ\lambda. So 2W≥kλ2W \ge k\lambda. The edges of HH that cross CC have total weight λ\lambda, since CC survives, and the contraction picks one of them with probability λ/W≤2/k\lambda / W \le 2/k. Contracting any other edge keeps every group on one side. □\square

Lemma 3 (contracting to tt). If CC survives in HH with kk vertices and t≥2t \ge 2, then CONTRACT(H,t)(H, t) keeps CC with probability at least t(t−1)/(k(k−1))t(t-1) / (k(k-1)). For k≥7k \ge 7 and t=⌈1+k/2⌉t = \lceil 1 + k/\sqrt2 \rceil this is at least 12\frac12, and t<kt < k.

Proof. If W=0W = 0 the call stops and CC survives. Otherwise, by Lemma 2 applied for j=k,k−1,…,t+1j = k, k - 1, \ldots, t + 1 vertices, CC survives with probability at least ∏j=t+1k(1−2/j)=∏j=t+1kj−2j=t(t−1)k(k−1)\prod_{j=t+1}^{k} (1 - 2/j) = \prod_{j=t+1}^{k} \frac{j - 2}{j} = \frac{t(t-1)}{k(k-1)}. For the given tt, t−1≥k/2t - 1 \ge k/\sqrt2 and t≥k/2+1t \ge k/\sqrt2 + 1, so t(t−1)≥k2/2+k/2≥k(k−1)/2t(t-1) \ge k^2/2 + k/\sqrt2 \ge k(k-1)/2. And t<kt < k for k≥7k \ge 7, since 1+k/2≤k−11 + k/\sqrt2 \le k - 1 when k≥2/(1−1/2)≈6.83k \ge 2/(1 - 1/\sqrt2) \approx 6.83. □\square

Termination and depth. By Lemma 3 each recursive call has fewer vertices than its parent, so the recursion ends. CONTRACT stops at exactly tt vertices unless it returns early, so a call at depth jj has at most njn_j vertices, where n0=nn_0 = n and nj+1=⌈1+nj/2⌉≤nj/2+2n_{j+1} = \lceil 1 + n_j/\sqrt2 \rceil \le n_j/\sqrt2 + 2. Let c=2/(1−1/2)≈6.83c = 2/(1 - 1/\sqrt2) \approx 6.83, so that c=c/2+2c = c/\sqrt2 + 2. Then nj+1−c≤(nj−c)/2n_{j+1} - c \le (n_j - c)/\sqrt2, and so nj≤c+n/2j/2n_j \le c + n/2^{j/2}. A call at depth jj that recurses has at least 7 vertices, so 7≤c+n/2j/27 \le c + n/2^{j/2}, which gives 2j≤n2/(7−c)2≤34 n22^{j} \le n^2/(7 - c)^2 \le 34\,n^2. So the depth D(n)D(n), the largest depth of a call, satisfies 2D(n)≤68 n22^{D(n)} \le 68\,n^2 and D(n)≤2log⁡2n+7=O(log⁡n)D(n) \le 2\log_2 n + 7 = O(\log n).

Lemma 4 (success). Let pDp_D be the least probability, over all contracted graphs HH of recursion depth at most DD in which some minimum cut of GG survives, that RECURSIVE-CONTRACT(H)(H) returns a pair with k=λk = \lambda. Then pD≥2/(D+2)p_D \ge 2/(D + 2).

Proof. By induction on DD. For D=0D = 0, line L6 finds a minimum cut of HH, whose weight is λ\lambda since λ≤λ(H)≤w(C)=λ\lambda \le \lambda(H) \le w(C) = \lambda; so p0=1p_0 = 1. Let D≥1D \ge 1, and let CC survive in HH. Branch ii of line L8 succeeds if CC survives in GiG_i, with probability at least 12\frac12 by Lemma 3, and then, conditioned on any such GiG_i, the recursive call succeeds with probability at least pD−1p_{D-1}; if instead the call stopped with W=0W = 0, it returns 0=λ0 = \lambda. So a branch succeeds with probability at least pD−1/2p_{D-1}/2. The branches use independent random choices, so both fail with probability at most (1−pD−1/2)2(1 - p_{D-1}/2)^2, and

pD≥1−(1−pD−12)2=pD−1−pD−124.p_D \ge 1 - \Bigl(1 - \frac{p_{D-1}}{2}\Bigr)^2 = p_{D-1} - \frac{p_{D-1}^2}{4}.

The map f(p)=p−p2/4f(p) = p - p^2/4 is increasing on [0,2][0, 2], so with pD−1≥2/(D+1)p_{D-1} \ge 2/(D + 1),

pD≥2D+1−1(D+1)2=2D+1(D+1)2≥2D+2,p_D \ge \frac{2}{D+1} - \frac{1}{(D+1)^2} = \frac{2D + 1}{(D+1)^2} \ge \frac{2}{D+2},

where the last step is (2D+1)(D+2)=2D2+5D+2≥2D2+4D+2=2(D+1)2(2D + 1)(D + 2) = 2D^2 + 5D + 2 \ge 2D^2 + 4D + 2 = 2(D+1)^2. □\square

Lemma 5 (time). One run takes O(n2log⁡n)O(n^2 \log n) time.

Proof. A call on kk vertices copies the matrix for each branch and makes at most kk contractions in each branch, each in O(k)O(k) time, so it does O(k2)O(k^2) work besides its children; a call with k≤6k \le 6 does O(1)O(1) work. There are at most 2j2^j calls at depth jj, each with at most nj≤c+n/2j/2n_j \le c + n/2^{j/2} vertices, so the work at depth jj is O(2j(c2+n2/2j))=O(2j+n2)O(2^j (c^2 + n^2/2^j)) = O(2^j + n^2). By the depth bound, 2j≤68 n22^j \le 68\,n^2 for every depth jj that occurs, so each depth costs O(n2)O(n^2), and the D(n)+1=O(log⁡n)D(n) + 1 = O(\log n) depths cost O(n2log⁡n)O(n^2 \log n) in total. □\square

Theorem. With RR runs, KARGER-STEIN returns λ\lambda with probability at least 1−(1−2/(D(n)+2))R≥1−e−2R/(D(n)+2)1 - (1 - 2/(D(n) + 2))^R \ge 1 - e^{-2R/(D(n) + 2)}, and never a value below λ\lambda. With R=⌈c(D(n)+2)ln⁡n/2⌉=O(log⁡2n)R = \lceil c (D(n) + 2) \ln n / 2 \rceil = O(\log^2 n) the error is at most n−cn^{-c}, and the time is O(n2log⁡3n)O(n^2 \log^3 n).

Proof. Soundness is Lemma 1. A minimum cut of GG survives in GG itself, so by Lemma 4 each run succeeds with probability at least 2/(D(n)+2)2/(D(n) + 2), independently of the other runs, and (1−x)R≤e−xR(1 - x)^R \le e^{-xR}. The time is RR times the bound of Lemma 5. ■\blacksquare

Back to Karger-Stein algorithm