Short answer: Ford-Fulkerson sends flow along any path from source to sink in the residual graph, then updates residual capacities in both directions. A residual edge backward carries the option to undo flow. When no residual path remains, the flow is maximum, and the reachable set from the source is a minimum cut. With integer capacities the value climbs by at least 1 per augmentation and the time is O(E · |f*|), which is not polynomial in the number of bits of the capacities.
What the problem actually asks
A feasible flow assigns each edge a value between 0 and its capacity and conserves flow at every vertex except the source and the sink. The residual graph records how much more can be sent forward and how much can be sent backward to cancel a previous decision. An augmenting path is a residual path from source to sink. The augmenting-path theorem says a feasible flow is maximum exactly when no such path exists.
The theorem does not say which path to pick. An arbitrary choice is enough for correctness and not enough for a polynomial bound.
What the algorithm guarantees
If the algorithm stops, the flow is maximum and the set of vertices reachable from the source in the residual graph defines a minimum s-t cut, whose capacity equals the flow value. Integer capacities and an augmentation by the bottleneck integer keep the flow integral, and the number of augmentations is at most the maximum value |f*|. Each search is O(E), so the time is O(E · |f*|). Extra memory is the residual capacity on each edge, stored in both directions.
Irrational capacities can make a careless path choice fail to terminate. Even with integers, a large capacity written in binary has a value exponential in the input length, so this bound is pseudo-polynomial. Edmonds-Karp and Dinic repair that by restricting the path.
The working steps
- Start from the zero flow. For every original edge u→v of capacity c, the residual capacity forward is c and backward is 0.
- Search the residual graph for any path from source to sink that uses edges of positive residual capacity.
- Let b be the minimum residual capacity on that path. Add b to the flow, subtract b from each forward residual, and add b to each backward residual.
- Repeat until the search fails. The flow value is the net flow out of the source.
- The minimum cut is the set of vertices still reachable from the source, on the source side.
Termination with the O(E · |f*|) bound needs integer capacities and a bottleneck that is a positive integer. Shortest residual paths, fewest edges, are Edmonds-Karp. A level graph and a blocking flow are Dinic. All three share the residual update. Only the path rule changes.
Approaches that look simpler and fail
| Approach | Why it fails when the path rule is left unspecified |
|---|---|
| Quote a polynomial bound for arbitrary augmenting paths | Integer capacities only give a bound linear in the maximum flow value. A capacity of 2^b can force exponentially many augmentations in b. |
| Omit backward residual edges | Flow already sent can block a better route. Without a way to undo it, the search gets stuck below the maximum. |
| Augment by 1 when the bottleneck is larger | The result can still reach the maximum and the number of iterations explodes. The bottleneck is the legal step. |
| Treat the reachable set as a cut in a graph with a residual edge left unused | If a residual path to the sink exists, the algorithm has not stopped. The cut is read only after the search fails. |
A polynomial bound from breadth-first augmentations is Edmonds-Karp. A faster blocking-flow schedule is Dinic. A preflow that moves excess downhill, with no path search, is push-relabel.
A working example
This Python fragment augments any residual path, not necessarily a shortest one. Backward residual edges undo a previous push. On the same network as the Edmonds–Karp example the value is again 5.
cap = {(0, 1): 3, (0, 2): 2, (1, 3): 2, (2, 3): 3, (1, 2): 1}
residual = dict(cap)
def dfs(u, t, seen, limit):
if u == t:
return limit
seen.add(u)
for v in range(4):
c = residual.get((u, v), 0)
if c and v not in seen:
pushed = dfs(v, t, seen, min(limit, c))
if pushed:
residual[(u, v)] = c - pushed
residual[(v, u)] = residual.get((v, u), 0) + pushed
return pushed
return 0
flow = 0
while (pushed := dfs(0, 3, set(), 10**9)):
flow += pushed
assert flow == 5
print(flow)
Where it is used
Ford-Fulkerson is the augmenting-path method for pipeline, traffic, and other capacities: keep adding a path with room until none remains. Edmonds-Karp and Dinic are the versions with a proved bound. A greedy widest path is not the maximum flow.
When you can drop this algorithm
Drop bare Ford-Fulkerson when capacities are large integers or the implementation would pick long paths. Use Edmonds-Karp or Dinic. Keep the residual framework, and keep an arbitrary path only when capacities are tiny and a simple search is the point.
Why this stays published
We publish this so a search for Ford-Fulkerson returns the residual backward edge and the pseudo-polynomial bound of arbitrary augmentations. Ford-Fulkerson augments any residual source-sink path and reaches a maximum flow, in O(E · |f*|) time when capacities are integers.
本文由 HoHo 與 AI 協作整理,最後更新於 2026 年 11 月 13 日。
