Presentation is loading. Please wait.

Presentation is loading. Please wait.

NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle

Similar presentations


Presentation on theme: "NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle"— Presentation transcript:

1 NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
Stephen Cook 1971 SAT Richard Karp 1972 3SAT Independent Set Hamiltonian Cycle Vertex Cover CLIQUE Traveling-Salesman Problem(TSP) Subset-Sum …… …… About 1000 NP-complete problems have been discovered since.

2 Independent Set Let G be an undirected graph. A  V(G) is an independent set if no two vertices in A share an edge.  u, v  A, (u, v)  E(G) Ex. b d g f c a e e d a g A = { a, d, e, g } is an independent set. B = { a, c, f } is not

3 The Independent-Set Problem
IND-SET Input: Graph G, integer K  1. Q: Does G have an independent set of size  K ? Theorem IND-SET is NP-complete. Proof  IND-SET  NP. Below is a non-deterministic algorithm: a) Pick K vertices from V(G) to form a subset A  V. non-deterministic O(K) time certificate b) Check if  u, v  A, (u, v)  E(G). If so answer Yes; otherwise, answer No. deterministic O(K ) time 2

4 3SAT ≤ IND SET P Therefore IND-SET is NP-complete. Proof (cont’d)
 We show that 3SAT is polynomial-time reducible to IND-SET. Construct (G , K) such that   3SAT  (G , K)  IND-SET.   This will follow from Lemma 1. Therefore IND-SET is NP-complete.

5 Constructing G  x  x  One vertex for each literal.
Ex.  = ( x  x   x )  ( x  x  x )  ( x  x   x ) x  x 1 2 3 4  One vertex for each literal.  Literals in the same clause form a triangle.  Opposite literals share edges.

6 Satisfiability vs. Independent Set
Lemma 1  satisfiable  G has an independent set of size K (= #clauses in ). Proof (  ) Suppose  is satisfiable. Then at least one literal from every clause is true. Pick exactly one such literal from each clause and pick its corresponding vertex.  K vertices are picked  For two of these vertices to share an edge, the corresponding literals would be  either in the same clause Impossible given the way these vertices are picked  or opposite literals. Impossible given that  is satisfiable. So none of the K vertices are adjacent. Thus the K vertices form an independent set.

7 Cont’d (  ) Suppose G has an independent set of size K.
Then the vertices in the set  must be in different triangles.  do not include a pair of opposite literals. Now we assign T to the corresponding literals in , which will be true under the induced truth value assignment to the variables.

8 Vertex Cover G = K |C|  |V| – 1
Let G be an undirected graph. C  V(G) is a vertex cover if for every edge (u, v)  E(G) either u  C or v  C a c d b e a G = K n |C|  |V| – 1 complete graph with n vertices d { a, d } is a vertex cover.

9 The Vertex Cover Problem
Vertex Cover (VC) Input: Graph G = (V, E), positive integer K  | V |. Q: Does G have a vertex cover of size  K ? Lemma C is a vertex cover  V – C is an independent set. a c d b e Proof () Let C be a vertex cover. Suppose V – C is not an independent set. Then there exists two vertices u, v  V – C such that (u, v)  E. {a, d}: vertex cover So edge (u, v) has both vertices not in C and C is not a vertex cover. a c d b e ( ) Similarly. {b, c, e}: independent set

10 VC is NP-complete Corollary IND-SET  VC
It is easy to show that VC  NP. Theorem VC  NPC.

11 CLIQUE A clique Q is a subset of vertices such that
(u, v) is an edge for every u, v  Q. b a d e c f g cliques: { a, b, c, d } { e, f, g } { d, e } { g }, … The subgraph induced by Q is a complete graph.

12 Complement of a Graph The complement G of a graph G = (V, E) has
 the same vertex set V  edge set E such that (u, v)  E  (u, v)  E Complement: Original graph: b a d e c f g b a d e c f g

13 The CLIQUE Problem Input: Graph G = (V, E), positive integer K  | V |. Q: Does G have a clique of size  K ? Lemma Q is a clique in G  Q is an independent set in the complement G . IND-SET  CLIQUE P Theorem CLIQUE  NPC.


Download ppt "NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle"

Similar presentations


Ads by Google