Solutions 6
Solutions 6
Exercises
Solution: Since this graph has a perfect matching, the vertices from the top part form a minimum
vertex cover.
2. Find a maximum flow from s to t and a minimum s-t cut in the following network.
2
1 3
s 1 1 t
4 2
Solution: The only maximum flow here (with value 4) is the following:
2/2
1/1 2/3
s 1/1 0/1 t
3/4 2/2
u 1 v
2× 6
10 6 10
2×
t
Clearly, the maximum value of a flow is 2 million, but the Ford-Fulkerson algorithm might always
choose a path that uses the edge uv by alternately choosing suvt and svut. This way the value of the
flow increases by 1 in every step, so it takes 2 million improvements to reach a maximum flow.
4. Let G be a network with source s, sink t, and integer capacities. Prove or disprove the following
statements:
(a) If all capacities are even then there is a maximal flow f such that f (e) is even for all edges e.
(b) If all capacities are odd then there is a maximal flow f such that f (e) is odd for all edges e.
Solution:
(a) Dividing all capacities by two, we obtain a network with integral capacities. Therefore, it has an
integral maximum flow. Multiplying this flow by 2, we get an even maximum flow on the original
network.
(b) Counterexample:
u
1 1
s v 3
t
1 1
d
5. Let G be a network with source s, sink t, and integer capacities. Prove that an edge e is saturated
(i.e., the flow uses its full capacity) in every maximum s-t flow if and only if decreasing the capacity
of e by 1 would decrease the maximum value of an s-t flow in G.
Solution: Let k be the value of the maximum flow, i.e., the capacity of a minimum cut in G. We
argue by contradiction for both directions.
⇒: Suppose decreasing the capacity does not decrease the size of the max flow. Then there is a flow
in this new network G0 of value k that does not use the full capacity of e in G. This corresponds to a
flow of size k in G with the same property, contradicting our assumption.
⇐: Suppose e is not saturated in every maximum s-t flow. If we could assume that this flow is an
integer flow, then we would be done: This flow would have value k in G0 , contradicting the assumption.
But we don’t quite know that we can assume this, so let’s do something else instead:
Indeed, if e is not saturated in some maximum flow, then e does not occur in any min cut (otherwise
the size of this flow would be less than the capacity of a min cut). Now we do know that every cut
has an integer capacity, so if e is not in a k-cut, then every cut containing e has capacity at least
k + 1. Hence decreasing the capacity of e by 1 will not create any cut of size k, therefore the size of
the maximum flow does not decrease. Contradiction.
6. Deduce Hall’s theorem from the max-flow min-cut theorem.
Solution: Consider the bipartite graph G = (A ∪ B, E) that satisfies Hall’s conditions. Let us make
a network out of G. Add a source s, connect it to all vertices of A by oriented edges of capacity 1.
Analogously, add a sink t and connect all vertices of B to it by edges of capacity 1. Let the edges of
G be oriented from A to B and their capacities to be infinite. We stress that all the edges are now
oriented in the direction from s to t (see the figure below).
If there is a integer flow of value |A| in G, then the edges (x, y) satisfying x ∈ A, y ∈ B, and f (x, y) = 1
constitute a matching of A in G, and we are done. Otherwise, there is a cut (X, Y ) of capacity k < |A|.
We know that
|A ∩ Y | + |B ∩ X| = k < |A| = |A ∩ X| + |A ∩ Y |,
from which we conclude that |B ∩ X| < |A ∩ X|. Let W = A ∩ X. The set N (W ) is contained in
B ∩ X, as otherwise there would be an infinite-capacity edge crossing from X to Y . Thus, |N (W )| =
|B ∩ X| < |W |, and we verified that when a perfect matching does not exist, there is a set W violating
Hall’s criterion.
2
1 ∞ 1
s t
1 1
∞
7. Let A be an n × m matrix of non-negative real numbers such that the sum of the entries is an integer
in every row and in every column. Prove that there is an n × m matrix B of non-negative integers with
the same sums as in A, in every row and every column.
Solution: Let a1 , . . . , an and b1 , . . . , bm be the sums of the entries in the rows and columns of A,
respectively. Consider the complete bipartite graph G = (P ∪ Q, E), where P = {p1 , . . . , pn } and
Q = {q1 , . . . , qm }. Let us make a directed network out of G. Orient all edges from P to Q, and set
their capacity to infinity. Add a source s, connect it to all vertices of P by oriented edges of capacity
ai for the vertex pi . Analogously, add a sink t and connect all vertices of Q to it by oriented edges of
capacity bj for the vertex qj .
Clearly, the minimum capacity of a cut is a1 + · · · + an = b1 + · · · + bm . Since all capacities are integral,
the Ford-Furkerson theorem shows that there is an integer flow with maximum value. We can then
define the entry Bij of the matrix B to be the value of this flow on the edge pi qj .
8. Let G be a connected graph and let s and t be two vertices in G. Devise a polynomial-time algorithm
that finds two disjoint sets S and T such that s ∈ S, t ∈ T , and δ(S) + δ(T ) is minimum, where δ(X)
is the number of edges between X and V − X.
9. Prove that the Ford-Fulkerson algorithm
√
might not stop on the following network with the capacities
shown on the edges, where φ = 5−1 2 . For this, use induction to show that the “residual capacities”
c(u, v) − f (u, v) on the three horizontal edges can be φk , 0, φk+1 , for every k. (Note that φ2 = 1 − φ.)
5 5
5
1 φ
v1 v2 v3 v4
1
5
5 5
Solution: Suppose the Ford-Fulkerson algorithm starts by choosing the central augmenting path,
shown in the figure below.
s
5 5
5
1 φ
v1 v2 v3 v4
1
5
5 5
The three horizontal edges, in order from left to right, now have residual capacities 1, 0, and φ. Suppose
inductively that the horizontal residual capacities are φk−1 , 0, φk for some positive integer k.
1. Augment along B, adding φk to the flow; the residual capacities are now φk+1 , φk , 0.
2. Augment along C, adding φk to the flow; the residual capacities are now φk+1 , 0, φk .
3. Augment along B, adding φk+1 to the flow; the residual capacities are now 0, φk+1 , φk+2 .
4. Augment along A, adding φk+1 to the flow; the residual capacities are now φk+1 , 0, φk+2 .
3
A B C
s s s
5 5 5 5 5 5
5
1 φ 1 φ 1 φ
v1 v2 v3 v4 v1 v2 v3 v4 v1 v2 v3 v4
1 1 1
5
5 5 5 5 5 5
t t t