input: a directed graph G=(V,E) with edge capacities c, a source vertex s, and a destination vertex t
goal: find the maximum-size flow from s to t
A flow f is an assignment of non-negative values to the edges in E. f(u,v) denotes the amount of flow on edge e=(u,v).
To simplify the presentation, we introduce an artificial, infinite capacity edge from t to s.
The flow is feasible if it meets the following constraints:
(conservation) The flow into each vertex equals the flow out. (capacity) The flow on each edge does not exceed the capacity of the edge.
The size (or value) of the flow is the total flow from t to s.
The dual is:
Note that any s-t cut C (a collection of edges whose removal separates s from t) gives a feasible solution to the dual, where y(u) = 0 if u is reachable from s without using edges in C, and y(u) = 1 otherwise, and x(u,v) = 1 if (u,v) in C and 0 otherwise. The total capacity of the edges in the cut equals the cost of the corresponding solution to the dual.
In fact, there is always an s-t cut that gives an optimal dual solution in this way. Here is a proof sketch:
MAX-FLOW MIN-CUT THM: Given any feasible solution (x,y) to the dual LP, there exists an s-t cut whose capacity equals the value of the dual solution ∑u,v c(u,v) x(u,v).
PROOF:
Let (x,y) be a feasible solution to the dual.
Without loss of generality assume y(s) = 0 (otherwise subtract y(s) from each y(v) to get an equivalent dual solution).
Choose R uniformly at random in [0,1]. Let U={u ∈ V : y(u) ≤ R}. Then (U,V-U) forms an s-t cut. The probability that an edge (u,v) crosses the cut is
Thus, the expected capacity of the cut is
QED
It is also the case that if the capacities are integers, there is an integer-valued maximum flow f.