1 / 20

Additional NP-complete problems

Giorgi Japaridze Theory of Computability. Additional NP-complete problems. Section 7.5. 7.5.a. Giorgi Japaridze Theory of Computability. Why we want to see more NP-completeness proofs. For reasons that are not well understood, most naturally occurring

dory
Download Presentation

Additional NP-complete problems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Giorgi Japaridze Theory of Computability Additional NP-complete problems Section 7.5

  2. 7.5.a Giorgi JaparidzeTheory of Computability Why we want to see more NP-completeness proofs For reasons that are not well understood, most naturally occurring NP-problems are known to be either in P or to be NP-complete (the graph isomorphism problem being one notable exception; so was the COMPOSITES problem until a few years ago). So, if you seek a polynomial time algorithm for a new NP-problem, spending part of your effort attempting to prove it NP-complete is sensible because doing so may prevent you from wasting time. This explains why we want to exercise more with NP-completeness proofs. Such proofs usually proceed by finding a polynomial reduction from an already known NP-complete language, most typically from 3SAT. When doing so, we look for structures in the language under question that can simulate the variables and clauses of Boolean formulas. For example, when reducing 3SAT to CLIQUE, variables were simulated by vertices, and clauses by triples. Such structures are often called gadgets.

  3. 7.5.b Giorgi JaparidzeTheory of Computability The NP-completeness of CLIQUE Corollary 7.43CLIQUE is NP-complete. Proof. As was already (easily) observed, CLIQUE is in NP. Next, Theorem 7.32 showed that 3SAT is polynomial time reducible to CLIQUE. In turn, by Corollary 7.42, 3SAT is NP-complete. But Theorem 7.36 says that if an NP-complete language is polynomial time reducible to an NP-language C, then C is NP-complete. Hence CLIQUE is NP-complete.

  4. 7.5.c Giorgi JaparidzeTheory of Computability The VERTEX-COVER problem defined G IfG is an undirected graph, a vertex cover of G is a subset of the nodes where every edge of G touches (at least) one of those nodes. 1 2 3 4 VERTEX-COVER = = {<G,k> | G is an undirected graph that has a k-node vertex cover} <G,4>  VERTEX-COVER? <G,3>  VERTEX-COVER? <G,2>  VERTEX-COVER? <G,1>  VERTEX-COVER?

  5. 7.5.d Giorgi JaparidzeTheory of Computability The NP-completeness of VERTEX-COVER (a) Theorem 7.44VERTEX-COVER is NP-complete. Proof. Obviously VERTEX-COVERNP (why?). Next, we are going to set up a polynomial time reduction from 3SAT to this language. It maps a 3cnf-formula  to a graph G and a value k, such that  is satisfiable iff G has a vertex cover of size k. For each variable x in , we produce a horizontal edge connecting two nodes. We label the two nodes in this gadget x and x. Setting x to be TRUE is going to correspond to selecting the left node for the vertex cover, and setting it to be FALSE correspond to selecting the right node. For example, when  = (x  x  z)  (x  z  z)  (x  z  z), the reduction produces the following two variable gadgets: x x z z

  6. 7.5.e Giorgi JaparidzeTheory of Computability  = (x  x  z)  (x  z  z)  (x  z  z) The NP-completeness of VERTEX-COVER (b) Next, for each clause, we produce a triangle of (interconnected) nodes, each node of a triangle labeled with the corresponding literal of the corresponding clause. These triangles are clause gadgets. Finally, we connect each variable-gadget node to each clause-gadget node with the identical label. x x z z x x x x z z z z z

  7. 7.5.f Giorgi JaparidzeTheory of Computability The NP-completeness of VERTEX-COVER (c) Thus, G has 2m+3l nodes, wherem is the number of variables in  and l is the number of clauses. Let k be m+2l. In the present example, k = 2+(23) = 8. Claim. is satisfiable iff G has a vertex cover of size k.  = (x  x  z)  (x  z  z)  (x  z  z) x x z z x x x x z z z z z

  8. 7.5.g Giorgi JaparidzeTheory of Computability Supposeis satisfiable. Include the variable-gadget nodes corresponding to true literals in the VC. The NP-completeness of VERTEX-COVER (d) Next, for each clause gadget, select a true-literal-labeled node, and include the other two nodes in the VC. We got the total of k nodes. All edges within the variable and clause gadgets are obviously covered. And every intergadget edge is covered either by a (true) variable-gadget node, or by one of the two nodes of the clause gadget that have been included in the vertex cover.  = (x  x  z)  (x  z  z)  (x  z  z) x x z z x x x x z z z z z

  9. 7.5.h Giorgi JaparidzeTheory of Computability Suppose now G has a VC of size k. Clearly it should include at least one node from each variable gadget and at least two nodes from each clause gadget. The NP-completeness of VERTEX-COVER (e) As this number sums up to k, those nodes are exactly the nodes of the vertex cover. We take the nodes of the variable gadgets that are in the VC and assign TRUE to the corresponding literals. This assignment satisfies  because, if you take any clause gadget, the node which is not in the VC is (has to be) connected with an edge to a true-literal node of a variable gadget, for otherwise that intergadget edge would not be covered.  = (x  x  z)  (x  z  z)  (x  z  z) x x z z x x x x z z z z z

  10. 7.5.i Giorgi JaparidzeTheory of Computability The NP-completeness of HAMPATH (a) Theorem 7.46HAMPATH is NP-complete. Proof. ThatHAMPATHis inNPhas already been shown. Now we set up a polynomial time reduction from 3SAT to HAMPATH. Consider an arbitrary 3cnf-formula  with k clauses:  = (p1  q1  r1)  (p2  q2  r2)  …  (pk  qk  rk) c1 c2 … ck We assume that  contains l variables x1,…,xl. Each such variable will be represented with a diamond-shaped structure with 3k+5 nodes: And each clause will be represented with a single node: cj … xi

  11. 7.5.j Giorgi JaparidzeTheory of Computability s The NP-completeness of HAMPATH (b) The overall structure of G looks like this. There are additional edges connecting clause nodes with internal nodes of diamonds, explained on the next slide. … x1 c1 … x2 c2 c3 . . . . . . ck … xl t

  12. 7.5.k Giorgi JaparidzeTheory of Computability The horizontal nodes in a diamond structure are grouped as follows: The NP-completeness of HAMPATH (c) … xi c1 c2 c3 ck cj Additional edges when clause cj contains xi: … … xi cj cj Additional edges when clause cjcontains xi: … … xi cj

  13. 7.5.l Giorgi JaparidzeTheory of Computability s The NP-completeness of HAMPATH (d) Suppose  is satisfiable. Consider the path that zig-zags through true diamonds, and zag-zigs through false diamonds. … x1 TRUE zig-zag c1 … x2 c2 It covers all the nodes except the clause nodes c1,…,ck. We can easily include them by selecting one true literal in each clause and then adding a detour from the corresponding pair of horizontal nodes of the of the corresponding diamond. E.g.,when c1 includes x1 and x1 is Selected for c1, we have: FALSE zag-zig c3 . . . . . . ck … xl TRUE zig-zag t

  14. 7.5.m Giorgi JaparidzeTheory of Computability s The NP-completeness of HAMPATH (e) On the other hand, if c1 included x2 and x2 was selected for c1, we would set up the detour in the opposite direction as you see. The same story for c2, only the detour will be from the next pair of horizontal nodes, i.e. nodes #6-7 (rather than #3-4). And so on. The resulting path with detours is obviously Hamiltonian. … x1 TRUE zig-zag c1 … x2 c2 FALSE zag-zig c3 . . . . . . ck … xl TRUE zig-zag t

  15. 7.5.n Giorgi JaparidzeTheory of Computability s The NP-completeness of HAMPATH (e) For the reverse direction, assume G has a Hamiltonian path from s to t. With a little thought, one can see that the path should be normal, meaning that it goes through the diamonds in order from the top one to the bottom one, except for the detours to the clause nodes. From such a normal path we can easily obtain a satisfying assignment: if it zig-zags through the diamond, assign TRUE to the corresponding variable. And if it zag-zigs, then assign FALSE. … x1 TRUE zig-zag c1 … x2 c2 FALSE zag-zig c3 . . . . . . ck … xl TRUE zig-zag t

  16. 7.5.o Giorgi JaparidzeTheory of Computability The NP-completeness of UHAMPATH UHAMPATH is the undirected version of HAMPATH. Theorem 7.55UHAMPATH is NP-complete. Proof: By reducing HAMPATH to UHAMPATH. Given a directed graph G, we construct its undirected equivalent G’ by replacing each node u of G by three nodes: uin, umid and uout; except the node s which gets replaced by sout, and the node t which gets replaced by tin. G’ has two types of edges. One type connects each umid with uin and uout. The other type connects each uout with vin, as long as there is an edge from u to v in G. Now, suppose G has a Hamiltonian path s, u1, u2, …, uk, t Then obviously the following is a Hamiltonian path in G’: sout, u1in, u1mid, u1out, u2in, u2mid, u2out, …, ukin, ukmid, ukout, tin For the reverse direction, suppose G’ has a Hamiltonian path. With a little thought we find that it has to look like . But then obviously is a Hamiltonian path in G. sout, u1in, u1mid, u1out, u2in, u2mid, u2out, …, ukin, ukmid, ukout, tin s, u1, u2, …, uk, t

  17. 7.5.p Giorgi JaparidzeTheory of Computability The NP-completeness of SUBSET-SUM (a) Theorem 7.56SUBSET-SUM is NP-complete. Proof: That SUBSET-SUMNP was shown in Theorem 7.25. Now we construct a polynomial time reduction from 3SAT to SUBSET-SUM. Let  be a 3-cnf Boolean formula with variables x1,…,xl and clauses c1,…,ck. We construct an (l+k)(2l+2k+1) table of decimal digits. The columns are labeled with x1,…,xl, c1,…,cl, and the rows are labeled with y1,z1, y2,z2, …, yl,zl, g1,h1, g2,h2, …, gk,hk, t. The rows of this table are read as decimal numbers. The first 2l+2k rows, as numbers, comprise the set S, and the last row is the target number t. It will be seen later that S has a subset R summing up to t iff  is satisfiable. Specifically, row/number t consists of l 1s followed by k3s. Each row yi has a 1 in the xi column, and also in each cjcolumn such that clause cj contains xi. Each row zihas a 1 in the xicolumn, and also in each cj column such that clause cj contains xi. Finally, each row gi and hihas a 1 in the ci column. Digits not specified above are all 0s.

  18. 7.5.q Giorgi JaparidzeTheory of Computability (x1 x2  x3)  (x2 x3  …)  …  (x3 …  …) The NP-completeness of SUBSET-SUM (b) x1 x2 x3 x4 … xl c1 c2 … ck y1 1 1 z1 1 y2 1 1 z2 1 1 y3 1 1 1 z3 1 1 … yl 1 zl 1 g1 1 h1 1 g2 1 h2 1 … gk 1 hk 1 t 1 1 1 1 … 1 3 3 … 3

  19. 7.5.r Giorgi JaparidzeTheory of Computability The NP-completeness of SUBSET-SUM (c) Suppose  has a satisfying assignment. We construct a subset R of S as follows: Select yi if xiis assigned TRUE, and select ziif xi is assigned FALSE. If we add up what we have selected so far, we obtain a 1 in each of the first l digits because we have selected either yi or zifor each i. Furthermore, each of the last k digits is a number between 1 and 3 because each clause is satisfied and so contains between 1 and 3 true literals. Now we further select enough of the g and h numbers to bring each of the last k digits up to 3, thus hitting the target. x1 x2 x3 x4 … xl c1 c2 … ck y1 1 1 z1 1 y2 1 1 z2 1 1 y3 1 1 1 z3 1 1 … yl 1 zl 1 g1 1 h1 1 g2 1 h2 1 … gk 1 hk 1 t 1 1 1 1 … 1 3 3 … 3

  20. 7.5.s Giorgi JaparidzeTheory of Computability Now suppose a subset R of S sums to t. Observe that each column in the table describing S has at most five 1s. So, a “carry” into the next column never occurs when a subset of S is added. To get a 1 in each of the first l columns of t, we must have either yi orzifor each i, but not both. If it is yi, we assign xi TRUE, otherwise assign FALSE. This assignment must satisfy because in each of the final k columns the sum is always 3. In column cj, at most 2 can come from gj and hj, so at least 1 in this column should come from some yi or zi in the subset. If it is yi, then xi appears in cj and is assigned TRUE, so cj is satisfied. If it is zi, thenxi appears in cj and xi is assigned FALSE, so cj is satisfied. Therefore, is satisfied. The NP-completeness of SUBSET-SUM (d) x1 x2 x3 x4 … xl c1 c2 … ck y1 1 1 z1 1 y2 1 1 z2 1 1 y3 1 1 1 z3 1 1 … yl 1 zl 1 g1 1 h1 1 g2 1 h2 1 … gk 1 hk 1 t 1 1 1 1 … 1 3 3 … 3

More Related