Assignment #6 CS4/531, Fall 2023
Assignment #6 CS4/531, Fall 2023
Note: You are permitted to consult websites to find solutions. If you do so, you MUST
disclose this information, by disclosing the http address of the documents you used. If you
don’t and get caught, it will be considered cheating. If you do disclose the website, no
penalty will be given. However, you must make sure you really understand the solution
in this case. I may ask you detailed questions about the solution. If you cannot answer, it
will be considered cheating also.
If you do so, you MUST disclose this information, by disclosing the http address of the
documents you used. If you don’t and get caught, it will be considered cheating. If you
do disclose the website, no penalty will be given. However, you must make sure you really
understand the solution in this case. I may ask you detailed questions about the solution.
If you cannot answer, it will be considered cheating also.
Even though you are permitted to do so, it is NOT a good idea to do it, for the following
reasons:
1
– You spend lots of time searching Internet, not knowing if you can find anything. Even
when you find something, you need to make sure the problem you find is indeed the
problem in our HW.
– Quite often, the solutions you find are wrong and you do not know. In that case, for
sure you cannot explain it as you take a wrong solution as a correct one. Then, it is
automatically cheating.
– When you try to solve a problem by yourself, you will go through the thinking process,
and know what work and what do not. This process is very important for learning
algorithms. Exams may contain problems similar to homework problems. If you went
through the thinking process, it is easier to find similar solutions. If you get your
solution from a website, you forfeit this advantage. It will be harder to find solutions
for similar problems quickly in exams.
1. (2+3 = 5 points)
(a) State 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).)
(b) State 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 c′ (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 c′ (∗).
2
• The hospital needs to assign one doctor to work on each vacation day.
Describe a polynomial time algorithm that determine whether all above requirements can
be satisfied. (Hint: Convert it to a max-flow problem.)
Note: This is very similar to the Ad assignment problem we discussed in class.
For each pixel i, we have a likelihood ai that it belongs to the foreground; and a likelihood bi
that it belongs to the background. The values of ai and bi are determined by other means. For
us, they are just non-negative numbers provided as part of the input. They simply specify how
desirable it is to have pixel i in the background or foreground.
In isolation, we would want to label all pixel i as belonging to foreground if ai > bi , and
background otherwise. However, decisions that we make about the neighbors of i should also
affect our decision about i. If many of i’s neighbors are labeled ”background”, for example, we
should be more inclined to label i as background too. Thus, for each pair (i, j) of neighboring
pixels i and j, there is a separation penalty pij ≥ 0 for placing one of i and j in foreground and
another in background. Now we can specify our problem formally as follows:
Input: An undirected graph G = (V, E). Each vertex i ∈ V is associated with two numbers
ai ≥ 0 and bi ≥ 0. Each edge (i, j) ∈ E is associated with one number pij ≥ 0.
Goal: Partition V into two subsets A and B (A and B are the foreground and background
pixels, respectively), so as to maximize the following quantity:
X X X
q(A, B) = ai + bj − pij
i∈A j∈B
(i, j) ∈ E
one of i, j is in A, another is in B
3
Thus we are rewarded for having high likelihood values and penalized for having pairs (i, j)
with one pixel in A and another pixel in B.
Describe how to solve this problem by using max-flow/min-cut techniques.
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.
4. (7 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 2 is an eye-glass graph of 8 vertices.
Consider the following problem: Given an undirected graph G = (V, E) and a number 2n,
decide if G has an eye-glass graph of order 2n as a subgraph.
Show this problem is NP-complete.
6. (7 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 discussed in class that HC problem is NP-complete. Show HP-problem is NP-complete,
by showing that HC ≤P HP .
7. (0 points) Input: A set S and a collection {S1 , S2 , . . . , Sm } of subsets of S. (Namely each Si
is a subset of S), and an integer k.
4
Question: Is there a subset X ⊆ S so that |X| ≤ k and, for each Si (1 ≤ i ≤ m), Si and X
have at least one common element?
Interpretation: S= the set of UB students. Each Si (1 ≤ i ≤ m) is a student club. We want
to select a committee X so that X consists of at most k students, and each club Si has at least
one member in the committee (if a student belongs to more than one club, then he can represent
all clubs he belongs to). Is this possible?
Show Hitting Set Problem is N P-hard.
8. (4 points) Briefly answer the following questions.
(a) For NP-Complete theory, we consider decision problems only. What are they? Why we
consider these problems only? With this restriction, would NPC-theory not applicable to
general optimization problems?