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:
ote 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, any minimum-capacity cut gives an optimal dual solution in this way. This is the gist of the max-flow min-cut theorem.