Presentation is loading. Please wait.

Presentation is loading. Please wait.

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 )

Similar presentations


Presentation on theme: "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 )"— Presentation transcript:

1 NP-completeness Sipser 7.4 (pages 271 – 283)

2 CS 311 Mount Holyoke College 2 The classes P and NP NP = ∪ k NTIME(n k ) P = ∪ k TIME(n k )

3 CS 311 Mount Holyoke College 3 A famous NP problem CNF satisfiability ( CNFSAT ): Given a boolean formula B in conjunctive normal form (CNF), is there a truth assignment that satisfies B ?

4 CS 311 Mount Holyoke College 4 A graph theory NP problem CLIQUE : Given a graph G = (V, E) and an integer k, does G contain C k as a subgraph? –Is ∈ CLIQUE?

5 CS 311 Mount Holyoke College 5 A graph theory NP problem CLIQUE : Given a graph G = (V, E) and an integer k, does G contain C k as a subgraph? –Is ∈ CLIQUE?

6 CS 311 Mount Holyoke College 6 A graph theory NP problem CLIQUE : Given a graph G = (V, E) and an integer k, does G contain C k as a subgraph? –Is ∈ CLIQUE?

7 CS 311 Mount Holyoke College 7 A graph theory NP problem CLIQUE : Given a graph G = (V, E) and an integer k, does G contain C k as a subgraph? –Is ∈ CLIQUE?

8 CS 311 Mount Holyoke College 8 A graph theory NP problem CLIQUE : Given a graph G = (V, E) and an integer k, does G contain C k as a subgraph? –Is ∈ CLIQUE?

9 CS 311 Mount Holyoke College 9 CLIQUE ∈ NP Verifier: V = “On input,c> : 1.Test whether c is a set of k nodes of G 2.Test whether G contains all edges connecting nodes in c 3.If both pass, accept; otherwise, reject.” NTM: N = “On input : 1.Nondeterministically select a subset c of k nodes of G 2.Test whether G contains all edges connecting nodes in c 3.If yes, accept; otherwise, reject.”

10 CS 311 Mount Holyoke College 10 Which problem is harder? NP P P CNF CLIQUE

11 CS 311 Mount Holyoke College 11 Recall… Definition 5.17: A function f:Σ*→Σ* is a computable function if ∃ some Turing machine M, on every input w, halts with just f(w) on its tape.

12 CS 311 Mount Holyoke College 12 Polynomial time computable functions Definition 7.28: A function f:Σ*→Σ* is a polynomial time computable function if ∃ some polynomial time Turing machine M, on every input w, halts with just f(w) on its tape.

13 CS 311 Mount Holyoke College 13 Recall… Definition 5.20: Language A is mapping reducible to language B, written A ≤ m B, if there is a computable function f:Σ* → Σ*, where for every w, w ∈ A ⇔ f(w) ∈ B A A B B f f

14 CS 311 Mount Holyoke College 14 Polynomial time mapping reducibility Definition 7.29: Language A is polynomial time mapping reducible to language B, written A ≤ p B, if there is a polynomial time computable function f:Σ* → Σ*, where for every w, w ∈ A ⇔ f(w) ∈ B A A B B f f

15 CS 311 Mount Holyoke College 15 Intuitively, A is no harder than B Theorem 7.31: If A ≤ p B and B ∈ P, then A ∈ P. Proof: Algorithm for deciding A Reductio n algorithm F Algorithm for deciding B wf(w) “yes” “no”

16 CS 311 Mount Holyoke College 16 CNF ≤ p CLIQUE Given a boolean formula B in CNF, we show how to construct a graph G and an integer k such that G has a clique of size k ⇔ B is satisfiable. Given the construction would yield

17 CS 311 Mount Holyoke College 17 NP’s hardest problems Definition 7.34: A language B is NP-complete if 1.B ∈ NP 2.A≤ p B, for all A ∈ NP NP A1A1 B (NP-complete) A3A3 A2A2

18 CS 311 Mount Holyoke College 18 P=NP? Theorem 7.35: If B is NP-complete and B ∈ P, then P = NP. NP P P P=NP P=NP A1A1 B (NP-complete) A3A3 A2A2

19 CS 311 Mount Holyoke College 19 Cook-Levin Theorem SAT is NP-complete. (If A ∈ NP, then A≤ p SAT.) NP A1A1 SAT A3A3 A2A2

20 CS 311 Mount Holyoke College 20 But that’s not the only one! CLIQUE is NP-complete (why?) NP A1A1 SAT A3A3 A2A2 CLIQUE


Download ppt "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 )"

Similar presentations


Ads by Google