You are on page 1of 4

COM S 511 : DSN & ANALY ALGORITHM

Fall Semester, 2014


Assignment Solution #5
1. [20pt] CLRS Exercise 26.2-12 on page 731
Suppose that you are given a flow network G, and G has edges entering the source s.
Let f be a flow in G in which one of the edges (v, s) entering the source has f (v, s) = 1.
Prove that there must exist another flow f with f (v, s) = 0 such that |f | = |f |. Give
an O(E)-time algorithm to compute f , given f , and assuming that all edge capacities
are integers.
SOLUTION
In a flow network G = (V, E), for v V s, if there is no path from s v, then
f (v, s) = 0.
Let Y be the set of vertices of y such that s is connected to y by a path in G. Then
z V Y is the set of vertices that has no path from s to z. We have:


f (x, z) =
f (z, x)
zV Y xV

f (x, z) +

zV Y xV Y

zV Y xV

f (x, z) =

zV Y xY

By flow conservation
zV Y

f (x, z) = 0
And

xV Y

f (z, x) +

zV Y xV Y

f (x, z) =

f (z, x)

zV Y xY

f (z, x)

zV Y xV Y

zV Y xY

So f (z, x) = 0 for z V Y , x Y v V Y and s Y there for f (v, s) = 0


Taking the counter positive of our previous proof and f (v, s) = 1, we cnclude that
there must be a path from s v. Reduce every edge flow by 1, we will have
f (v, s) = f (v, s) 1 = 0
Since s v s is a circle, substract 1 from each edge flow will not aect flow,
|f | = |f |
Algorithm:
(a) find v, where (v, s) E, and f (v, s) = 1, by an BFS search s s. Make sure
that along the path we have f (u, v) 1, for (u, v) in the path.
(b) For each edge (u, v) in the loop of the above path, decrease f (v, s) = 1 by 1.
Hence f (v, s) = 0.
(c) return |f | = |f |
2. [20pt] CLRS Exercise 26.2-13 on page 731
Suppose that you wish to find, among all minimum cuts in a flow network G with
integral capacities, one that contains the smallest number of edges. Show how to

modify the capacities of G to create a new flow network G in which any minimumcut
in G is a minimum cut with the smallest number of edges in G. SOLUTION
Basic idea: Construct a new graph G with same set of vertices and edges with
modified capacity for each edge. Each capacity of edge will be increase by a constant
. So old minimum cut with more edges will end up increasing more than the minimum
cut with least number of edges. Meanwhile can not be too large eighter. Because
it might make cuts which was not minimum but with much fewer edges becoming
minimum cut in the new graph.
Details: Define
m
=
2|E|
where m is the minimum dierence between minimum cut and non-minimum cut in
G. Then increse every edge by , we have G .
To prove the correctness of this algorithm, we need to prove:
(1) the minimum cut with least number of edges in G will be the only minimum cut
in G
(2) non-minimum cut in G will never be minimum cut in G
Denote sum of capacity if edges of cut (X,Y) to be c(X,Y).
Proof of (1): Let (S,T),(X,Y) be minimum cut in G, |(S, T )| < |(X, Y )|, we have
c (S, T ) = c(S, T ) + |(S, T )|
< c(X, Y ) + |(X, Y )|
= c (X, Y )

(c(S, T ) = c(X, Y ) and |(S, T )| < |(X, Y )|)

Proof of (2): Let (S,T) be minimum cut in G, c(S, T ) < c(X, Y ), we will prove c (X, Y )
is not minimum cut in G .
c (S, T ) = c(S, T ) + |(S, T )|
c(S, T ) + |E|
|(S, T )| |E|
m
= c(S, T ) +
2
c(X, Y )
(c(X, Y ) c(S, T ) m

< c (X, Y )
Correctness proven.
[30pt] CLRS Exercise 26.3 on page 761-762
SOLUTION
a. For contradiction, assume for a finite-capacity cut (S,T), Ji T and Ak S for
some Ak Ri . Then the capacity of dege (Ak , Ji ) should be included in the cut, which
would make c(S, T ) = . Thus Ji T and Ak T .
b. To calculate the maximum revenue, we need maximum income and minimum cost
to hair experts.
Denote accepted job as J , denote Ri as the hired experts for Ji . The total income of

accepted jobs is

Ji J

Pi .

So
the net revenue = total income expert cost

=
Pi
ck
Ji J

Pi

Ji J

Ak R

Ji J

Ji

ck

Ak R

Ji J
/

Pi (

Pi
Pi +

J
/

ck )

Ak R

Pi c(S, T )

Ji J

Therefore the maximum revenue can be achieved by finding minimum cut.


c. Algorithm for picking right jobs and experts:
(a) Construct network flow graph G according to the problem
(b) Find maximum flow using Edmond-Karp algorithm
(c) Find minimum cut (S,T) set using DFS
(d) Hire the expert if (s, Ak ) (S, T )
(e) Accept the job if (Ji , t)
/ (S, T )
(f) return haired experts and accepted job
Analysis of the algorithm: The correctness of this algorithm had been shown in question
b. The running time of this algorithm is determined by step 2. Running time of
Edmond-Karp algorthm is O(|V |(|E|)2 ). We know |V | = (m + n + 2) and |E|
m + n + mn.
Therefore the running time is O((m + n + 2)(m + n + r)2 ), where r mn is edges
between experts and jobs. since:
(m + n + 2)(m + n + r)2 (m + n + 2)(m + n + mn)2
Therefore the running time is O((m + n)(m + n + mn)2 )
[30pt] CLRS Exercise 26.4 on page 762
SOLUTION
Assume all flow is integer.
a. Increase the capacity of a single edge (u, v) E by 1, c (u, v) = c(u, v) + 1 then we
have the following cases:
(a) f (u, v) < c(u, v), therefore (u, v) does not belong to minimum-cut, thus increase
capacity of this edge will not aect maximum flow, this taks O(1)

(b) f (u, v) = c(u, v), which might indicate that (u,v) could be part of minimum cut.
What we need to do is to check if there is a new augmenting path available. if so,
one iteration of Ford-Fulkerson will be enough. This will take O(|V | + |E|)
b.Decrease the capacity of a single edge (u, v) E by 1, c (u, v) = c(u, v) 1 then we
have the following cases:
(a) f (u, v) c(u, v) 1, then the change will not change anything of the flow, we
need to do nothing.
(b) f (u, v) > c(u, v) 1, then the capacity constrain is violated. We need to do DFS
or BFS to decrease one unit along with path from s to v and from v to t. This
should take O(|V | + |E|).

You might also like