07 Lecture-Duality-Flow
07 Lecture-Duality-Flow
Maciej Liśkiewicz
First we provide a sufficient condition for total unimodularity. Then we prove that the
famous Max-flow Min-cut Theorem follows from the Duality Theorem. This is an important
example of applications of the Duality Theorem. This example, as well as that ones we have
considered in the last lecture, show that duality helps to view the optimization problem from a
different perspective, which might be easier to handle.
(a) for a column with two nonzero entries of the same sign their rows are in different
sets of the partition;
(b) for a column with two nonzero entries of different signs, their rows are in the same
set of the partition.
0 0 0 0 +1 0 0 0 0 0
0 −1 0 0 0 −1 0 0 0 0
Q1 +1 0 0 0 −1 0 0 −1 0 0
0 +1 +1 0 0 1 0 0 0 +1
0 0 0 −1 0 0 0 0 0 0
+1 0 0 −1 0 0 −1 −1 0 0
Q2 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 +1 0 0 +1
Proof: By induction on the size k of the square submatrices. Obviously, the determinant of
every 1 × 1 submatrix is 0, +1, or −1 . Assume, the theorem holds for all square submatrices
of size k − 1 . Let C be an arbitrary square submatrix of size k . If C contains a zero column
its determinant is 0. If C contains a column with a single nonzero entry we can expand the
2 Algorithmics: Applications of LP Duality
determinant along this column and use the inductive assumption. Finally assume that every
column j that C includes has exactly two nonzero entries. From 2(a) and 2(b) it follows
X X
aij = aij .
i∈Q1 i∈Q2
Thus, the rows of C are linear dependent and the determinant equals 0 . t
u
2 Max-flow Min-cut
In this section we show that the Max-flow Min-cut Theorem follows from the Duality Theorem.
The problem of max-flow in a flow network is defined as follows.
Input: A directed Graph G = (V, E) with two distinguished vertices, source s and sink t ,
and positive edge capacities c : E → R+ .
Compute: A flow of maximum value that can be sent from s to t satisfying the capacity
constraint and flow conservation.
1. Capacity constraint: for each edge e , the flow sent through e is bounded by its capac-
ity c(e) .
2. Flow conservation: at each vertex v , other than s and t , the total flow into v is equal
to the total flow out of v .
1. f is a maximum flow in G .
2. The value of f is equal to c(X, X) for some s - t cut (X, X) of G .
M. Liśkiewicz, November 2021 3
We formulate the maximum flow problem as a linear program. Instead of expressing maxi-
mality of a flow from s to t we introduce a fictitious edge of infinite capacity from t to s (thus,
extending a flow from s to t to a circulation). Then we can require capacity constraints for all
nodes, including s and t . Let E denote the edges including (t, s) and let cvw = c(v, w) , for
short. In the program xvw , with (v, w) ∈ E , are variables expressing flows sent through edges
(v, w) . Our program can then be written as follows:
maximize xts
subject to xvw ≤ cvw for all (v, w) ∈ E − {(t, s)}
X X
xuv − xvw = 0 for all v ∈ V
u:(u,v)∈E w:(v,w)∈E
xvw ≥ 0 for all (v, w) ∈ E.
P P
Observe that the constraints Out(v) := u:(u,v)∈E xuv = In(v) := w:(v,w)∈E xvw = 0 can be
replaced by inequalities: Out(v) − In(v) ≤ 0 .
Indeed, if for some feasible solution we have for some node v Out(v) − In(v) < 0 then there
must be another node v 0 with Out(v 0 ) − In(v 0 ) > 0 since summing over all nodes the total
outflow is equal to the total inflow (both sums count each xe exactly once). But this contradicts
our constraints. Therefore we obtain the primal program in standard form that expresses the
max-flow problem:
maximize xts
subject to xvw ≤ cvw for all (v, w) ∈ E − {(t, s)}
X X (1)
xuv − xvw ≤ 0 for all v ∈ V
u:(u,v)∈E w:(v,w)∈E
xvw ≥ 0 for all (v, w) ∈ E.
Example Consider the flow network:
u
3 1
s 1 t
1 2
To obtain the dual program we introduce variables yuv and zv corresponding to the two types
of inequalities in the primal program. Edge variables yuv can be viewed as distance labels for
edges (u, v) and node variables zv as potential values for nodes v . The dual program has the
following form:
X
minimize cvw · yvw
(v,w)∈E−{(t,s)}
subject to yvw − zv + zw ≥ 0 for all (v, w) ∈ E − {(t, s)}
(2)
zs − z t ≥ 1
yvw ≥ 0 for all (v, w) ∈ E − {(t, s)}
zv ≥ 0 for all v ∈ V .
We can interpret the dual as follows by viewing cvw as the cross-sectional area of (v, w) . Our
goal is to minimize the total volume, while maintaining a distance between s and t of at least
1. For our example primal program we obtain as a dual the following LP:
Above we have discussed how the dual can be interpreted. However, to better understand,
which problem expresses the dual, we transform it to an 0-1 integer linear program that has
only binary vectors as feasible solutions:
X
minimize cvw yvw
(v,w)∈E−{(t,s)}
subject to yvw − zv + zw ≥ 0 for all (v, w) ∈ E − {(t, s)}
(3)
zs − zt ≥ 1
yvw ∈ {0, 1} for all (v, w) ∈ E − {(t, s)}
zv ∈ {0, 1} for all v ∈ V .
Let (y ∗ , z ∗ ) ∈ {0, 1}|E|−1+|V | be an optimal solution of this integer program. The only way
to satisfy the constraint zs − zt ≥ 1 with a 0-1 assignment is zs∗ = 1 and zt∗ = 0 . Now, it is
easy to see that the solution (y ∗ , z ∗ ) defines an s - t cut (X, X) , where X is the set of verices
v of potential 1, i.e. for which zv∗ = 1 , and X are vertices of potential 0, i.e. with zv∗ = 0 .
Particularly, we have s ∈ X and t ∈ X .
Consider an edge (v, w) with v ∈ X and w ∈ X . Since zv∗ = 1 and zw ∗ = 0 , by the
constraint yvw − zv + zw ≥ 0 and since we have 0-1 solution, we get yvw ∗ = 1 . The distance
∗ 0 0
label yv0 w0 of edges (v , w ) which do not belong to the cut can be set to either 0 or 1 without
violating the constraint yv0 w0 − zv0 + zw0 ≥ 0 . However to minimize the objective value, variable
M. Liśkiewicz, November 2021 5
yv∗0 w0 must be set to 0. The objective value for (y ∗ , z ∗ ) is equal to the capacity of the s - t cut
(X, X) and (X, X) must be a minimum cut.
Thus, the 0-1 integer program (3) is a formulation of the minimum s - t cut problem. As a
relaxation of this problem we obtain:
X
minimize cvw yvw
(v,w)∈E−{(t,s)}
subject to yvw − zv + zw ≥ 0 for all (v, w) ∈ E − {(t, s)}
(4)
zs − zt ≥ 1
0 ≤ yvw ≤ 1 for all (v, w) ∈ E − {(t, s)}
0 ≤ zv ≤ 1 for all v ∈ V .
Notice that the dropping the upper constraints yvw ≤ 1 and zv ≤ 1 cannot give a better
solution. Hence the LP (4) has the same optimal solutions as the LP (2) and therefore we can
view the linear program (2) as a relaxation of the program (3), too.
What we have done so far can be summarized as follows
Relax.
Max Flow → primal LP (1) ↔ dual LP (2) ≡ LP (4) ←− 0-1 ILP (3) ← Min Cut
Now, using Theorem 1 we can see that
Fact 1 The constraint matrix of the LP (2) is totally unimodular.
Proof: Let A P be the constraint
P matrix of the LP (1) and let B be the submatrix of A for
constraints x
u:(u,v)∈E uv − w:(v,w)∈E xvw ≤ 0 . Matrix B is totally unimodular since it
satisfies the conditions of Theorem 1 with a trivial partition, where all rows belongs to Q1 . For
A we have
I0
A=
B
where I is the identity matrix and 0 denotes a zero vector. To see that A is totally unimodular,
let us consider a square submatrix C of A . If C is a submatrix of [I 0] or of B , we are done.
Assume C contains entries of both matrices. Then C can be represented as
0
00
I
B1 B2
where I0 an identity matrix and 00 is a zero matrix (after permuting the columns if needed).
We obtain |det(C)| = |det(B2 )| which is 0 or 1.
Since A is the transposed matrix of the constraint matrix of the LP (1), the fact follows. t u
Hence we conclude:
Lemma 1 The optimal fractional minimum s - t cut solutions for the program (2) are (integral)
minimum s - t cut solutions of the 0-1 integer linear program (3).
By the LP Duality Theorem, a maximum flow solution for the primal LP (1) must equal an
optimal solution of the dual LP (2), i.e. the capacity of a minimum fractional s - t cut. But by
the lemma above we know that the later equals the capacity of a minimum s - t cut, thus we
get the Max-flow Min-cut Theorem.
From the total unimodularity of the constraint matrix of the program (2) we can also draw
the following consequence, also called Integral Flow Theorem:
Corollary 1 If the capacities of the flow network are integers, then there exists an integral
maximum flow.
6 Algorithmics: Applications of LP Duality
3 Menger’s Theorem
We use the Max-flow Min-cut Theorem to derive Menger’s Theorem. Consider a flow network
G = (V, E) with capacities 1 for all edges. Hence integral s - t flows can be regarded as
collections of edge disjoint s - t paths. We obtain the following important theorem.
Theorem 3 (Menger) Let G be a graph (directed or undirected), let s and t be two vertices,
and let k ∈ N . Then the following are eqivalent:
1. There are k edge-disjoint s - t paths in G .
2. After deleting any k − 1 edges t is still reachable from s .
Proof: We prove that (2) implies (1). The other direction is obvious.
Consider first a directed graph. If after deleting any k − 1 edges sink t is still reachable
from source s then minimum capacity of a s - t cut is at least k (remember, the capacities
of edges are 1). By the Max-flow Min-cut Theorem and Corollary 1 there is an integral s - t
flow f of value at least k . Then one can decompose the flow into integral flow on s - t paths
P1 , . . . , P
P` and possiblyP
some circuits C1 , . . . , C`0 such P
that for w(Pi ) := w(Cj ) := 1 we have
0
f (e) = i:e∈Pi w(Pi ) + j:e∈Cj w(Cj ) for all edges e , i w(Pi ) = value(f ) , and ` + ` ≤ |E| .
To show that such a decomposition exists one can construct the decomposition inductively. Since
all capacities are 1 we must have at lest k edge disjoint s - t paths P1 , . . . , Pk .
To prove the theorem for undirected graphs, we transform the graph to a directed one and
use the proof above. The transformation replaces each undirected edge e = {v, w} by five
directed edges
(v, xe ), (xe , ye ), (ye , v), (ye , w), (w, xe ).
t
u
Corollary 2 Let G be a graph (directed or undirected) and let s and t be two vertices. Then
the maximum number of edge-disjoint s - t paths is equal to the minimum size of an s - t cut.
Thus, the maximum number of edge-disjoint s - t paths can be computed efficiently. A
closely related question is the number of node-disjoint s - t paths. Thus, now paths may not
even cross at nodes. There are simple reductions from node-disjointness to edge disjointness and
vice versa.
A generalization of this problem is the following called DISJOINT-PATH-PROBLEM: Given a
graph G and a sequence of node pairs (si , ti ) , one has to connect each pair by a path and all
these paths have to be disjoint. It can be modeled as a multi-commodity flow problem that can
slso be transfered into an LP-instance. This problem, however, has shown to be N P -hard.
References