COMS 482: unofficial class blog

Lecture 21: NP-Complete Problems

Posted in Class Notes by Elliott Back on March 11th, 2005.

Independent Set Problem:

Given a graph G, find a maximal set of vertices that are independent. Here you see two independent sets of size 2 and 3. The largest set is colored:

Independent Set

We can restate the independent problem:

Given G and k, does G have an independent set of size >= k?

If we had a good algorithm for either of the two statements, we could easily answer either of them. We think of Independent Set as the set of all problem instances (as above) for which we answer “yes” or “no”:

Independent Set = {(G,k) | G has an independent set of size >= k}

To say “An algorithm a(.) solves problem A” means “A = {s | a(s) reports yes.”

Graph Path Length:

B = {(G,s,t,k) | graph G has an s-t path of length <=k}

b(G,s,tk):
    Label each node with its distance from s using BFS starting from s
    if labelt <=k report “yes” else report “no”

This runs in time O(m+n), or polynomial time.

Definition: Polynomial time problem, P = {A | There exists an algorithm a(.) and a polynomial p(x) such that a(.) solves A and a(s) runs in time O(p(|s|)).

Definition: We use A <=p B to mean that A can be solved in polynomial time by using a pretend “free” subroutine for B. You can also say, “A reduces to B” or “A is reducible to B.”

Problem Transformations

Here are two rules for reducibility:

  • A <=p B, B in P -> A in P
  • A <=p B, A not in P -> B not in P

Vertex Covers:

A vertex cover for a graph G is a set of vertices such that each edge of G has an endpoint in the set. Using the previous graph from the independent set problem, the vertex cover is denoted by boxed nodes:

A vertex Cover

Given (G,k) is there a vertex cover of size <=k? Independent set <=p vertex cover. Theorem: G=(V,E). S <= V is an independent set iff V-S is a vertex cover. Therefore, the vertex cover problem is also NP-Complete.

This entry was posted on Friday, March 11th, 2005 at 5:07 pm and is tagged with independent set problem, amp nbsp, polynomial time, problem instances, independent problem, time definition, independent sets, time problem, path length, vertex, vertices, endpoint, subroutine, algorithm, graph, lt, node, tk, np. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.

Leave a Reply

Powered by WP Hashcash