3.5.16 · D4Graphs

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

2,521 words11 min readBack to topic

Two small networks recur in the exercises. Meet them once here so you never have to re-read the wiring.

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

Level 1 — Recognition

Can you read the definitions and apply them literally?

Recall Solution L1.1

Check the two rules from the parent note. Capacity (): ✔, ✔, ✔, ✔, ✔, ✔. Conservation at each interior node (in = out):

  • : in ; out
  • : in ; out
  • : in ; out

Valid. Value .

Recall Solution L1.2

Only edges going forward from to count (Blunder 2 in the parent note). Edges leaving into :

  • (cap 2)
  • (cap 3)
  • (cap 2)

( stays inside , so it does not count.) .

Recall Solution L1.3

Forward leftover: . Backward (undo) edge has capacity .


Level 2 — Application

Run the algorithms by hand.

Recall Solution L2.1

Start .

  • Path : bottleneck . Push 2. Running .
  • Path : residual , , . Bottleneck . Push 2. .
  • Path : , , . Bottleneck . Push 2. .

Any more? Out of : has left, has left. Source is fully saturated, so no residual edge leaves . Max flow . Matching min cut: , ✔.

Recall Solution L2.2

BFS measures path length in edges. From , shortest paths have length 2: and . BFS picks one such length-2 path first — say , bottleneck 1, push 1. Residual: gone, gone; still open , . Next BFS shortest path: , length 2, bottleneck 1, push 1. . No residual path remains ( fully saturated). Max flow . Note Edmonds–Karp's shortest-path rule avoided the length-3 detour that plain Ford–Fulkerson might grab first.

Recall Solution L2.3

If the path chooser is adversarial and always routes through the unit middle edge, each augmentation pushes only bottleneck 1 (the edge), so it needs augmentations to reach the true max flow . This is the value-dependent blow-up. Edmonds–Karp ignores the middle edge because and are shorter (length 2 vs 3). It pushes then : just 2 augmentations. Max flow in both cases — same answer, wildly different work.


Level 3 — Analysis

Reason about cuts, residuals, and why the algorithm is right.

Recall Solution L3.1

Take , . Forward edges: (4), (2). . By weak duality (Step 2 of the parent proof), every flow every cut, so . We achieved . Equality means both are optimal — the max-flow min-cut theorem. The saturated source edges are the bottleneck.

Recall Solution L3.2

At max flow, and are both saturated (residual 0), so no forward residual edge leaves . Are there backward residual edges into ? Backward edges point , — those go toward , not away, so they don't help reach new nodes. Hence and . This is exactly the cut of L3.1, capacity . The construction (“reachable set in residual graph”) is precisely Step 3 of the theorem's proof.

Recall Solution L3.3

Push 1 along . Now , , are all saturated. Remaining forward edges: (open), (open) — but there is no forward path connecting them ( dead-ends since is full; is unreachable since is full). Greedy stops at . With backward edges, the residual graph has (cap 1, the undo of ). New path: using (1), backward (1), (1). Push 1. Now , which equals the min cut : . The backward edge re-routed the mistaken commitment.


Level 4 — Synthesis

Combine flow with modelling and duality.

Recall Solution L4.1

Standard Bipartite Matching reduction: add source (cap 1 each), edge (cap 1) for each allowed pair, and (cap 1 each). Max flow = max matching (each unit of flow is one matched pair; capacity-1 source/sink edges force distinctness). Trace: (1), (1), (1). All three source edges saturated. Max matching — a perfect matching. Certificate: cut has capacity (three unit source edges), matching the flow.

Recall Solution L4.2

With all capacities 1, max flow counts edge-disjoint paths (each path uses each edge at most its capacity 1). Push:

  • (1)
  • (1)

Now used, used; , , used. Remaining: (1) but is full so is unreachable. Max flow , so 2 edge-disjoint paths. By Menger's Theorem (the edge form = max-flow min-cut with unit capacities), the minimum number of edges whose removal disconnects from is also . Min cut: gives forward edges , , = capacity 3... but the tight cut is : edges , = 2 ✔.

Recall Solution L4.3

Primal (max flow): variables , maximize subject to and conservation. Its dual assigns a variable to each edge (interpretable as a 0/1 “is this edge cut?” indicator in the integral optimum) and minimizes total cut capacity. Strong Linear Programming Duality gives primal optimum = dual optimum, i.e. — the max-flow min-cut theorem is exactly LP duality specialised to this totally-unimodular problem (so the LP optimum is integral). No numeric answer; the point is the structural identity.


Level 5 — Mastery

Full end-to-end reasoning, including degenerate cases.

Recall Solution L5.1

Edmonds–Karp: — capacity-independent. Ford–Fulkerson (worst path choice): — 50× larger and it depends on the capacity magnitude. The capacity-independent bound is the safe one to quote. (If you needed even better, Dinic's Algorithm gives , and on unit-capacity/matching graphs.)

Recall Solution L5.2

(a) : value is defined as net flow out of the source, but source is the sink — the problem is degenerate; conventionally max flow (nothing to transport). Most implementations reject . (b) No path: no augmenting path ever exists, so max flow . The min cut is : put every -reachable node in ; since is unreachable, no forward edge crosses. ✔ theorem holds trivially. (c) Capacity-0 edge: forces by the capacity constraint; the edge is as good as absent and contributes 0 to any cut. Max flow unchanged. (d) Self-loop (cap 5): conservation at counts it as both in-flow and out-flow, so it cancels; it can carry any but never changes . Safe to delete before running. Max flow unchanged.

Recall Solution L5.3

Each augmentation pushes along a shortest residual path, so it only adds residual edges that are the reverse of edges on that shortest path. A reverse edge appears only when lay on a shortest path, meaning ; using the new reverse edge later would require , i.e. grew by . So between two saturations of the same edge, a distance increases by at least 2. Distances are bounded by , so each of the edges is saturated times, giving augmentations; each BFS costs , hence total.


Recall One-line self-test (fold, then recall)

Max flow of Network A ::: 6 Max flow of Network B ::: 2 Edge-disjoint paths in unit-capacity Network A ::: 2 Edmonds–Karp bound for :::