Download presentation
Presentation is loading. Please wait.
Published byBetty Cummings Modified over 5 years ago
1
CSC 4170 Theory of Computation The class NP Section 7.3
2
and target node are fixed.
The HAMPATH problem 7.3.a A Hamiltonian path in a directed graph G is a directed path that goes through each node exactly once. We consider a special case of this problem where the start node and target node are fixed. HAMPATH = {<G,s,t> | G is a directed graph with a Hamiltonian path from s to t} 1 5 3 PATH? s t HAMPATH? 4 2 6 1 5 3 HAMPATH? s t 4 2 6
3
Polynomial verifiability
Does this graph have a Hamiltonian path? s t
4
The COMPOSITES problem
COMPOSITES = {x | x=pq for some integers p,q>1} 15 COMPOSITES ? 17 COMPOSITES ? 77 COMPOSITES ? 10403 COMPOSITES ? 997,111,111,911,111,119,131,119,871 COMPOSITES ? COMPOSITES is very easily seen to be verifiable in polynomial time. But only a few years ago it was proven that it is also decidable in polynomial time. The same question, however, remains open for HAMPATH --- one of the seven $1,000,000 questions!
5
NP and NP-completeness
Definition NP is the class of languages decided by some nondeterministic polynomial time Turing machine. The class of so called NP-complete languages is a subset of NP consisting of the “hardest” languages from NP. It is known that if any of the NP-complete problems has a polynomial time deterministic algorithm, then so do all problems from NP and thus P=NP. In fact, a polynomial time deterministic algorithm for any NP-complete problem can be easily/automatically “translated” into a polynomial time deterministic algorithm for any other problem from NP. HAMPATH is NP-complete. So are CLIQUE, SUBSET-SUM, SAT and many other natural languages (but not COMPOSITES).
6
A k-clique in an undirected graph is a subgraph
The CLIQUE problem 7.3.e A k-clique in an undirected graph is a subgraph with k nodes, wherein every two nodes are connected by an edge. On the right we see a 5-clique CLIQUE = {<G,k> | G is an undirected graph with a k-clique} Theorem CLIQUENP. Proof. Here is a polynomial time NTM N deciding CLIQUE: N = “On input <G,k>: 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.”
7
The SUBSET-SUM problem
7.3.f SUBSET-SUM = {<S,t> | S is a multiset of integers and, for some RS, the sum of all elements of R equals t} Theorem SUBSET-SUMNP. Proof. Here is a polynomial time NTM N deciding SUBSET-SUM: N = “On input <S,t>: 1. Nondeterministically select a subset c of S. 2. Test whether the elements of c sum up to t. 3. If yes, accept; otherwise reject.”
8
(1 (0 1)) (0 1) (1 (1 0)) (0 0)
Boolean formulas 7.3.g Boolean variables x,y,… take one of the two values 0 (false) or 1 (true). Boolean operations: (NOT), (AND), (OR). We write A for A. Boolean formulas are constructed from variables and operations in the standard way. Once a truth assignment for variables is given, the value of a compound formula is calculated as follows: 0 = 0 = 0 = 0 1 = 1 = 1 = 1 1 0 = 0 = 1 1 1 = 1 = 1 If x=0 and y=1, what is the value of the following formula? (y (x y)) (x y) (1 (0 1)) (0 1) (1 (1 0)) (0 0) (1 ) 0 0 1
9
of 0s and 1s to its variables that makes the formula evaluate to 1.
The SAT problem 7.3.h We say that a Boolean formula is satisfiable iff there is an assignment of 0s and 1s to its variables that makes the formula evaluate to 1. Are the following formulas satisfiable? x(xy) x(xy) Yes. An (in fact, the) satisfying assignment: x=0, y=1 No SAT = {<> | is a satisfiable Boolean formula} SAT P? SAT NP? Nobody knows! Yes. A satisying assignment can serve as a membership certificate
10
P vs. NP vs. coNP vs. EXPTIME
Definitions coNP = {L | L is the complement of some language in NP} EXPTIME = TIME(2n1) TIME(2n2) TIME(2n3) … This is what we know: P NP coNP EXPTIME NP coNP ≠ EXPTIME P: membership can be decided quickly NP: membership can be verified quickly coNP: membership can be refuted quickly EXPTIME: none of the above This is what we do not know: P = NP? NP = coNP? P = NP coNP?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.