Sub topic 8
When Ford-Fulkerson Is Slow or Never Stops
Ford-Fulkerson is a method. It does not say which augmenting path to pick, only that you keep augmenting until no path is left. That freedom has a cost. With some path choices the method takes an enormous number of steps, and with irrational capacities it can run forever without reaching the maximum flow.
This chapter assumes you know the residual graph, augmenting paths, and bottleneck capacity from the earlier chapters. You should also be comfortable with Big-O notation and with how the size of an input is measured in bits.
Termination with Integer Capacities
Start with the good news. Suppose every capacity is a non-negative integer. Then three facts hold at every step:
- Every flow value on every edge is an integer. This is true at the start, when all flows are 0. It stays true because each bottleneck is a minimum of integer residual capacities, so it is an integer, and adding or subtracting an integer keeps everything integral.
- Every augmentation has a bottleneck of at least 1, because an augmenting path uses only edges with positive residual capacity, and a positive integer is at least 1.
- The flow value can never exceed the maximum flow value, written |f*|.
So the flow value rises by at least 1 per augmentation and is bounded above by |f|. The method therefore stops after at most |f| augmentations. Each augmentation finds a path with BFS or DFS in O(V + E) time, which is O(E) when every vertex is reachable from the source. The total running time is:
| Quantity | Bound | Column | Column |
|---|---|---|---|
| Number of augmentations | at most \ | f*\ | |
| Work per augmentation | O(E) | ||
| Total time | O(E · \ | f*\ | ) |
Rational capacities reduce to this case. Multiply every capacity by the least common multiple of the denominators, solve the integer problem, then divide the answer by the same number.
Why O(E · |f*|) Is Not Polynomial
The bound looks harmless, but |f*| is a number, not a count of objects in the input. A capacity of one billion takes about 30 bits to write down. The input size grows with log C, where C is the largest capacity, while the bound grows with C itself. Algorithms like this are called pseudo-polynomial: polynomial in the numeric values, exponential in the number of bits used to write them.
A Small Graph That Takes Millions of Steps
The standard bad case has four vertices. The source s connects to a and b with capacity C. Both a and b connect to the sink t with capacity C. A single edge from a to b has capacity 1.
The maximum flow is 2C. A sensible choice finds it in two augmentations: push C along s → a → t, then C along s → b → t.
Now pick badly. Augment along s → a → b → t. The middle edge limits the bottleneck to 1. That creates a reverse residual edge b → a with capacity 1. Next, augment along s → b → a → t, which uses that reverse edge and again has bottleneck 1. This cancels the flow on a → b and restores its residual capacity, so the first path is available again. Alternating these two paths adds exactly 1 unit each time, so reaching 2C takes 2C augmentations.
The code below runs this adversarial choice and counts the steps.
def bottleneck(residual, path):
return min(residual[u][v] for u, v in zip(path, path[1:]))
def push(residual, path, amount):
for u, v in zip(path, path[1:]):
residual[u][v] -= amount
residual[v][u] += amount
def build(C):
S, A, B, T = 0, 1, 2, 3
residual = [[0] * 4 for _ in range(4)]
residual[S][A] = C
residual[S][B] = C
residual[A][T] = C
residual[B][T] = C
residual[A][B] = 1
return residual
def run(C, paths, cycle):
# cycle=True alternates through the paths until the next one is blocked
residual = build(C)
flow = augmentations = 0
i = 0
while True:
if not cycle and i >= len(paths):
break
path = paths[i % len(paths)]
b = bottleneck(residual, path)
if b == 0:
break
push(residual, path, b)
flow += b
augmentations += 1
i += 1
return flow, augmentations
S, A, B, T = 0, 1, 2, 3
bad = [[S, A, B, T], [S, B, A, T]]
good = [[S, A, T], [S, B, T]]
for C in (10, 1000, 100000):
print(C, "bad:", run(C, bad, cycle=True), "good:", run(C, good, cycle=False))Output:
10 bad: (20, 20) good: (20, 2)
1000 bad: (2000, 2000) good: (2000, 2)
100000 bad: (200000, 200000) good: (200000, 2)Both strategies reach the same correct value. The bad one takes a number of steps proportional to C, while the good one always takes 2. With C = 10^9 the bad run would need two billion augmentations on a graph with five edges.
Irrational Capacities: No Termination, Wrong Limit
The termination argument depended on each bottleneck being at least 1. With irrational capacities there is no fixed minimum step size. Bottlenecks can shrink forever.
Uri Zwick gave a small example (1995) built on the number r = (√5 − 1)/2 ≈ 0.618. This number satisfies r² = 1 − r. The network has three special edges with capacities 1, r, and 1, and every other edge has a large capacity M, with M ≥ 2. A carefully chosen repeating sequence of augmenting paths keeps the residual capacities of the special edges in the pattern r^n, r^(n+1), 0. Each round of the sequence pushes a geometrically shrinking amount of flow, and the identity r² = 1 − r lets the pattern repeat forever.
The consequences:
- The method never terminates. An augmenting path always exists.
- The flow value converges to 1 + 2(r + r² + r³ + ...) = 1 + 2(1 + r) = 3 + 2r ≈ 4.236.
- The true maximum flow is 2M + 1, which is at least 5.
The second point is the serious one. Running "long enough" does not fix the problem, because the limit of the sequence is not the maximum flow. The method gets stuck converging to a wrong answer.
What the Failures Have in Common
Both failures come from the same gap. Ford-Fulkerson guarantees correctness when it stops, through the max-flow min-cut theorem. It guarantees nothing about how fast it gets there, because it puts no rule on which path to augment. Fixing this means adding a rule:
| Path selection rule | Number of augmentations | Depends on capacities? | Column | Column |
|---|---|---|---|---|
| Any path (generic DFS) | O(\ | f*\ | ) for integers, possibly infinite otherwise | Yes |
| Largest bottleneck ("fattest path") | O(E log \ | f*\ | ) | Yes, logarithmically |
| Capacity scaling | O(E log C) | Yes, logarithmically | ||
| Shortest path by edge count (BFS) | O(V E) | No |
The last row is Edmonds-Karp, covered in the next chapter. It runs in time polynomial in V and E alone, so it works even with irrational capacities and is immune to the four-vertex trap above. On that graph, BFS finds the two-edge paths s → a → t and s → b → t before the three-edge path through the middle edge, so it finishes in 2 augmentations.
Exercise
A network has integer capacities, 500 edges, and a maximum flow value of 40. Give an upper bound on the number of augmentations generic Ford-Fulkerson performs, and explain why that bound does not depend on the path-selection order.
Show answer
At most 40 augmentations. With integer capacities each augmentation raises the flow value by at least 1, and the value can never exceed the maximum of 40. This argument uses only integrality and the upper bound on the flow value, so it holds for every choice of augmenting paths.
Exercise
In the four-vertex example, change the capacity of the edge a → b from 1 to C. How many augmentations does the adversarial alternation now take, and why?
Show answer
Two. The first augmentation along s → a → b → t has bottleneck min(C, C, C) = C, which saturates s → a and b → t. The second path s → b → a → t uses the reverse edge b → a with residual capacity C, and its bottleneck is C, which saturates s → b and a → t. The total flow is 2C and no augmenting path remains. The slowdown needs a small middle edge that limits every bottleneck.
Exercise
Someone suggests running generic Ford-Fulkerson with irrational capacities for a fixed number of iterations and returning the current flow as "close enough". Why does Zwick's example rule this out?
Show answer
In Zwick's example the flow value converges to 3 + 2r ≈ 4.236, while the true maximum is 2M + 1 ≥ 5. Running longer brings the flow closer to the wrong limit, not to the maximum, so stopping after any number of iterations can leave an error that does not shrink.