7.5 More NP-complete problems What known-NP-complete language is often used to show another language is NP-complete? 3SAT What general approach is used to convert a 3SAT problem instance into an instance of another problem? look for gadgets in the new problem gadgets are structures that simulate variables and clauses What gadgets are used in the reduction from 3SAT to CLIQUE? individual nodes simulate variables/literals triples of nodes simulate clauses The Vertex Cover Problem What's a Vertex Cover of an undirected graph G? a subset of the nodes of G, such that every edge of G touches one of the selected nodes What's the Vertex Cover problem? VERTEX-COVER = { | G is an undirected graph with a k-node vertex cover } VERTEX-COVER is NP-Complete How do you show VERTEX-COVER is NP-Complete? 1. Show VERTEX-COVER is in NP 2. Show 3SAT reduces to VERTEX-COVER How do you show VERTEX-COVER is in NP? given a subset of nodes check that each edge has an endpoint in the set at most n^2 edges to check finding a node in the subset is no worse than O(n) 3SAT Reduces to VERTEX-COVER Given a 3SAT instance , create a VERTEX-COVER instance What gadget is used for variables? a variable gadget is an edge and two nodes the nodes are labeled with 'x' and 'not x' setting x true corresponds to selecting x in the vertex cover What gadget is used for clauses? clause gadgets are triples of three nodes the triples are connected with three edges the nodes are labeled with the literals from the clause How are the variable and clause gadgets interconnected? connect the nodes in each triple to the variables with the same label Construct the graph for the formula F. F = (not a or b or not c) and (a or b or d) How do you show the construction is polynomial-time? If the 3SAT formula has v variables and c clauses, how many nodes and edges are created in the graph? 2v + 3c nodes v + 6c edges What's the correct value of k for the VERTEX-COVER instance? set k to v + 2c If F is satisfiable, how do you know G has a cover of size k? in each variable-gadget, add the node with a true label to the cover in each clause-gadget, select a node with a true label add the two remaining nodes to the cover the cover has a total of k nodes the variable-gadget edges are covered the clause-gadget edges are covered the edges between gadgets are covered If G has a cover of size k, how do you know F is satisfiable? the cover must contain one node from each variable gadget (its the only way to cover the edge in the variable gadget) the cover must contain two nodes from each clause gadget (its the only way to cover the three edges in clause gadget) this accounts for all the nodes in the vertex cover assign the literals true for the variable-gadget nodes in the cover F is satisfied only two interconnecting edges are covered by clause nodes the third must be covered by a variable node that variable makes the clause true