NP-Completeness: Reductions

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Advertisements

Polynomial-time reductions We have seen several reductions:
Lecture 23. Subset Sum is NPC
1 NP-completeness Lecture 2: Jan P The class of problems that can be solved in polynomial time. e.g. gcd, shortest path, prime, etc. There are many.
Department of Computer Science & Engineering
NP-Completeness Lecture for CS 302. Traveling Salesperson Problem You have to visit n cities You want to make the shortest trip How could you do this?
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
Transitivity of  poly Theorem: Let ,  ’, and  ’’ be three decision problems such that   poly  ’ and  ’  poly  ’’. Then  poly  ’’. Proof:
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
NP-Complete Problems Problems in Computer Science are classified into
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Fall 2006Costas Busch - RPI1 More NP-complete Problems.
NP-complete examples CSC3130 Tutorial 11 Xiao Linfu Department of Computer Science & Engineering Fall 2009.
NP-Completeness (2) NP-Completeness Graphs 4/17/2017 6:25 AM x x x x x
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Toward NP-Completeness: Introduction Almost all the algorithms we studies so far were bounded by some polynomial in the size of the input, so we call them.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
Clique Cover Cook’s Theorem 3SAT and Independent Set
P, NP, and NP-Complete Suzan Köknar-Tezel.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
Polynomial-time reductions We have seen several reductions:
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Additional NP-complete problems
1 How to prove that a problem is NPC. 2 Cook Cook showed the first NPC problem: SAT Cook received Turing Award in 1982.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
NP-Algorithms Tractable vs Intractable Some problems are intractable: as they grow large, we are unable to solve them in reasonable time.
28.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
CSC 413/513: Intro to Algorithms
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
NP-complete Languages
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Prof. Busch - LSU1 Busch Complexity Lectures: More NP-complete Problems.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
Costas Busch - LSU 1 More NP-complete Problems. Costas Busch - LSU 2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
NP-Completeness A problem is NP-complete if: It is in NP
Richard Anderson Lecture 26 NP-Completeness
More NP-complete Problems
More NP-complete Problems
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
ICS 353: Design and Analysis of Algorithms
More NP-complete Problems
CS21 Decidability and Tractability
Lecture 23 NP-Hard Problems
Presentation transcript:

NP-Completeness: Reductions CSc 4520/6520 Fall 2013 Slides adapted from David Evans (Virgina) and Costas Busch (RPI)

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

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 P1 P2 Mystery NP-Complete Problem Reference halting problem and undecidability Q P3 P4

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)

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)

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

Example: Clique CLIQUE = { <G,k> | 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?

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

Example: Independent Set INDEPENDENT SET = { <G,k> | 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?

Independent Set to CLIQUE This is the dual problem!

Vertex Cover Vertex cover of a graph is a subset of nodes such that every edge in the graph touches one node in Example: S = red nodes

Size of vertex-cover is the number of nodes in the cover Example: |S|=4

Corresponding language: VERTEX-COVER = { : graph contains a vertex cover of size } Example:

VERTEX-COVER is NP-complete Theorem: VERTEX-COVER is NP-complete Proof: 1. VERTEX-COVER is in NP Can be easily proven 2. We will reduce in polynomial time 3CNF-SAT to VERTEX-COVER (NP-complete)

Let be a 3CNF formula with variables and clauses Example: Clause 1

Formula can be converted to a graph such that: is satisfied if and only if Contains a vertex cover of size

Variable Gadgets nodes Clause Gadgets nodes Clause 1 Clause 2 Clause 3

Clause 1 Clause 2 Clause 3 Clause 2 Clause 3 Clause 1

First direction in proof: If is satisfied, then contains a vertex cover of size

Example: Satisfying assignment We will show that contains a vertex cover of size

Put every satisfying literal in the cover

Select one satisfying literal in each clause gadget and include the remaining literals in the cover

This is a vertex cover since every edge is adjacent to a chosen node

Explanation for general case: Edges in variable gadgets are incident to at least one node in cover

Edges in clause gadgets are incident to at least one node in cover, since two nodes are chosen in a clause gadget

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

Second direction of proof: If graph contains a vertex-cover of size then formula is satisfiable

Example:

To include “internal’’ edges to gadgets, and satisfy exactly one literal in each variable gadget is chosen chosen out of exactly two nodes in each clause gadget is chosen chosen out of

For the variable assignment choose the literals in the cover from variable gadgets

is satisfied with since the respective literals satisfy the clauses

Dominating Set Goal: Problem: Dominating-set = {<G, K> | A dominating set of size K for G exists} Goal: Show that Dominating-set is NP-Complete

Dominating Set (Definition) Problem: Dominating-set = {<G, K> | 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

Dominating Set (Example) Size-2 example : {Yellow vertices} e

Dominating Set (Proof Sketch) Steps: Show that Dominating-set ∈ NP. 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 Show the correspondence of “yes” instances between the reduction

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

Dominating Set - (2) Reduction Reduction - Graph transformation Construct a new graph G' by adding new vertices and edges to the graph G as follows: T G G’ <G,k> ∈ L Vertex-cover Dominating-set <G’, k> ∈ L’

Dominating Set - (2) Reduction Reduction - Graph transformation (Con’t) 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 T G G’ <G,k> ∈ L Vertex-cover Dominating-set <G’, k> ∈ L’

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 1 2 3 4 {2, 4}, {3, 4}, {1, 2, 3} are vertex covers

Dominating Set – Graph Transformation Example w v z u vz wu vw zu vu G' v w z u G

Dominating Set - (3) Correspondence A dominating set of size K in G’  A vertex cover of size K in G  Let D be a dominating set of size K in G’ Case 1): D contains only vertices from G Then, all new vertices have an edge to a vertex in D D covers all edges D is a valid vertex cover of G

Dominating Set - (3) Correspondence A dominating set of size K in G’  A vertex cover of size K in G  Let D be a dominating set of size K in G’ Case 2): D contains some new vertices (vertex in the form of uv) (We show how to construct a vertex cover using only old vertices, otherwise we cannot obtain a vertex cover for G) For each new vertex uv, replace it by u (or v) If u ∈ D, this node is not needed Then the edge u-v in G will be covered After new edges are removed, it is a valid vertex cover of G (of size at most K)

Dominating Set - (3) Correspondence A dominating set of size K in G’  A vertex cover of size K in G  Let C be a vertex cover of size K in G For an old vertex, v ∈ G’ : By the definition of VC, all edges incident to v are covered v is also covered For a new vertex, uv ∈ G’ : Edge u-v must be covered, either u or v ∈ C This node will cover uv in G’ Thus, C is a valid dominating for G’ (of size at most K)

Dominating Set - (3) Correspondence vw v w v w vz wu vu z u z u zu Vertex-cover in G Dominating-set in G'