Docsity

Homework 4 Solutions - Algorithm Design and Analysis | CSE 202, Assignments of Computer Science

Toggle sidebar
bg1
CSE 202 Homework 4
Network Flow and NP problem sample solutions
1. Row-Column sums
Solution
This problem can be solved using a straightforwardapplication of network flows.
Consider an
n
n
matrix with column sums of
c
i
and row sums
r
i
and unknown
elements
m
i;j
. Define a flow network in the following way: a source vertex
s
with edges to
n
verticies,
v
i
, with capacities,
r
i
. Similarly, define a sink vertex
t
with edges to
n
verticies
u
i
with capacities
c
i
. Then define
n
2
verticies,
x
i;j
, with
edges
(
v
i
;x
i;j
)
and
(
x
i;j
;u
j
)
all of capacity
k
. An integral maximum flow on
this network determines a solution to the matrix problem where the flow along
(
x
i;j
;v
i
) = (
x
i;j
;u
j
) =
m
i;j
. (Note that since all capacities are integers the
flow algorithms discussed in CLR will return integral flow values)
Proof: First, consider a solution to the row-column sum problem. This is a valid
flow since no capacities are exceeded:
P
i
m
i;j
=
P
i
f
(
x
i;j
;v
i
)=
r
i
which is
the capacity of all (only one) inputs to
v
i
(similarly for the columns). Further, all
m
i;j
<k
, and all flows
(
v
i
;x
i;j
)
<k
and
(
x
i;j
;u
j
)
<k
, so these flows are not
exceeded.
Second, there exists a cut in the network,
G
,
s
with value
P
i
r
i
. Therefore,
we have a valid flow and a cut of the same value and therefore each must be a
max-flow/min-cut.
2. Approximating MAX-CLIQUE; CLR 37-2, p. 984
Part (a) proof:
Let
G
= (
V; E
)
. First, we demonstrate a clique in
G
(
k
)
of size
l
k
where
l
is the size of the maximum clique in
G
. Consider the set of verticies,
C
0
=
f
(
v
1
;v
2
;:::;v
k
):
v
i
2
C
g
,where
C
is a maximum clique in
G
. Each vertex
in
C
0
is adjacent to every other vertex since for
(
v
1
;:::;v
k
)
and
(
u
1
;:::;u
k
)
an
edge exists if any
u
i
6
=
v
i
. The size of
C
0
is
l
k
and forms a clique in
G
(
k
)
.
We show that there is no larger clique inductively. First, since
G
(1)
=
G
,itis
clear for
k
=1
. Now, assume it is true fo r all
i<k
. Consider a largest clique
C
k
in
G
(
k
)
.Let
C
a
=
f
(
a; v
2
;:::;v
k
)
j
(
a; v
2
;:::;v
k
)
2
C
k
g
for
a
2
V
. By induc-
tion,
j
C
a
j
l
k
,
1
.For
a
6
=
b
, either
(
a; b
)
2
E
or for every
(
a; v
2
; ldots; v
k
)
2
C
a
and every
(
b; u
2
;:::;u
k
)
2
C
b
,
(
v
2
;:::;v
k
)
and
(
u
2
;:::;u
k
)
are connected
in
G
(
k
,
1)
.If
a
and
b
are not connected in
G
, we will take each vertex of
C
b
and
replace its first component with
a
. The resulting set of vertices is still a clique
of
G
(
k
,
1)
of the same size since the projections of
C
a
and
C
b
onto their last
(
k
,
1)
components are disjoint. ea replace
C
b
are indepen first vertex in a tuple
of size
k
,
a
. The tuple-verticies that begin with
a
must form a clique on the re-
maining
k
,
1
elements (and there are
l
k
,
1
of those by the induction). Further,
for some other prefix,
b
,if
(
a; b
)
2
G
, then the verticies prefixed by BOTH
a
and
b
must form a clique on the remaining verticies. That is, they must share
the cliques on
(
k
,
1)
-tuples. Therefore, if the prefixes are drawn from
m
verti-
cies, and the largest clique is
l
,then
m
,
l
edges are missing and
m
,
l
vertices
1
pf2

Partial preview of the text

Download Homework 4 Solutions - Algorithm Design and Analysis | CSE 202 and more Assignments Computer Science in PDF only on Docsity!

CSE 202 Homework 4 Network Flow and NP problem sample solutions

  1. Row-Column sums

Solution This problem can be solved using a straightforward application of network flows. Consider an n  n matrix with column sums of ci and row sums ri and unknown elements mi;j. Define a flow network in the following way: a source vertex s with edges to n verticies, vi , with capacities, ri. Similarly, define a sink vertex t with edges to n verticies ui with capacities ci. Then define n^2 verticies, xi;j , with edges (vi ; xi;j ) and (xi;j ; uj ) all of capacity k. An integral maximum flow on this network determines a solution to the matrix problem where the flow along (xi;j ; vi ) = (xi;j ; uj ) = mi;j. (Note that since all capacities are integers the flow algorithms discussed in CLR will return integral flow values) Proof: First, consider a solution to the row-column sum problem. This is a valid flow since no capacities are exceeded:

P

i mi;j^ =^

P

i f^ (xi;j^ ;^ vi^ )^ =^ ri^ which is the capacity of all (only one) inputs to vi (similarly for the columns). Further, all mi;j < k , and all flows (vi ; xi;j ) < k and (xi;j ; uj ) < k , so these flows are not exceeded. Second, there exists a cut in the network, G s with value

P

i ri^. Therefore, we have a valid flow and a cut of the same value and therefore each must be a max-flow/min-cut.

  1. Approximating MAX-CLIQUE; CLR 37-2, p. 984

Part (a) proof: Let G = (V ; E ). First, we demonstrate a clique in G(k^ )^ of size l k^ where l is the size of the maximum clique in G. Consider the set of verticies, C 0 = f(v 1 ; v 2 ; : : : ; vk ) : vi 2 C g, where C is a maximum clique in G. Each vertex in C 0 is adjacent to every other vertex since for (v 1 ; : : : ; vk ) and (u 1 ; : : : ; uk ) an edge exists if any ui 6 = vi. The size of C 0 is l k^ and forms a clique in G(k^ )^. We show that there is no larger clique inductively. First, since G (1)^ = G, it is clear for k = 1. Now, assume it is true for all i < k. Consider a largest clique C k in G(k^ )^. Let Ca = f(a; v 2 ; : : : ; vk )j(a; v 2 ; : : : ; vk ) 2 C k^ g for a 2 V. By induc- tion, jCa j  l k^ ^1. For a 6 = b, either (a; b) 2 E or for every (a; v 2 ; l dots; vk ) 2 Ca and every (b; u 2 ; : : : ; uk ) 2 Cb , (v 2 ; : : : ; vk ) and (u 2 ; : : : ; uk ) are connected in G(k^ 1)^. If a and b are not connected in G, we will take each vertex of Cb and replace its first component with a. The resulting set of vertices is still a clique of G(k^ 1)^ of the same size since the projections of Ca and Cb onto their last (k 1) components are disjoint. ea replace Cb are indepen first vertex in a tuple of size k , a. The tuple-verticies that begin with a must form a clique on the re- maining k 1 elements (and there are l k^ ^1 of those by the induction). Further, for some other prefix, b, if (a; b) 2 G, then the verticies prefixed by BOTH a and b must form a clique on the remaining verticies. That is, they must share the cliques on (k 1)-tuples. Therefore, if the prefixes are drawn from m verti- cies, and the largest clique is l , then m l edges are missing and m l vertices

must share (k 1)-tuple cliques with another vertex giving us a maximum of m (m l )  l (k^ 1)^ = l  l (k^ 1)^ = l k^ verticies in the k -tuple clique.

Part (b)

Given an polynomial c-approximation for MAX-CLIQUE, we can generate a e (for any constant e) approximation by running it on graph G (k^ )^ , where e > c^1 =k and then taking the k -th root of the answer returned. This remains polyno- mial time because the problem is only blown up by a polynomial factor, k = l g (c)=l g (e) which is a constant.