sql by dheerajkushwaha

VIEWS: 13 PAGES: 3

More Info
									Solutions for Homework #1 in Design and Analysis of Algorithms
Question 1
                                                                   ¯       ¯
 (a) Given a graph G = (V, E), define the complement graph G = (V, E) to be the graph over
                                      ¯
     the same vertex set V , where E = {(u, v) : (u, v) ∈ E}. Let V C ⊆ V be a vertex cover in
                                                           /
      ¯ Then C = V \ V C is a clique in G. This is true because there cannot be any edges in G
     G.                                                                                         ¯
     between any two vertices in V \ V C (or else, V C would not be a vertex cover).
                                                                 ¯
     We next argue that if V C is a minimum vertex cover in G then C = V \ V C is a maximum
     clique in G. To see why this is true, assume, contrary to the claim, that there exists a set
     C ⊆ V that is a clique in G such that |C | > |C|. But then, V C = V \ C is a vertex cover
         ¯                              ¯
     in G (as there are not edges in G between pairs of vertices that are both in V \ V C = C ).
     But |V C | = |V | − |C | < |V | − |C| = |V C|, and we reach a contradiction.
     Therefore if we have an algorithm for solving the minimum vertex-cover problem that runs in
     time T (n), and we wanted to find a maximum clique in a graph G, we would do the following.
                                                     ¯
     We would create the complementary graph G (taking time O(n)), and run the minimum
                                ¯ Given its outputs V C, we would output C = V \ V C. The total
     vertex-cover algorithm on G.
     running time is T (n) + O(n2 ). In particular, if T (n) were a polynomial in n we would get a
     polynomial-time algorithm. The argument for the other direction (from maximum clique to
     minimum vertex cover) is analogous.

 (b) Unfortunately, the 2-approximation algorithm for the minimum vertex cover problem does
     not help us in approximating the maximum clique. To illustrate this, consider for example
     the case in which a graph G has a maximum clique of size |V |/2. Then we know that the
     complement graph has a minimum vertex cover of size |V |/2 as well. But the approximation
     algorithm provides a cover which is at most twice this size, and in the worst case may be of
     size |V | (that is, it contains all vertices). The complement of this set of vertices is the empty
     set, having size 0, which gives no information about the size of the clique. More generally,
     if C ∗ is a minimum vertex cover in the complement graph (so that the size of the maximum
     clique in G is |V | − |C ∗ |), then the approximation ratio we get for the clique is

                                       |V | − |C ∗ |          |C ∗ |
                                                     =1+
                                      |V | − 2|C ∗ |     |V | − 2|C ∗ |

     which depends on the relation between |V | and |C ∗ | and is not constant. Furthermore, it
     does not necessarily give any non-trivial ratio (note that we can always get an approximation
     ratio of say |V |/2 by finding some edge in the graph (which is a clique of size 2 while the
     maximum clique has size at most |V |)).

Question 2
I’ll first give my original solution, and then note that there is a simpler (stronger) lower bound of
m
 d that I somehow overlooked.
    As advised, we consider the approximation algorithm described in class. As we have shown, the
set of edges that the algorithm selects (where it adds both their end-points to the vertex cover)
is a maximal matching. This implies that every vertex cover must contain at least one of the end

                                                  1
points of each of the edges in the matching. Hence, the size of a minimum vertex cover is at least
the size of the matching (the number of edges in the matching). Therefore, it suffices to show that
                                                                      m
the size of the maximal matching found by the algorithm is at least 2d−1 .
    The main observation is that for every edge that we include in the matching, we remove from
the graph at most 2(d − 1) edges. The reason is that when we take an edge (u, v), then we remove
all other edges incident to u and to v. Since u and v have degree at most d and the edge (u, v) is
incident to both vertices, the total number of these removed edges is at most 2(d − 1). In other
words, at least one out of every 2(d − 1) + 1 = 2d − 1 edges is included in the matching. Since there
are m edges, the claim follows.
    To get the lower bound of m (that is at least as good as 2d−1 for every d ≥ 1) we observe that
                                d
                                                              m

since every vertex can cover at most d edges, and we must cover m edges, the total size of the cover
cannot be less than m (or else, some edge would not be covered).
                     d


Question 3
  1. Clearly the set of internal vertices C covers every edge that is adjacent to an internal vertex.
     What about edges adjacent to leaves of the tree (which are not included in the cover)? Every
     edge that is between a leaf and an internal vertex is covered by the corresponding internal
     vertex. Thus it remains to consider edges between leaves. But by definition of a DFS, there
     are no such edges: Assume in contradiction that there is an edge between leaf v and leaf w.
     Assume without loss of generality that v is visited before w by the DFS. But then, if there is
     an edge between v and w, then the DFS would go from v to w, in contradiction to what we
     know about the structure of the tree.

  2. As instructed, we show that there exists a matching M in G of size at least |C|/2. As argued
     in the analysis of the algorithm we saw in class, OPT ≥ |M |, and so this suffices for proving
     the factor 2 approximation.
      To obtain such a matching, we show that there exists a matching in which all internal vertices
      of the DFS tree T are matched (and some leaves may be matched as well). Since each edge
      consists of two vertices, the size of this matching must be at least |C|/2. This can be proved
      by induction on |C|. If |C| = 1, then there is a single internal vertex, and we can match it to
      any of its children (so the matching is over 2 vertices). (Recall that in the question we said
      that the number of vertices in the graph is at least 2).
      For the induction step, consider any tree with |C| > 1 internal vertices. Let us match the
      root with one of its children (selected arbitrarily), and remove the edge between them from
      the graph. We now remain with a forest of some k ≥ 1 trees T1 , . . . , Tk , where each internal
      vertex in the original tree is an internal vertex in one of these trees, and the number of internal
      vertices Ci in each of these trees is less than |C| (actually, at most |C|−2). We can thus apply
      the induction hypothesis on these trees and obtain a matching over at least 2 + i |Ci | = |C|
      vertices, as required.

Question 4
We shall generalize the algorithm for vertex cover (where there the sets are of size 2 - that is, edges).


                                                   2
   • Initialize H ← ∅, U ← F.

   • While U = ∅ do:

        – Select (arbitrarily) some set Si ∈ U;
        – H ← H ∪ Si ;
        – U ← U \ {Sj : Si ∩ Sj = ∅}

   • Return H.

    Clearly the running time of the algorithm is polynomial in n and m since there are at most
m iterations, and each takes at most O(n2 m) steps (the exact running time depends on the data-
structures used (and may indeed be (much) better)).
    We next prove that under the assumption that for every set Si , |Si | ≤ k, we get that |H| ≤
k · OP T where OP T is the size of the minimum hitting set.
    Let be the number of iterations performed by the algorithm, and let Si1 , . . . , Si be the sets
selected by the algorithm (where Sit is selected in iteration t). We first observe, that by definition
of the algorithm, all these sets are pairwise disjoint. To verify this observe that when Sit is selected,
the current H, which is simply t <t Sit does not intersect it (so that none of the sets Sit , t < t
intersect it). This implies that OP T ≥ (since it must select at least one element from each of
the sets Si1 , . . . , Si to “hit” that set, and these elements must all be different from each other
because these sets are disjoint). On the other hand, since H = t=1 Sit , and |Sit | ≤ k, we get that
|H| ≤ · k, and the approximation factor follows.




                                                   3

								
To top