 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 1 2 3.

Slides:



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

NP-Completeness: Reductions
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
More NP-completeness Sipser 7.5 (pages ). CS 311 Fall NP’s hardest problems Definition 7.34: A language B is NP-complete if 1.B ∈ NP 2.A≤
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Umans Complexity Theory Lectures Lecture 2a: Reductions & Completeness.
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
NP-completeness Sipser 7.4 (pages 271 – 283). CS 311 Fall The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )
More NP-completeness Sipser 7.5 (pages ).
CS21 Decidability and Tractability
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.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
Approximation Algorithms Lecture for CS 302. What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in.
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.
Time Complexity.
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.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
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
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-completeness Section 7.4 Giorgi Japaridze Theory of Computability.
CS 461 – Nov. 30 Section 7.5 How to show a problem is NP-complete –Show it’s in NP. –Show that it corresponds to another problem already known to be NP-complete.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
NPC.
CSC 413/513: Intro to Algorithms
Complexity ©D.Moshkovits 1 2-Satisfiability NOTE: These slides were created by Muli Safra, from OPICS/sat/)
NP-complete Languages
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong NP-complete.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
NP-Completeness A problem is NP-complete if: It is in NP
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
Richard Anderson Lecture 26 NP-Completeness
More NP-complete Problems
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
(xy)(yz)(xz)(zy)
CS21 Decidability and Tractability
CS154, Lecture 16: More NP-Complete Problems; PCPs
Lecture 24 NP-Complete Problems
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
More NP-complete Problems
CSC 4170 Theory of Computation The class NP Section 7.3.
CS154, Lecture 13: P vs NP.
CS21 Decidability and Tractability
CS21 Decidability and Tractability
CS154, Lecture 16: More NP-Complete Problems; PCPs
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Presentation transcript:

 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

 2005 SDU 3 An NP algorithm for the PATH problem N= “On input where G is a directed graph and s,t are nodes of G: 1. c:=s; V:={} 2. Repeat while c  V and there is an outgoing edge from c: 3. Guess a node b such that G has the edge (c,b); 4. V:=V  {c}; c:=b; 5. If t  V, accept. Otherwise reject. s t

 2005 SDU 4 A P algorithm for the PATH problem N= “On input where G is a directed graph and s,t are nodes of G: 1. Mark s. 2. Repeat until no additional nodes are marked: 3. Scan all the edges of G. If an edge (a,b) is found going from a marked node a to an unmarked node b, mark node b. 4. If t is marked, accept. Otherwise reject. s t

 2005 SDU 5 The Hamiltonian path problem HAMPATH = { | G is a directed graph that has a directed path from s to t that goes through every node exactly once} s t

 2005 SDU 6 Polynomial time reduction Definition. A function f is polynomial time computable if there exists a polynomial time TM that halts on each input x with only f(x) on the tape. Definition. A language A is polynomial time (mapping) reducible to a language B (write A  p B) if A is mapping reducible to B via a polynomial time computable function.

 2005 SDU 7 NP-completeness Definition. A language A is NP-complete if A is in NP and every language in NP is polynomial time reducible to A. Theorem. A language A is NP-complete and A  P, then P = NP. We may use the following to prove something is NP- complete. Theorem. A language A is NP-complete, B  NP, and A  p B, then B is NP-complete.

 2005 SDU 8 SAT is NP-complete 3SAT is NP-complete. HPATH is NP-complete. CLIQUE is NP-complete. … SAT is NP-complete.  Given a Boolean formula  = (x 1  x 3  x 7 )  (x 3  x 2 )  (  x 1  x 8 ), dose there exist a truth assignment T to variables x 1, …,x n (assignment of 0s and 1s to the variables), such that  (T) = 1( is  satisfiable)?  x 1  variable ; x 1,  x 3  literal

 2004 SDU 9 3SAT vs. CLIQUE A clause is the disjunction of some literals, e.g., x 1  x 3  x 7 A Boolean formula is in conjunctive normal form (CNF in short) if it is in the conjunction (  ) of some clauses. A 3CNF formula is a formula in CNF in which each clause consists of three literals.  (x 1  x 3  x 7 )  (x 3  x 2  x 7 )  (  x 1  x 2  x 8 ) 3SAT: Given a 3CNF formula, is it satisfiable? CLIQUE: Given a graph (V, E), and a number k, does G contain a complete sub-graph with at least k vertices? Theorem. 3SAT is polynomial time reducible to CLIQUE.

 2004 SDU 10 Proof of theorem Given a formula  of k three-literal clauses, construct a graph G = (V, E), where V = {(i, j)| 1  i  k, 1  j  3} and E = {((i, j) (i’, j’))| (i  i’ and the jth literal in the ith clause and the j’th literal in the i’th clause do not interfere with each other.)}  = (x 2  x 1  x 3 )  (  x 1  x 2  x 4 )  (x 2  x 4  x 3 ) x2x2 x1x1 x3 x3  x 1  x 2 x 4 x2x4x3x2x4x3

 2004 SDU 11 Proof of theorem(cont’d) Claim.  is satisfiable if and only if G has a k-clique. <=Let S be a k-clique of G. Then S has a node from each triple so that the selected nodes do not interfere with each other as assignments. => Let A be a satisfying assignment. Select from each triple a literal that is satisfied by A to construct a set S. |S| = k and it is a clique. The mapping is polynomial time computable.