(0) Hook (10 seconds)
Draw a simple graph with nodes s, a, b, t and edges:
s → a(capacity 3)a → b(capacity 2)a → t(capacity 1)b → t(capacity 2)
“How much flow can we send from s to t without exceeding pipe capacities?”
(1) First Greedy Attempt (25 seconds)
“Try path s → a → b → t. Bottleneck capacity is 2. Push 2 units:
s→a = 2a→b = 2b→t = 2
Total flow = 2. Buts→ahas unused capacity (1 left), anda→tis unused. Can we improve?”
(2) Residual Graph: The “Undo” Mechanism (30 seconds)
“For every unit of flow f sent along an edge, we create:
- A forward residual edge with capacity
cap - f - A backward residual edge with capacity
f(to reverse flow)”
Draw residual graph for current flow (2 units along s→a→b→t):
s→a: cap 1 (3 - 2)a→b: cap 0 (2 - 2) → add backward edgeb→awith cap 2a→t: cap 1 (1 - 0)b→t: cap 0 (2 - 2) → add backward edget→bwith cap 2
“Backward edges let us ‘undo’ flow and redirect it.”
(3) Finding an Augmenting Path (30 seconds)
“Find a new path in the residual graph: s → b → a → t.
- Bottleneck: min(
s→bcap,b→acap,a→tcap) = 1 - Push 1 unit along this path:
- Reverse 1 unit from
a→b(usingb→a) - Send that unit directly
a→t”
- Reverse 1 unit from
Update flow: - s→a = 2 + 1 = 3 - a→b = 2 - 1 = 1 - a→t = 0 + 1 = 1 - b→t = 2 + 0 = 2 “New total flow = 3.”
(4) Proving Optimality with Min-Cut (15 seconds)
“Define a cut: partition nodes into S = {s, a} and T = {b, t}.
Edges crossing cut: a→t (cap 1) and b→t (cap 2).
Cut capacity = 3. Since flow = cut capacity, it is optimal.”
(5) Algorithm Summary (10 seconds)
“Ford-Fulkerson repeatedly:
- Builds residual graph
- Finds augmenting path (e.g., with BFS → Edmonds-Karp,
O(VE²)) - Pushes flow until no path exists”
1-Page Summary (For Notes)
- Problem: Max flow in capacitated directed graph.
- Residual Graph: Key to correcting flow. Contains:
- Forward edges: remaining capacity
- Backward edges: capacity to reverse flow
- Augmenting Path: Any
s-tpath in residual graph. - Algorithm:
- Start with zero flow.
- While augmenting path exists:
- Push flow equal to min residual capacity on path.
- Update residual graph.
- Termination: Flow is maximal when no augmenting path exists.
- Edmonds-Karp: Uses BFS to find shortest augmenting path. Time:
O(VE²). - Max-Flow Min-Cut: Proof of correctness.