BITS Pilani
BITS Logo
CS G526: Advanced Algorithms and Complexity

Randomized Global Min-Cut (Karger’s Algorithm)

Lecture 10 |2026-08-27
Tulasimohan Molli
BITS Pilani, Hyderabad Campus

Agenda

  1. Global Min-Cut Problem — definition and applications.
  2. Karger’s Contraction Algorithm — pick, contract, repeat.
  3. Success Probability Analysis — bound of \ge 2 / (n(n-1)).
  4. Combinatorial Bound via Probabilistic Method — proving at most \binom{n}{2} min-cuts.
  5. Amplification & Runtime — repeating to achieve high probability.
  6. Why Karger? — comparing Karger vs. Hao-Orlin.
  7. The Karger–Stein Algorithm — branching recursive contraction.
  8. Karger-Stein Probability Analysis — proving success chance of \Omega(1/\log n).

The Global Min-Cut Problem

Given an undirected, unweighted graph G=(V,E) with n vertices and m edges, find a cut (S, V \setminus S) that minimizes the number of crossing edges.

  • Global vs. s-t Cut: We do not specify source s and sink t. Any partition is allowed.
  • Applications:
    • Network reliability (weakest link in communication networks).
    • Image segmentation (computer vision clustering).
    • Community detection in social graphs.

Deterministic Approaches

How do we solve it without randomization?

  • Via s-t Max-Flow:
    • Fix an arbitrary vertex s, and find the minimum s-t cut for all possible sinks t \in V \setminus \{s\}.
    • Requires running a max-flow algorithm n-1 times.
    • Time Complexity: O(n \cdot T_{\text{flow}}(n, m)) \approx O(n^2 m).
  • Deterministic Alternatives:
    • Hao–Orlin algorithm runs in O(n^2 \log n) time.
    • Highly complex and difficult to implement in practice.
    • Karger’s randomized algorithm bypasses flow computation completely!

Karger’s Contraction Algorithm

A remarkably simple randomized approach based on edge contraction:

  • Edge Contraction G / e: Given an edge e=(u,v), we merge u and v into a single super-vertex.
    • Delete any self-loops created.
    • Retain parallel edges (multi-graph).
  • The Algorithm:
    1. While the graph has > 2 vertices:
      • Choose an edge e \in E uniformly at random.
      • Contract G \gets G / e.
    2. The remaining 2 vertices represent a partition (cut). Output the edges between them as the min-cut.

Contraction Process Visualized

When we contract an edge, the number of vertices decreases by 1:

u v e w Contract e uv w

Success Probability Analysis

Let C be a specific global min-cut of size k. The algorithm succeeds if it never contracts any edge in C.

  • Since the min-cut size is k, the degree of every vertex must be \ge k.
  • Thus, the total number of edges m \ge \frac{nk}{2}.
  • Probability of picking a min-cut edge in round 1: \Pr(e_1 \in C) = \frac{k}{m} \le \frac{k}{nk/2} = \frac{2}{n}
  • Probability of survival: \Pr(e_1 \notin C) \ge 1 - \frac{2}{n} = \frac{n-2}{n}.
  • Round i survival probability:
    • When n-i+1 vertices remain, the survival probability in round i is \ge 1 - \frac{2}{n-i+1} = \frac{n-i-1}{n-i+1}.

Telescoping the Success Bound

The probability that C survives all n-2 contraction rounds:

  • By independence of conditional choices: \Pr(\text{Success}) \ge \prod_{i=1}^{n-2} \frac{n-i-1}{n-i+1} = \frac{n-2}{n} \cdot \frac{n-3}{n-1} \cdot \frac{n-4}{n-2} \cdot \frac{n-5}{n-3} \dots \frac{4}{6} \cdot \frac{3}{5} \cdot \frac{2}{4} \cdot \frac{1}{3}
  • How terms cancel:
    • Every term j from 3 to n-2 appears exactly once in the numerator and once in the denominator (shifted by 2 positions).
    • Writing the remaining terms after cancellations: \Pr(\text{Success}) \ge \frac{(n-2)(n-3)\dots(3)(2)(1)}{(n)(n-1)(n-2)\dots(4)(3)} = \frac{2 \cdot 1}{n(n-1)} = \Omega\left(\frac{1}{n^2}\right)
  • Note: This is small, but polynomially bounded!

Proving Combinatorial Bounds

We can use the success probability of Karger’s algorithm to prove a fundamental combinatorial theorem using the Probabilistic Method:

Theorem: Any undirected, connected graph G = (V,E) on n vertices has at most \binom{n}{2} = \frac{n(n-1)}{2} distinct global min-cuts.

  • Let C_1, C_2, \dots, C_r be the distinct global min-cuts of G (each of size k).
  • For any specific min-cut C_i, Karger’s algorithm outputs C_i with probability: \Pr(\text{Algorithm outputs } C_i) \ge \frac{2}{n(n-1)} = \frac{1}{\binom{n}{2}}
  • Crucially, the algorithm outputs exactly one cut per run. The events of outputting different cuts C_i and C_j are mutually exclusive: \sum_{i=1}^r \Pr(\text{Algorithm outputs } C_i) \le 1
  • Substituting our lower bound: \sum_{i=1}^r \frac{1}{\binom{n}{2}} \le 1 \implies r \cdot \frac{1}{\binom{n}{2}} \le 1 \implies r \le \binom{n}{2}
  • Power of Randomization: A purely deterministic, structural combinatorial bound proved easily via a randomized algorithm!

Amplifying to High Probability

We repeat the contraction algorithm N times independently and return the smallest cut found.

  • The probability that we fail to find C in all N runs is: \Pr(\text{Failure}) \le \left(1 - \frac{2}{n(n-1)}\right)^N \approx \left(1 - \frac{2}{n^2}\right)^N
  • Using the identity 1 - x \le e^{-x}, we set N = c \cdot \frac{n^2}{2} \ln n: \Pr(\text{Failure}) \le e^{-\left(\frac{2}{n^2}\right) \cdot c \frac{n^2}{2} \ln n} = e^{-c \ln n} = n^{-c}
  • Conclusion: Repeating O(n^2 \log n) times finds the min-cut with high probability (1 - 1/n^c).
  • Total Runtime: A single contraction run takes O(n^2) time. Repeating O(n^2 \log n) times yields a total runtime of O(n^4 \log n).

Why Karger? Randomization vs. Complexity

If deterministic Hao–Orlin runs in O(n^2 \log n) time, why study O(n^4 \log n) Karger?

  • Simplicity: Karger is \approx 15 lines of code; Hao–Orlin is hundreds of lines of complex flow machinery.
  • Parallelizable: Karger’s trials are completely independent and can run in parallel.
  • Insights: Contraction easily proves that a graph has at most \binom{n}{2} min-cuts.
  • Path to Karger-Stein: Lays the foundation for Karger-Stein’s O(n^2 \log^3 n) runtime.
Comparison Matrix
Algorithm Complexity Code Lines
Hao-Orlin $O(n^2 \log n)$ Hundreds (flow)
Karger $O(n^4 \log n)$ ~10-15 lines
Karger-Stein $O(n^2 \log^3 n)$ ~30 lines

The Karger–Stein Algorithm

A branching recursive contraction algorithm to speed up the process:

  • Observation: The probability of contracting a min-cut edge is low when n is large, but rises rapidly as n shrinks.
  • Core Idea: Contract normally while safe (n > n/\sqrt{2}), then branch recursively on two independent copies when risky.
  • Recurrence: T(n) = 2 T(n/\sqrt{2}) + O(n^2) \implies T(n) = O(n^2 \log n) by Master Theorem.
  • Success Chance: \Pr(\text{Success}) = \Omega(1/\log n) per run.
  • Amplification: Repeating O(\log^2 n) times yields O(n^2 \log^3 n) total runtime with high probability.
n nodes n/√2 nodes n/√2 nodes Contract & Branch

Karger–Stein Probability Analysis

Why is the success probability \Omega(1/\log n) instead of \Omega(1/n^2)?

  • First Phase: Contracting n \to n/\sqrt{2} vertices preserves the min-cut with probability \approx \frac{(n/\sqrt{2})^2}{n^2} = \frac{1}{2}.
  • Branching: The algorithm only fails if both independent recursive paths fail: p(n) \ge 1 - (1 - \frac{1}{2} p(n/\sqrt{2}))^2 = p(n/\sqrt{2}) - \frac{1}{4} p(n/\sqrt{2})^2.
  • Recurrence: Let x_k = p(2^{k/2}) at depth k. Then x_k \ge x_{k-1} - \frac{1}{4} x_{k-1}^2 \implies x_k \approx \frac{4}{k}.
  • Result: Since the depth is k = 2\log_2 n, the success probability is p(n) = \Omega(1/\log n).
Survival Probability
Depth (k) Pr p(n) ≈ 4 / k

Concept Check

Answer each question based on Karger’s algorithm:

  1. If a graph has a unique min-cut of size 2, what is the lower bound on the probability that a single run of Karger’s contraction finds it?
  2. If we contract a graph down to 4 vertices instead of 2, how does the survival probability of the min-cut change?
    1. \frac{2}{n(n-1)} (the size of the min-cut k=2 cancels out in the probability bound).
    1. The telescoping product stops earlier, yielding a much higher survival probability: \ge \frac{\binom{4}{2}}{\binom{n}{2}} = \frac{12}{n(n-1)}.

Next Lecture

Expected-Time Data Structures: Skip Lists — balanced search structures without deterministic rebalancing overhead, and backward analysis.