3.5.16 · D2Graphs

Visual walkthrough — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

2,401 words11 min readBack to topic

Step 0 — The three things we are allowed to talk about

Before any theorem, we need three objects on the page. Let us draw them.

PICTURE. Look at the figure. Black dots are junctions, black arrows are pipes, and the number on each arrow is its capacity. The red dots are the two special ones: on the left, on the right.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

We will use this exact network the whole way down, so remember it: holds 3, holds 2, holds 1, holds 2, holds 3.


Step 1 — What "a flow" actually is (and its two laws)

We now put water into the pipes. A flow is a second number on each arrow: how much water is actually running through that pipe right now (not just how much it could hold).

PICTURE. Each pipe now shows a fraction — running water over capacity. Watch dot (circled red): the water arriving equals the water leaving. That balance is Law 2 made visible.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

Step 2 — Drawing a "cut": a wall between and

Now forget flow for a moment. Imagine slicing the whole network into two teams of dots.

PICTURE. The red dashed line is the wall. Everything left of it is (blue-shaded region, tap side); everything right is (bucket side). The two arrows that cross forward are highlighted — their capacities added together are the cut's cost. The one backward arrow crossing the wall is drawn faint: it is free.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

Step 3 — The bookkeeping trick: flow across a cut is the flow value

Here is the first real derivation. We claim: no matter where you draw the wall, the net water crossing it forward equals .

Let us make it exact. Add up Law 2 over every dot in (and the value-definition for ):

Now split each arrow by where its two ends live:

  • Both ends in (internal): the arrow's flow appears once as " out of one -dot" and once as " into another -dot". They cancel.
  • One end in , one in (crossing): survives.

What is left is exactly the crossing flow:

PICTURE. Internal arrows are drawn grey and paired with a tag to show they cancel. Only the red crossing arrows survive the sum. That surviving red total is .

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

Step 4 — Weak duality: every flow is trapped below every cut

Take the boxed equation from Step 3 and squeeze each piece.

  • Forward flows obey Law 1: . So the first sum is at most .
  • Backward flows obey Law 1: . So the second sum is at least , and we are subtracting it — subtracting something non-negative only makes smaller.

Chain both facts:

PICTURE. A number line. The blue tick sits somewhere; the red tick sits to its right. The arrow shows can never jump past any cut. Do this for the smallest cut and you get : the best flow is fenced in below the cheapest wall.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

Step 5 — The residual graph: leftovers plus "undo" arrows

To reach the ceiling we need a machine that improves a flow. That machine is the residual graph — a redrawing of the network showing where water can still move.

PICTURE. One original pipe (top, of ) becomes two residual arrows below: a solid forward arrow labelled (room left) and a red dashed backward arrow labelled (the refund). One red dashed arrow is the star of this figure — it is the only new idea here.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

An augmenting path is any route from to using residual arrows with positive capacity. Its bottleneck is the smallest capacity along it. Pushing that much strictly raises — so as long as an augmenting path exists, we are not at the maximum.


Step 6 — The knockout: no augmenting path builds the min cut for free

Now the punchline. Suppose we have run the machine until no augmenting path from to exists in the residual graph. We will show this flow equals a cut — proving it maximal.

Build the cut automatically. Let

Since no augmenting path reaches , we know . So is a legal cut. Now look at any arrow crossing the wall:

  • Forward pipe (): if it had leftover () there'd be a residual forward arrow into , making reachable — contradiction. So it is saturated: .
  • Backward pipe (): if it carried flow () it would create a residual arrow into , again making reachable — contradiction. So on it.

Plug into Step 3's boxed identity:

PICTURE. The residual graph after the machine halts. Reachable dots () are shaded; the red wall separates them from . Every forward arrow across the wall is drawn thick-red and stamped "FULL"; every backward arrow is stamped "EMPTY". The flow leaking across exactly fills the wall.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

Combine with Step 4: we found a flow equal to a cut. Step 4 said flow cut for all pairs, so neither can improve — this flow is maximum and this cut is minimum.


Step 7 — Edge and degenerate cases (nothing left unshown)

A theorem you cannot trust at the corners is not a theorem. Check them.

PICTURE. Four tiny networks side by side, each illustrating one corner case, with its max-flow value stamped in red. Seeing them together confirms the equality survives every degenerate input.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp

The one-picture summary

Here is the entire derivation compressed into a single diagram: a flow value pinned between "any cut" above and pushed up by "augmenting paths" below, meeting exactly when the residual graph runs dry.

Figure — Network flow — max-flow min-cut theorem, Ford-Fulkerson, Edmonds-Karp
  • Ceiling (Step 4): every cut is an upper wall — .
  • Elevator (Steps 5–6): each augmenting path lifts by its bottleneck.
  • Landing (Step 6): when no path remains, the reachable set is a cut of the same value. Ceiling met. Done.
Recall Feynman retelling — the whole walkthrough in plain words

You have pipes from a tap to a bucket . Water can only be as much as pipes hold, and no junction stores water — in equals out. Draw any wall splitting tap-side from bucket-side; count only the pipes pointing forward through it. Because junctions don't hoard, all the water the tap emits has to cross that wall — so water-crossing-the-wall equals the total water sent. Forward pipes across the wall can't carry more than they hold, and backward pipes only subtract, so the water sent can never beat the wall's cost — no matter which wall. That's the ceiling. To reach it, keep finding any still-open route from tap to bucket and push water through — and crucially, keep refund coupons (backward arrows) so you can pull water back out of a bad route and reroute it. When absolutely no open route remains, look at every dot you can still reach from the tap: that reachable set is a wall, every forward pipe across it is completely full, every backward one is empty — so the water sent exactly equals this wall's cost. Ceiling touched. Max flow = min cut.

Recall

Why does summing conservation over all of leave only cut-crossing flow? ::: Internal arrows appear once as and once as and cancel; only arrows with one endpoint in survive. Which arrows across a cut count toward its capacity? ::: Only forward arrows; backward ones are free. What does "no augmenting path" let you build for free? ::: The set of residual-reachable dots, a cut whose capacity equals the current flow — proving both optimal. Why can the algorithm fail to terminate with irrational capacities? ::: A bad path choice can push ever-shrinking bottleneck amounts forever; BFS path choice fixes this.