Professional Documents
Culture Documents
Chap 9 NP Complete
Chap 9 NP Complete
Chap 9 NP Complete
Finite
state
control
... ...
-3 -2 -1 0 1 2 3 4
Introduction to the Theory NP-Completeness
(Reference book: Computers and Intractability: A Guide to the Theory of NP-
Completeness by Michael Gary and David Johnson
Guessing Read-write
Tape head head
... ...
-3 -2 -1 0 1 2 3 4
Introduction to the Theory NP-Completeness
(Reference book: Computers and Intractability: A Guide to the Theory of NP-
Completeness by Michael Gary and David Johnson
3 - SATISFIABILITY (3SAT)
INSTANCE: Collection C={c1, c2 , , cm} of clauses on a finite set U of
variables such that | ci |=3 for 1 i m
QUESTION: Is there a truth assignment for U that satisfies all the clauses
in C?
3 DIMENSIONAL MATCHING (3DM)
INSTANCE: A set M W X Y , where W, X and Y are disjoint sets
having the same number q of elements.
QUESTION: Does M contain a matching, that is a subset M ' M such
that |M| = q and no two elements of M agree in any
coordinate?
VERTEX COVER (VC)
INSTANCE: A graph G=(V,E) and a positive integer K V
QUESTION: Is there a vertex cover of size K or less for G, that is, a subset
V ' V such that V ' k and, for each edge {u, v} E , at
least one of u and v belongs to V ?
CLIQUE
INSTANCE: A graph G = (V, E) and a positive integer J V
QUESTION: Does G contain a clique of size J or more, that is, a subset
V ' V such that V ' J and every two vertices in V are joined
by an edge in E?
PARTITION
INSTANCE: A finite set A and a size s(a) Z for each a A
QUESTION: Is there a subset A ' A such that s (a) s(a)?
a A' a A A'
SATISFIABILITY
3SAT
3DM VC
PARTITION HC CLIQUE
U 'j { y1j , y 2j }
k=1
' 1 2 1 2 1 2 1 2
C j {{z1 , y , y },{z1 , y , y j },{z1 , y j , y },{z1 , y j , y j }}
j j j j
k=2 U ' 1
{y } C ' 1 1
{{z1 , z2 , y },{z1 , z2 , y j }}
j j j j
U 'j { y ij :1 i k 3}
k>3 ' 1 i i 1 k 3
C j {{z1 , z2 , y }} {{ y j , zi 2 , y }:1 i
j j k 4} {{ y j , zk 1 , zk }}
We need to show that
ISAT YSAT I3-SAT Y3-SAT
l 1 or 2 t ' ( y ij ) F, 1 i k 3
l k 1 or k t ' ( y ij ) T , 1 i k 3
otherwise t ' ( y ij ) T , 1 i l 2
and t ' ( y ij ) F, l 1 i k 3
Vertex Cover (VC) Problem is NP-Complete
cj C Sj (V j' , E 'j )
Satisfaction Testing Component
'
V j {a1[ j ], a2 [ j ], a3[ j ]}
E 'j {{a1[ j ], a2 [ j ]},{a2 [ j ], a3[ j ]},{a3[ j ], a1[ j ]}}
G (V , E )
Set k = n + 2m
n m n m m
' '
V ( Vi ) ( V) E
j ( Ei ) ( E )
j ( E ''j )
i 1 j 1 i 1 j 1 j 1
Example: Generation of a instance of VC from an instance of 3-SAT
I3-SAT: U= {u1, u2, u3, u4}, C = {{u1, 3, 4}, {1, u2, 4}}
u1 u1 u2 u2 u3 u3 u4 u4
a2[1] a2[2]