CISC 320 Algorithms, Fall 2007
Homework set #6, due Wed, Dec. 5.

  1. This question concerns two algorithms proposed for the Independent Set problem.
    Input: number k and graph G given by A, array of adjacency lists.
    Output: true if G has an independent set of size at least k, else false.
    1. Algorithm 1:
      [ "Greedy" idea: Take a vertex with fewest neighbors. Put it in indep set. Delete it and all it's neighbors from graph. Continue using the vertex with next lowest number of neighbors, etc.]
      1.
      Sort the vertices by number of neighbors.  Let array v denote the sorted vertices.  
      In other words, if i < j, then v[i] is connected to fewer or the same number of nodes as v[j] is connected to.
      
      2.
      Let ans[] be an array of characters with each ans[i] being one of the three values:
        'y', meaning "in the indep set", or 
        'n', meaning "not in the indep set", or 
        'u', meaning "currently undecided".
      
      At the end all ans[i] will be 'y' or 'n', thus indicating the independent set.
      Initially set all ans[i] to 'u'.
      
      // greedily choose an independent set.
      3. for i = 1 to n do
           if ans[i] == 'u',
             set ans[i] to 'y'
             for all j in A[i] (adjacency list of i), set ans[j] to 'n'.
      
      4. count the number of 'y' in ans.  If it is k or greater return true, else return false.
      

      A little study of algorithm 1 reveals that it runs in polynomial time and that the 'y's in ans[] identify an independent set. However, it does not always find an independent set of maximum size. Give an example graph G and integer k to show that the algorithm does not always return the correct answer for the Independent Set problem. Explain what the algorithm returns for your graph and what larger independent set exists for your graph.

    2. Algorithm 2 (dynamic programming):
      if Opt(V) >= k, return true, else return false, 
      where, for any subset S of V (including V itself), 
      Opt(S) denotes the size of a largest independent set within subset S. 
      
      Label the vertices 1 to n. Suppose j is the largest vertex label in S. Either vertex j is in a maximal independent set of S or it is not, so Opt(S) satisfies this basic recursion: In general, for nonempty S, Opt(S) = max(1 + opt(S-Nbhd(j)), opt(S-{j})), and there is the base case Opt(empty set of vertices) = 0. Here S-{j} denotes the subset of S obtained by removing vertex labeled j. and S-Nbhd(j), denotes the subset of S obtained by removing j and any of it's neighbors (vertices having an edge to j) in S.

      Opt can be memoized. For instance, let subsets S be denoted by the n-bit number whose i-th bit is 1 if and only if vertex i is in S. With that notation, a memotable M can be used. M[S] = maximal independent subset of S or M[S] = empty, if not yet computed for S. Thus the following function f computes Opt.

      f(S)
      { // M has been initialized to all an all empty array
      if M[S] is empty and n (number of vertices in S) is 0 or 1, M[S] = size of S;
      else M[S] = max(1 + M[S-Nbhd(j)], M[S-{j}]);
      return M[S];
      }
      
      Using f to compute Opt, algorithm 2 is then clearly a correct dynamic programming algorithm for IS. Explain why Algorithm 2 does not run in polynomial time.

  2. Exercise 8.1

  3. Exercise 8.2 or 8.3 (your choice, but chose only one).

  4. Extra credit: Exercise 8.8. [Hint: section 8.6]