# np-completeness: reductions csc 4520/6520 fall 2013 slides adapted from david evans (virgina) and...

Post on 15-Dec-2015

216 views

Category:

## Documents

Tags:

• #### satisfying assignment

Embed Size (px)

TRANSCRIPT

• Slide 1
• NP-Completeness: Reductions CSc 4520/6520 Fall 2013 Slides adapted from David Evans (Virgina) and Costas Busch (RPI)
• Slide 2
• Definition of NP-Complete Q is an NP-Complete problem if: 1) Q is in NP 2) every other NP problem polynomial time is reducible to Q
• Slide 3
• Getting Started How do you show that EVERY NP problem reduces to Q? One way would be to already have an NP- Complete problem and just reduce from that P1P1 P2P2 P3P3 P4P4 Mystery NP-Complete Problem Q
• Slide 4
• 3-SAT 3-SAT = { f | f is in Conjunctive Normal Form, each clause has exactly 3 literals and f is satisfiable } 3-SAT is NP-Complete (2-SAT is in P)
• Slide 5
• NP-Complete To prove a problem is NP-Complete show a polynomial time reduction from 3-SAT Other NP-Complete Problems: PARTITION SUBSET-SUM CLIQUE HAMILTONIAN PATH (TSP) GRAPH COLORING MINESWEEPER (and many more)
• Slide 6
• NP-Completeness Proof Method To show that Q is NP-Complete: 1) Show that Q is in NP 2) Pick an instance, R, of your favorite NP- Complete problem (ex: in 3-SAT) 3) Show a polynomial algorithm to transform R into an instance of Q
• Slide 7
• Example: Clique CLIQUE = { | G is a graph with a clique of size k } A clique is a subset of vertices that are all connected Why is CLIQUE in NP?
• Slide 8
• Reduce 3-SAT to Clique Pick an instance of 3-SAT, , with k clauses Make a vertex for each literal Connect each vertex to the literals in other clauses that are not the negation Any k-clique in this graph corresponds to a satisfying assignment
• Slide 9
• Slide 10
• Slide 11
• Example: Independent Set INDEPENDENT SET = { | where G has an independent set of size k } An independent set is a set of vertices that have no edges How can we reduce this to clique?
• Slide 12
• Independent Set to CLIQUE This is the dual problem!
• Slide 13
• Vertex Cover Vertex cover of a graph is a subset of nodes such that every edge in the graph touches one node in S = red nodes Example:
• Slide 14
• |S|=4Example: Size of vertex-cover is the number of nodes in the cover
• Slide 15
• graph contains a vertex cover of size } VERTEX-COVER = { : Corresponding language: Example:
• Slide 16
• Theorem: 1. VERTEX-COVER is in NP 2. We will reduce in polynomial time 3CNF-SAT to VERTEX-COVER Can be easily proven VERTEX-COVER is NP-complete Proof: (NP-complete)
• Slide 17
• Let be a 3CNF formula with variables and clauses Example: Clause 1 Clause 2Clause 3
• Slide 18
• Formula can be converted to a graph such that: is satisfied if and only if Contains a vertex cover of size
• Slide 19
• Clause 1 Clause 2Clause 3 Clause 1 Clause 2Clause 3 Variable Gadgets Clause Gadgets nodes
• Slide 20
• Clause 1 Clause 2Clause 3 Clause 1 Clause 2Clause 3
• Slide 21
• If is satisfied, then contains a vertex cover of size First direction in proof:
• Slide 22
• Satisfying assignment Example: We will show that contains a vertex cover of size
• Slide 23
• Put every satisfying literal in the cover
• Slide 24
• Select one satisfying literal in each clause gadget and include the remaining literals in the cover
• Slide 25
• This is a vertex cover since every edge is adjacent to a chosen node
• Slide 26
• Explanation for general case: Edges in variable gadgets are incident to at least one node in cover
• Slide 27
• Edges in clause gadgets are incident to at least one node in cover, since two nodes are chosen in a clause gadget
• Slide 28
• Every edge connecting variable gadgets and clause gadgets is one of three types: Type 1 Type 2 Type 3 All adjacent to nodes in cover
• Slide 29
• If graph contains a vertex-cover of size then formula is satisfiable Second direction of proof:
• Slide 30
• Example:
• Slide 31
• exactly one literal in each variable gadget is chosen exactly two nodes in each clause gadget is chosen To include internal edges to gadgets, and satisfy chosen out of
• Slide 32
• For the variable assignment choose the literals in the cover from variable gadgets
• Slide 33
• since the respective literals satisfy the clauses is satisfied with
• Slide 34
• Dominating Set Problem: Dominating-set = { | A dominating set of size K for G exists} Goal: Show that Dominating-set is NP-Complete
• Slide 35
• Dominating Set (Definition) Problem: Dominating-set = { | A dominating set of size (at most) K for G exists} Let G=(V,E) be an undirected graph A dominating set D is a set of vertices that covers all vertices i.e., every vertex of G is either in D or is adjacent to at least one vertex from D
• Slide 36
• Dominating Set (Example) Size-2 example : {Yellow vertices} e
• Slide 37
• Dominating Set (Proof Sketch) Steps: 1)Show that Dominating-set NP. 2)Show that Dominating-set is not easier than a NPC problem We choose this NPC problem to be Vertex cover Reduction from Vertex-cover to Dominating-set 3)Show the correspondence of yes instances between the reduction
• Slide 38
• Dominating Set - (1) NP It is trivial to see that Dominating-set NP Given a vertex set D of size K, we check whether (V-D) are adjacent to D i.e., for each vertex, v, in (V-D), whether v is adjacent to some vertex u in D
• Slide 39
• Dominating Set - (2) Reduction Reduction - Graph transformation Construct a new graph G' by adding new vertices and edges to the graph G as follows: G G L L T Vertex-cover Dominating-set
• Slide 40
• Dominating Set - (2) Reduction Reduction - Graph transformation (Cont) For each edge (v, w) of G, add a vertex vw and the edges (v, vw) and (w, vw) to G' Furthermore, remove all vertices with no incident edges; such vertices would always have to go in a dominating set but are not needed in a vertex cover of G G G L L T Vertex-cover Dominating-set
• Slide 41
• Vertex cover A vertex cover, C, is a set of vertices that covers all edges i.e., each edge is at least adjacent to some node in C {2, 4}, {3, 4}, {1, 2, 3} are vertex covers 12 3 4

Recommended