Sub topic 4
Augmenting Paths and the Bottleneck
This chapter assumes you know what a flow network and a feasible flow are, and how to build a residual graph with forward and reverse edges, as covered in the previous chapters. You should also be comfortable with DFS or BFS on a directed graph and with simple proofs by invariant.
The residual graph tells you where you can still change the flow. An augmenting path turns that information into an actual improvement. This chapter defines augmenting paths, shows how to compute the bottleneck, and proves that pushing flow along such a path always gives another feasible flow with a larger value. The next chapter loops this step into the Ford-Fulkerson method.
What an Augmenting Path Is
An augmenting path is a simple path from the source s to the sink t in the residual graph G_f. Every edge on it has residual capacity strictly greater than zero. A path is simple when it visits no vertex twice.
Each edge on the path is one of two kinds:
- A forward residual edge
u → v. It exists because the original edge(u, v)has unused capacityc(u, v) − f(u, v) > 0. Using it means sending more flow along(u, v). - A reverse residual edge
u → v. It exists because the original edge(v, u)carries flowf(v, u) > 0. Using it means cancelling some of that flow.
The path does not need to follow original edges only. Reverse edges are what let the algorithm undo earlier choices, and that is why augmenting paths can reach the true maximum.
The Bottleneck Capacity
The bottleneck of an augmenting path P is the smallest residual capacity among its edges:
δ = min { c_f(u, v) : (u, v) on P }
You can push at most δ units along the whole path. Pushing more would exceed some edge's remaining capacity, or would cancel more flow than an edge actually carries. Because every residual capacity on the path is positive, δ > 0.
| Edge type on path | Residual capacity | What pushing δ does |
|---|---|---|
| Forward `u → v` | `c(u, v) − f(u, v)` | `f(u, v) += δ` |
| Reverse `u → v` | `f(v, u)` | `f(v, u) −= δ` |
Augmenting Preserves Feasibility
Call the new flow f'. Two things need checking: f' still satisfies both constraints, and its value goes up by exactly δ.
Capacity constraint
For a forward edge, the new flow is f(u, v) + δ ≤ f(u, v) + (c(u, v) − f(u, v)) = c(u, v). For a reverse edge, the new flow is f(v, u) − δ ≥ f(v, u) − f(v, u) = 0. Edges off the path are unchanged. Every edge therefore stays between 0 and its capacity.
Conservation constraint
Take an interior vertex x on the path. The path enters x on exactly one edge and leaves on exactly one edge, because it is simple. There are four cases:
- Forward in, forward out: inflow rises by
δand outflow rises byδ. - Reverse in, reverse out: inflow drops by
δand outflow drops byδ. - Forward in, reverse out: one incoming original edge gains
δand another incoming original edge losesδ. Inflow is unchanged. - Reverse in, forward out: one outgoing edge loses
δand another gainsδ. Outflow is unchanged.
In every case, inflow minus outflow at x stays zero. Vertices off the path are untouched.
The value increases by δ
The path leaves s on its first edge and never returns, because it is simple. That first edge either adds δ to an edge out of s or removes δ from an edge into s. Either way the net outflow from s rises by δ, so |f'| = |f| + δ.
Worked Example: A Reverse Edge Fixes a Bad Choice
Take a small "diamond" network with vertices s, a, b, t. Every edge has capacity 1: s→a, s→b, a→b, a→t, b→t. The maximum flow is 2.
Suppose the first augmenting path chosen is s → a → b → t. Its bottleneck is 1. After the push, the edges s→a, a→b and b→t are saturated, and the flow value is 1. With original edges only, no s-to-t path has spare capacity left. The residual graph still has one, though:
The path s → b → a → t uses the reverse edge b → a, and its bottleneck is 1. Pushing along it adds 1 to s→b, cancels the flow on a→b, and adds 1 to a→t. The result sends one unit along s→a→t and one along s→b→t, for a value of 2. The flow on a→b is back to 0.
Code: Find, Measure, Augment
The functions below work on an adjacency-matrix residual graph, where residual[u][v] is the residual capacity of u → v. Pushing δ lowers residual[u][v] and raises residual[v][u], which handles forward and reverse edges in one rule.
def find_augmenting_path(residual, s, t):
"""Return a simple s-t path in the residual graph as a list of nodes, or None."""
n = len(residual)
parent = [-1] * n
parent[s] = s
stack = [s]
while stack:
u = stack.pop()
if u == t:
break
for v in range(n):
if parent[v] == -1 and residual[u][v] > 0:
parent[v] = u
stack.append(v)
if parent[t] == -1:
return None
path = [t]
while path[-1] != s:
path.append(parent[path[-1]])
path.reverse()
return path
def bottleneck(residual, path):
return min(residual[u][v] for u, v in zip(path, path[1:]))
def augment(residual, path, delta):
for u, v in zip(path, path[1:]):
residual[u][v] -= delta # use up residual capacity
residual[v][u] += delta # allow this push to be undone later
# Diamond network: 0 = s, 1 = a, 2 = b, 3 = t
capacity = [
[0, 1, 1, 0],
[0, 0, 1, 1],
[0, 0, 0, 1],
[0, 0, 0, 0],
]
residual = [row[:] for row in capacity]
value = 0
# Force the "bad" first path s -> a -> b -> t
first = [0, 1, 2, 3]
d = bottleneck(residual, first)
augment(residual, first, d)
value += d
print("after first path:", value) # 1
path = find_augmenting_path(residual, 0, 3)
print("next path:", path) # [0, 2, 1, 3] uses reverse edge 2 -> 1
d = bottleneck(residual, path)
augment(residual, path, d)
value += d
print("after second path:", value) # 2
print("more paths?", find_augmenting_path(residual, 0, 3)) # NoneThe find_augmenting_path function marks a vertex as discovered when it is pushed onto the stack, so each vertex gets one parent and the reconstructed path is always simple.
Common Mistakes
- Computing δ from original capacities. The bottleneck must use residual capacities. Using
capacity[u][v]overshoots on any edge that already carries flow. - Forgetting the reverse update. If you skip
residual[v][u] += delta, the algorithm can never cancel flow. On the diamond network it would stop at 1 instead of 2. - Treating "no path in the original graph" as optimal. Optimality means no path exists in the residual graph. The cut chapters prove that this test is sufficient.
- Following edges with zero residual capacity. The search must test
residual[u][v] > 0, not just whether the edge exists. - Mixing floats and exact arithmetic. With floating-point capacities, residuals such as
1e-17can look positive and produce tiny useless augmentations. Use integers where possible, or compare against a tolerance.
Exercise
In the six-node network with edges s→1 (16), s→2 (13), 1→3 (12), 2→1 (4), 2→4 (14), 3→2 (9), 3→t (20), 4→3 (7), 4→t (4), start from the zero flow and push along s→1→3→t, then along s→2→4→t. What is the bottleneck of the third path s→2→4→3→t, and what is the flow value afterward?
Show answer
After the first push (bottleneck 12) and the second (bottleneck 4), the residual capacities on the third path are s→2: 13−4 = 9, 2→4: 14−4 = 10, 4→3: 7, 3→t: 20−12 = 8. The bottleneck is min(9, 10, 7, 8) = 7, and the flow value becomes 12 + 4 + 7 = 23.
Exercise
An augmenting path enters vertex x through a forward residual edge (original edge u→x) and leaves through a reverse residual edge (original edge y→x). Explain why conservation at x still holds after pushing δ.
Show answer
Both original edges point into x. The flow on u→x rises by δ and the flow on y→x falls by δ, so the total inflow to x is unchanged. No outgoing edge of x changes, so inflow still equals outflow.
Exercise
Why can the bottleneck δ of an augmenting path never be zero, and why does that matter for the flow value?
Show answer
By definition, every edge on an augmenting path has residual capacity greater than zero, so their minimum is also greater than zero. Each augmentation therefore raises the flow value by a positive amount. With integer capacities, that amount is at least 1.