Skip to main content

Menger Theorem and Network Flows

Menger's theorem and max-flow min-cut are two versions of the same principle: the maximum number of independent ways to move through a network equals the minimum size of a bottleneck that blocks all movement. This is one of the clearest places where graph theory turns a routing question into a structural equality.

Network flows add capacities to directed edges. Instead of asking only whether a path exists, we ask how much material can be sent from a source to a sink while respecting capacity constraints. The algorithmic picture is built from augmenting paths, residual networks, and cuts.

Definitions

An ss-tt path is a path from source ss to target tt. Two paths are edge-disjoint if they share no edges, and internally vertex-disjoint if they share no vertices except possibly ss and tt.

An ss-tt edge cut is a set of edges whose deletion separates ss from tt. An ss-tt vertex cut is a set of vertices, excluding ss and tt, whose deletion separates ss from tt.

A flow network is a directed graph with source ss, sink tt, and capacities c(u,v)0c(u,v)\ge 0 on arcs. A flow ff satisfies:

  1. Capacity constraints: 0f(u,v)c(u,v)0\le f(u,v)\le c(u,v).
  2. Flow conservation at every vertex except s,ts,t: inflow equals outflow.

The value of the flow is the net amount leaving ss.

The residual capacity of a forward arc is c(u,v)f(u,v)c(u,v)-f(u,v), and the residual capacity of a backward arc is f(u,v)f(u,v).

Key results

Menger's edge theorem. For distinct vertices s,ts,t in a finite graph, the maximum number of pairwise edge-disjoint ss-tt paths equals the minimum size of an ss-tt edge cut.

Menger's vertex theorem. For nonadjacent s,ts,t, the maximum number of pairwise internally vertex-disjoint ss-tt paths equals the minimum size of an ss-tt vertex cut.

Max-flow min-cut theorem. In a finite flow network, the maximum value of an ss-tt flow equals the minimum capacity of an ss-tt cut.

Integrality theorem. If all capacities are integers, then there is a maximum flow whose arc values are all integers.

These theorems explain why unit-capacity flow can prove Menger-type path-packing results.

Residual networks. A residual network records what changes are still possible. A forward residual edge means extra flow can be sent along an arc. A backward residual edge means existing flow can be cancelled and rerouted. This is why augmenting-path algorithms can recover from an early poor choice: they are not simply adding more flow, they are adjusting the current flow inside the feasible region.

Cuts as certificates. A flow proves a lower bound on the maximum value. A cut proves an upper bound, because every unit of flow from ss to tt must cross from the source side of the cut to the sink side. When a flow value equals a cut capacity, both are optimal. This dual certificate pattern is one of the most important habits in network optimization.

Vertex-disjoint paths by splitting vertices. To model internally vertex-disjoint paths as a flow problem, replace each vertex vv other than s,ts,t by two vertices vinv_{\text{in}} and voutv_{\text{out}} joined by an arc of capacity 11. Original incoming edges enter vinv_{\text{in}}, and original outgoing edges leave voutv_{\text{out}}. This forces at most one unit of flow through each internal vertex.

Edge connectivity and vertex connectivity. The edge version of Menger's theorem leads to edge connectivity: the minimum number of edges whose removal disconnects the graph. The vertex version leads to vertex connectivity: the minimum number of vertices whose removal disconnects the graph or reduces it to a trivial graph. These parameters measure different kinds of robustness. A network can have high edge connectivity but low vertex connectivity if many routes pass through the same articulation point.

Ford-Fulkerson termination. With integer capacities, each augmenting path increases the flow value by at least 11, so the basic Ford-Fulkerson method terminates. With irrational capacities and careless path choices, termination can fail. Edmonds-Karp avoids this issue by always choosing a shortest augmenting path in the residual network and has a polynomial time bound.

Visual

Cut SS containing ssCrossing arcs to VSV-SCapacity
{s}\{s\}sa, sbs\to a,\ s\to b3+2=53+2=5
{s,a}\{s,a\}sb, ab, ats\to b,\ a\to b,\ a\to t2+1+2=52+1+2=5
{s,b}\{s,b\}sa, bts\to a,\ b\to t3+3=63+3=6
{s,a,b}\{s,a,b\}at, bta\to t,\ b\to t2+3=52+3=5

Worked example 1: Compute a maximum flow

Problem. In the network above, find a maximum ss-tt flow.

Method.

Capacities are:

c(s,a)=3, c(s,b)=2, c(a,b)=1, c(a,t)=2, c(b,t)=3.c(s,a)=3,\ c(s,b)=2,\ c(a,b)=1,\ c(a,t)=2,\ c(b,t)=3.

Use augmenting paths.

  1. Send 22 units along sats-a-t. This saturates ata\to t.

Flow value: 22.

  1. Send 22 units along sbts-b-t. This saturates sbs\to b.

Flow value: 44.

  1. There is still residual capacity 11 on sas\to a, 11 on aba\to b, and 11 on btb\to t. Send 11 unit along
sabt.s-a-b-t.

Flow value: 55.

The final nonzero flows are:

f(s,a)=3,f(s,b)=2,f(a,t)=2,f(a,b)=1,f(b,t)=3.f(s,a)=3,\quad f(s,b)=2,\quad f(a,t)=2,\quad f(a,b)=1,\quad f(b,t)=3.

Cut check. The cut S={s}S=\{s\} has capacity 3+2=53+2=5. Since we found a flow of value 55 and a cut of capacity 55, max-flow min-cut proves optimality.

Checked answer. The maximum flow value is 55.

Worked example 2: Edge-disjoint paths via unit capacities

Problem. In an undirected graph with edges

sa, sb, ac, bc, at, ct, bt,sa,\ sb,\ ac,\ bc,\ at,\ ct,\ bt,

find the maximum number of edge-disjoint ss-tt paths.

Method.

  1. Exhibit three paths:
sat,s-a-t, sbt,s-b-t, sacbts-a-c-b-t

This list is not edge-disjoint because sas-a is used in the first and third paths.

  1. Try again:
P1=sat,P_1=s-a-t, P2=sbct.P_2=s-b-c-t.

Now P1P_1 uses sa,atsa,at, and P2P_2 uses sb,bc,ctsb,bc,ct. They are edge-disjoint.

  1. Can there be a third? The source ss has degree 22, with incident edges sasa and sbsb. Every ss-tt path must use one of these two edges when leaving ss.
  2. Therefore any collection of edge-disjoint ss-tt paths has size at most 22.

Checked answer. The maximum number of edge-disjoint ss-tt paths is 22, equal to the minimum edge cut {sa,sb}\{sa,sb\}.

This is exactly the unit-capacity form of max-flow min-cut. Give every undirected edge capacity 11 in both directions, or orient each edge both ways with shared-capacity care in a more formal model. The degree of ss supplies a cut of capacity 22, and the two displayed paths supply a flow of value 22.

Code

Edmonds-Karp is the breadth-first-search version of Ford-Fulkerson.

from collections import deque, defaultdict

def max_flow(capacity, source, sink):
residual = defaultdict(dict)
for u, nbrs in capacity.items():
for v, c in nbrs.items():
residual[u][v] = c
residual[v].setdefault(u, 0)

flow_value = 0

while True:
parent = {source: None}
q = deque([source])
while q and sink not in parent:
u = q.popleft()
for v, c in residual[u].items():
if c > 0 and v not in parent:
parent[v] = u
q.append(v)
if sink not in parent:
break

bottleneck = float("inf")
v = sink
while v != source:
u = parent[v]
bottleneck = min(bottleneck, residual[u][v])
v = u

v = sink
while v != source:
u = parent[v]
residual[u][v] -= bottleneck
residual[v][u] += bottleneck
v = u
flow_value += bottleneck

return flow_value

capacity = {"s": {"a": 3, "b": 2}, "a": {"b": 1, "t": 2}, "b": {"t": 3}, "t": {}}
print(max_flow(capacity, "s", "t"))

The returned number is only the flow value. A production implementation would also return the final arc flows and the minimum cut obtained from vertices reachable from ss in the final residual network. Returning both objects gives the lower-bound and upper-bound certificates side by side.

In worked flow problems, always finish by naming a cut with the same value as the proposed flow. The cut is what proves that no hidden augmenting route can do better. Without it, a large flow is only a candidate solution.

In flow computations, separate feasibility from optimality. Feasibility means capacities and conservation hold. Optimality means no larger flow exists, usually certified by a cut of equal value. Many arithmetic mistakes produce flows that look large but violate conservation at an intermediate vertex. Check conservation before looking for the final cut certificate.

Common pitfalls

  • Confusing edge-disjoint and vertex-disjoint paths.
  • Allowing an ss-tt vertex cut to include ss or tt in the standard form of Menger's theorem.
  • Forgetting backward arcs in a residual network. They represent the ability to reroute existing flow.
  • Assuming a greedy first augmenting path always gives the final flow. It may need later correction through residual edges.
  • Comparing flow value to the wrong cut direction. An ss-tt cut counts arcs from the source side to the sink side.
  • Treating capacities as edge weights for shortest paths. Flow capacities limit throughput; they are not distances.

Connections