0% found this document useful (0 votes)
240 views6 pages

Assignment #6, CS4/531

This document contains instructions for Assignment #6 in CS4/531. It states that the homework must be submitted by 11:59pm on December 12th and will not be accepted late. It then provides 4 problems related to graph theory and algorithms. It asks the student to determine if certain statements about flows in networks and minimum cuts are true or false, and provides examples. It also asks the student to describe algorithms for solving problems related to minimum path covers and graph edge coloring.

Uploaded by

Nikhil Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
240 views6 pages

Assignment #6, CS4/531

This document contains instructions for Assignment #6 in CS4/531. It states that the homework must be submitted by 11:59pm on December 12th and will not be accepted late. It then provides 4 problems related to graph theory and algorithms. It asks the student to determine if certain statements about flows in networks and minimum cuts are true or false, and provides examples. It also asks the student to describe algorithms for solving problems related to minimum path covers and graph edge coloring.

Uploaded by

Nikhil Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment #6, CS4/531

Solution
Due Date: Sat Dec. 12, 2020
Total points: 44

• You MUST turn in your HW by 11:59pm on Dec 12. After that, I will NOT accept your
HW. This rule will be STRICTLY ENFORCED.

1. (0 points) Describe if the following statement is true or false. If it is true, give a short
explanation. If it’s false, give a counter example.

Let G be a (basic) flow-network with source s and sink t. Each directed edge e of G
has a positive integer capacity c(e). If f is a max-flow of G, then f saturates every
edge out of s. (Namely, for every edge e = s → v, f (e) = c(e).)

False. The following Fig shows a counter example.

1/2 1/1

s t

Figure 1: A Counter example for Problem 1.

2. (4 points) Describe if the following statement is true or false. If it is true, give a short
explanation. If it’s false, give a counter example.

Let G be a (basic) flow-network with source s and sink t. Each directed edge e of G
has a positive integer capacity c(e). Let (S, T ) be a minimum capacity st-cut with
respect to the capacity function c(∗). Now suppose that we add 1 to the capacity of
every edge e. Namely, we define a new capacity function c0 (e) = c(e) + 1 for every
edge e in G. Then (S, T ) is still a minimum capacity st-cut of G with respect to the
new capacity function c0 (∗).

False. The following Fig shows a counter example. In this Figure, the integer next to each edge
is the capacity of the edge. The min-cut of G is: S = {s, a} and T = {b, c, d, t}. The capacity
of the cut is c(S, T ) = 3.
After the capacity of each edge is increased by one, the new min-cut is: S 0 = {s} and
T = {a, b, c, d, t} with capacity c0 (S 0 , T 0 ) = 5.
0

3. (0 points) Minimum Path Cover (MPC) Problem


Let G = (V, E) be a directed graph. A path cover of G is a set P of vertex disjoint paths
such that every vertex in V is included in exactly one path in P . Paths in P may start and
end anywhere, and they may be of any length (including 0, namely a path consisting of a single
vertex). A minimum path cover of G is a path cover containing the fewest possible paths.
Example: Suppose G = (V, E), where V = {a, b, c} and E = {a → b, a → c}. Then a MPC
of G is: P = {P1 , P2 }, where P1 = a → b, and P2 = c (a path of a single vertex c).
MPC Problem: Given a directed graph G, find a MPC of G.
This problem for a general directed graph is NPC. However, if G = (V, E) is acyclic, the
problem can be solved by using max-flow technique as hinted below (assuming V = {1, 2, . . . , n}):

1
b
1
1
4 1 c 1 t
s a
1 1
d
Figure 2: A Counter example for Problem 2.

Construct a (basic) flow network G0 = (V 0 , E 0 ) as follows:


V 0 = {x0 , x1 , . . . , xn } ∪ {y0 , y1 , . . . , yn }, where x0 is the source and y0 is the sink.
E 0 = {x0 → xi | i ∈ V } ∪ {yi → y0 | i ∈ V } ∪ {xi → yj | i → j ∈ E}; all edges in E 0 have
capacity 1.
Describe, once you get the max-flow for G0 , how to solve the corresponding MPC problem.
Note 1: First try to solve the problem on a small graph using the method described in the
problem definition. This will help you to guess the correct solution.
Note 2: The Hamiltonian Path (HP) problem (as defined in Problem 6 below) is a special
case of the Minimum Path Cover problem. Can you see it? The HP problem for general directed
graphs is NP complete. So the above method for solving the MPC problem does not work for
general directed graphs G (namely, G may have directed cycles). Although not required, you
should think about why the method above does not work for general case.
Answer: Let G = (V, E) be a directed acyclic graph. Assume that V = {1, 2, . . . , n}, construct
the graph G0 = (V 0 , E 0 ), where

V 0 = {x0 , x1 , . . . , xn } ∪ {y0 , y1 , . . . , yn }

E 0 = {(x0 , xi ) : i ∈ V } ∪ {(yi , y0 ) : i ∈ V } ∪ {(xi , yj ) : (i, j) ∈ E}.


We set the capacity of each edge to 1.
Consider any path cover C of G. From C, we can construct a flow function f of G as follows.
Let P1 = i1 → i2 → . . . → ik be a path in the path cover C. For each edge in the following
paths in G0 , we set the flow value to be 1:

x0 → xi1 → yi2 → y0
x0 → xi2 → yi3 → y0
..
.
x0 → xik−1 → yik → y0

Continue this until all paths in C are processed. All other edges of G0 have flow value 0. This
completes the construction of flow function f .
Note that under this construction, the vertices in {x1 , . . . , xn } without incoming flow corre-
spond to the ending vertices of paths in the path cover C. So the number of path cover equals
to n − (the value of flow f ). Thus in order to find a minimum path cover C of G, we can first
find a maximum flow f of G0 , then construct a path cover C corresponding to f as described
above. C would be a minimum path cover of G.

2
4. (2+3+2+3=10 points). The Graph Edge Coloring (GEC) problem is defined as follows.
The input is an undirected graph G = (V, E) with n vertices and m edges. An edge coloring
of G is an assignment of colors to the edges of G so that for any two edges e1 , e2 , if e1 and e2
share a common end vertex, then e1 and e2 must have different colors. The problem is: Given
G, determine the smallest integer k such that G has an edge coloring using k colors.
(a) Describe the decision version of the GEC problem.
(b) Suppose that we have an algorithm A for solving the decision version of the GEC problem
with run time T (n, m). Describe an algorithm B for solving the optimization version of the GEC
problem. Analyze the run time of B (in terms of T (n, m).)
(c) What is the “certificate” of the GEC problem?
(d) Consider the following Time Table (TT) problem. In a school, there are p teachers
X1 , X2 , . . . , Xp and q classes Y1 , Y2 , . . . , Yq . For each i (1 ≤ i ≤ p) and j (1 ≤ j ≤ q), the teacher
Xi meets the class Yj tij times. Obviously, during any period, each teacher can meet only one
class, and each class can meet only one teacher. The problem is to schedule a complete timetable
using the minimum possible number of periods.
Describe how to convert the TT problem to the GEC problem.
Answer: (a) The decision version of the GEC problem is: Given G and an integer k, determine
whether G has an edge coloring using at most k colors.
(b) Let OP T be the smallest integer such that G has an edge coloring using OP T colors.
Clearly 1 ≤ OP T ≤ m. We use binary search to find the value OP T as follows.
B(G, p, q)
1 if p = q
2 then return p
3 i ← b p+q
2 c
4 if A(i) return YES
5 then return B(G, p, i)
6 else return B(G, i + 1, q)

The initial call should be B(G, 1, m). Since the algorithm A solves the decision version of
the GEC problem in T (n, m) time, the running time of B would be O(T (n, m) log m).
(c) The “certificate” of the GEC problem is a m-vector (c1 , c2 , . . . , cm ) where 1 ≤ ci ≤ k for
each 1 ≤ i ≤ m. (The meaning of the certificate: ci is the color of the edge ei ).
(d) Given p teachers X1 , X2 , . . . , Xp and q classes Y1 , Y2 , . . . , Yq , we construct a graph G as
follows. For each teacher, we create a vertex ti and for each class, we create a vertex cj . Then
for each ti (1 ≤ i ≤ p) and cj (1 ≤ j ≤ q) pair, we create tij edges between them. Let T be
a valid timetable, then we can color the edges corresponding to the meetings in a class period
with the same color. Clearly we get an edge coloring for G. Let C be an edge coloring of G,
then all class meetings corresponding to the edges with the same color can be scheduled in one
class period. Thus the problem of finding a class time table using the minimum possible number
of class periods is exactly the minimum GEC problem on G.

5. (6 points) An eye-glass graph of order 2n is a graph consisting of two cycles (each with n
vertices) connected by an edge. The graph shown in Figure 3 is an eye-glass graph of 8 vertices.
Consider the following problem: Given an undirected graph G = (V, E) and an even integer
2k, decide if G contains an eye-glass graph of order 2k as a subgraph.
Show this problem is NP-complete.
Answer: First, we need to show it is in NP. We can do this by using the following non-
deterministic algorithm:

3
Figure 3: The eye-glass graph of 8 vertices.

1. Non-deterministically generate a sequence v1 , v2 , . . . , vk , v1 , v10 , v20 , . . . , vk0 , v10 .


2. Check that this sequence corresponds to an eye-glass graph. Namely, we need to check
that: v1 → v2 → . . . → vk → v1 is a cycle in G; that v10 → v20 → . . . → vk0 → v10 is a cycle in G;
and (v1 , v10 ) is an edge in G.
Clearly this takes polynomial time.
Second, we reduce from Hamiltonian Cycle (HC) problem. Namely we show HC≤P Eye-
Glass. (Since HC is NPC, this reduction would imply that Eye-Glass is also NPC). Given an
instance G = (V, E) of HC problem, we construct an instance (G0 , 2k) as follows:
G0 = (V 0 , E 0 ) consists of two copies of G and an additional edge connecting two vertices of
the two copies. More precisely, if V = {v1 , v2 , . . . , vn }, then V 0 = {u1 , . . . , un , w1 , w2 , . . . , wn }.
And (ui , uj ) ∈ E 0 if (vi , vj ) ∈ E; (wi , wj ) ∈ E 0 if (vi , vj ) ∈ E; (u1 , w1 ) ∈ E 0 .
Now set k = |V | = n. Then (G0 , 2n) is an input for Eye-Glass problem.
Clearly, G0 contains 2n vertices. The construction of G0 from G can be done in O(n + m)
time. It is also clear that G has a HC iff G0 has a eye-glass graph of size 2n.
Thus, this construction shows HC≤P Eye-Glass.

6. (8 points) Let G = (V, E) be an undirected graph. A Hamiltonian Path (HP) of G is a


path that visits each vertex of G exactly once. A Hamiltonian Cycle (HC) of G is a cycle
that visits each vertex of G exactly once.
The Hamiltonian Cycle (HC) problem is: Given an undirected graph G, decide if G has a
Hamiltonian Cycle or not. The Hamiltonian Path (HP) problem is: Given an undirected graph
G, decide if G has a Hamiltonian path or not.
We know that HC problem is NP-complete. Show HP-problem is NP-complete, by showing
that HC ≤P HP .

Answer: Given an undirected graph G = (V, E), we construct another undirected graph G0 as
follows. We add a new vertex s and connect s to a vertex v ∈ V . Then we add two other new
vertices t and t0 , and connect t0 to all neighbors of v and t to t0 (see the figure below.)
Clearly this constructions takes O(|V | + |E|) time. We need to show that G has a HC if and
only if G0 has a HP.
If G has a HC C = vu1 u2 . . . un−1 v, then both u1 and un−1 are the neighbors of v, thus both
are connected to t0 . So s → v ; un−1 → t0 → t is a HP of G0 . (Here, ; denote a path that
may contains more than 1 vertices.)
If G0 has a HP, the two end vertices must be s and t, i.e., s → v ; w → t0 → t, because s
and t only have one adjacent edge. Then v ; w → v is a HC of G.

7. (8 points) The Traveling Salesman Problem (TSP) has been defined in class. The TSP

4
s

v
t
G G’ t’

Figure 4: HC ≤P HP reduction

problem with triangle inequality, denoted by TSP∆, is a restricted version of the TSP problem:
it requires that the edge weight function w satisfies the triangle inequality. (Namely, for any
three vertices u, v, w of G, w(u, v) + w(v, w) ≥ w(u, w).)
Show that TSP ≤P TSP∆. (Since TSP is NP-complete, this reduction implies that TSP∆
is also NP-complete).
Hint: You need to show that in polynomial time we can transform an instance G of the
TSP problem into another instance G0 that satisfies the triangle inequality. This can be done
by adding a large number K to the weight of every edge of G.
Answer: Let (G, w(∗, ∗), K) be an instance of TSP, where G = (V, E) is a complete graph
consisting of n vertices, w(∗, ∗) is the edge weight function, and K is a number. (So the question
is: does G has a HC with total weight ≤ K). We construct an instance (G0 , w0 (∗, ∗), K 0 ) of TSP∆
as follows.

• G0 is exactly the same as G.

• Let M be the maximum weight of all edges in G. (Namely M = max(i,j)∈E {w(i, j)}).
Define w0 (i, j) = w(i, j) + M for all (i, j) ∈ E.

• Set K 0 = K + M × n.

The time for constructing (G0 , w0 (∗, ∗), K 0 ) is clearly O(n2 ). So this is a polynomial-time
algorithm. To complete the proof, we need to show two things.

Claim 1: (G0 , w0 (∗, ∗), K 0 ) is an instance of TSP∆. Namely we need to show w0 (∗, ∗) satisfies
the triangle inequality.
Proof: Consider any three vertices x, y, z. We have:

w0 (x, z) = w(x, z) + M ≤ w(x, z) + M + w(x, y) + w(y, z) (since weights are non-negative)


≤ M + M + w(x, y) + w(y, z) (since M is the maximum weight)
= (w(x, y) + M ) + (w(y, z) + M )
= w0 (x, y) + w0 (y, z)

Claim 2: G has a HC C with weight ≤ K iff G0 has a HC of C 0 with weight ≤ K 0 .


Proof: This claim follows directly from the following facts:

• C is a HC of G iff C is an HC of G0 , as G and G0 are the same graph.

• w0 (C) = w(C) + nM , as C contains n edges and for any edge e we have w0 (e) = w(e) + M .

5
• So C is a HC of G with weight w(C) ≤ K iff C is a HC of G0 with weight w0 (C) =
w(C) + nM ≤ K + nM = K 0 .

8. (8 points) The SAT problem is defined as follows:


Input: A CNF Boolean formula F with variables x1 , . . . , xk .
Output: “yes” if F is satisfiable; “no” otherwise.
The Constructive-SAT problem is defined as follows:
Input: A CNF Boolean formula F with variables x1 , . . . , xk . Output: If F is satisfiable, find
a boolean assignment of x1 , . . . , xk (namely, specifically assign 0 or 1 to each variable xi ) so that
F evaluates 1.
If F is not satisfiable, output “no”.
Note that the Constructive-SAT problem is not a decision problem.
Assume that we have an algorithm A for solving the SAT problem. Describe an algorithm
B for solving the Constructive-SAT problem by calling A polynomially many times.
Hint: The algorithm B goes through a loop. Each iteration i try to find a correct 0/1 value
for variable xi .
Answer: First we define some symbols. Let F be a boolean formula with variables x1 , . . . , xk .
F (x1 = 0) denotes the formula resulting from F after setting x1 = 0. Similarly F (x1 = 1)
denotes the formula resulting from F after setting x1 = 1. For example, if

F = (x1 ∨ x̄2 ∨ x̄3 ) ∧ (x̄1 ∨ x2 ∨ x̄4 )

then
F (x1 = 0) = (0 ∨ x̄2 ∨ x̄3 ) ∧ (1 ∨ x2 ∨ x̄4 ) = (x̄2 ∨ x̄3 ) ∧ 1 = (x̄2 ∨ x̄3 )
and
F (x1 = 1) = (1 ∨ x̄2 ∨ x̄3 ) ∧ (0 ∨ x2 ∨ x̄4 ) = 1 ∧ (∨x2 ∨ x̄4 ) = (x2 ∨ x̄4 )
B(F )
1 if A(F ) returns NO
2 then output “F is not satisfiable” and stop.
3 for i = 1 to k:
4 do
5 F0 = F (xi = 0); F1 = F (xi = 1);
6 if A(F0 ) returns YES
7 then xi = 0; F = F0 ;
8 else xi = 1; F = F1 ;
9 end for

The loop iterates k times. F0 and F1 are obtained from F by plugging in xi values, so it can
be done in time linear of the size of the formula F . Thus algorithm takes polynomial time.

You might also like