NATIONAL UNIVERSITY OF SINGAPORE School of Computing Sample Final Examination for

NATIONAL UNIVERSITY OF SINGAPORE
School of Computing
Sample Final Examination for
Semester 1 AY2013/14
CS5234—Combinatorial and Graph Algorithms
November, 2013
Time Allowed: As much as you like.
INSTRUCTIONS TO CANDIDATES
1. This exam contains XXX questions and comprises YYY printed pages, including this page and four
pages of scratch paper.
2. The exam is closed book. You may bring two double-sided sheet of A4 paper to the quiz. (You may
not bring any magnification equipment!) You may not use a calculator, your mobile phone, or any
other electronic device.
3. Write your solutions in the space provided. If you need more space, then use the scratch paper at the
end of the exam.
4. Show your work. Partial credit will be given.
5. Be neat. If I cannot read your solution, then I cannot give you credit for it.
6. You may use (unchanged) any algorithm or data structure given in class. You do not need to restate
the algorithm. If you modify the algorithm, you must explain exactly how your version works.
7. Draw pictures frequently to illustrate your ideas.
MATRICULATION NUMBER:
Problem #
Name
Possible Points
1
Linear Programming
0
2
Elbonian Secrets
0
3
Trust but Verify
0
4
Bipartite Vertex Cover
0
4
Clustering
0
Total:
0
1
Achieved Points
Problem 1.
Linear Programming
Problem 1.a.
Write down a linear program consisting of five variables and four constraints.
Problem 1.b.
Find the dual of the linear program in part (a).
Problem 1.c.
The following is a linear program formulation of the MaxFlow problem. (Note
that it uses an exponential number of variables!) Given a graph G = (V, E) with capacities c,
source s, and target t, let P be the set of all paths in G from s to t. The variables in our program
our xp , i.e., one for each path.
P
maximize
p∈P xp
xp ≥ 0
P
subject to
∀e ∈ E,
p∈P :e∈p xp
Find the dual of this linear program.
2
≤ c(e)
Problem 1.d.
Assume that your dual program from the previous part consists of variables
y1 , y2 , . . . , ym , i.e., one per edge. Show that if you are given an st-cut of the graph G, and you assign each variable yj = 1 if it crosses the cut and yj = 0 otherwise, then the resulting assignment is
feasible for the dual. That is, show that the dual represents the maximum cut problem. This shows
that any cut gives an upper bound on the maximum flow. (In fact, you can round the solution
to the dual to generate a solution the maximum cut problem, thus proving the MaxFlow-MinCut
theorem via duality.)
3
Problem 2.
Elbonian Secrets
An enemy country, Elbonia, has n transmitter/receiver pairs (ti , ri ). You can model the position
of each ti and each ri as a point in the plane. Enemy communications travel along the straight-line
segment from ti to ri .
You can place eavesdrop units at any point in the plane, but a unit must be on the line segment
from ti to ri in order to eavesdrop successfully. If you put a unit at the intersection of two
such segments, that unit can eavesdrop on both transmitter/receiver pairs. Assume no three such
segments intersect at a point.
Your intelligence agency has given you a list of the coordinates of all n enemy transmitter/receiver
pairs. Briey describe a polynomial time algorithm for nding the minimum number of eavesdrop
units required to eavesdrop on all n transmitter/receiver pairs.
4
Problem 3.
Trust but Verify
Suppose someone presents you with a solution to a max-flow problem on some network. Give a
linear time algorithm to determine whether the solution does indeed give a maximum flow.
5
Problem 4.
Bipartite Vertex Cover
Assume you are given a bipartite graph G = (A, B, E) (where A and B are disjoint edge sets).
Give an efficient algorithm for finding the minimum vertex cover in G. (Hint: Think about how to
use maximum flow techniques to solve the maximum matching problem in a bipartite graph. Look
at the cut in the resulting graph, and relate it to the value of the maximum matching. Then build
a vertex cover that has the same size as the cut.)
6
Problem 5.
Clustering
In this problem, we will consider a set of points in a Euclidean space. If you are given a set S of
such points, we define the diameter of S to be the maximum distance between any two points in S:
diameter(S) = max |x − y|
x,y∈S
(Here, the notation |x − y| refers to the Euclidean distance between x and y.)
The problem of k-clustering is defined as follows:
Input: A set of points S = x1 , x2 , . . . , xn , where each point is in a Euclidean space.
Output: A partition of the points into k clusters C1 , C2 , . . . , Ck . (Recall that a partition
guarantees that for all points xi there exists a Cj such that xi ∈ Cj , and that for all clusters
Cj and C` , Cj ∩ C` = ∅.)
Objective: Minimize the diameter of the largest cluster, i.e., minimize:
max diameter(C` ) .
`∈{1,...k}
7
Problem 5.a.
Consider the following algorithm for 2-clustering:
1. Let y1 be an arbitrary point in S.
2. Let y2 be the point at maximum distance from y1 in S, i.e., the point that maximizes |y2 −y1 |.
3. For each point xj ∈ S, assign it to cluster C1 if it is closer to y1 than to y2 . Otherwise, assign
it to y2 . That is, let d1 = |xj − y1 | and d2 = |xj − y2 |. If d1 < d2 , then assign xj to C1 ;
otherwise assign xj to C2 .
Prove that this algorithm is a 2-approximation of the optimal 2-clustering. Hint: let y3 be the point
in S farthest from both y1 and y2 , and let d be minimum of |y3 − y1| and |y3 − y2 |. Bound the cost
of the algorithm and the cost of OPT with respect to d.
8
Problem 5.b.
Generalize the algorithm from the preceding part. Give an algorithm for kclustering (given any fixed value of k as part of the input). Specify its approximation factor.
Algorithm:
My algorithm is a
-approximation algorithm.
9
Scratch Paper
10
Scratch Paper
11
Scratch Paper
12
Scratch Paper
End of Exam
13