Additional NP-complete problems - PowerPoint PPT Presentation

About This Presentation
Title:

Additional NP-complete problems

Description:

adding a detour from the. corresponding pair of. horizontal nodes of the. of the corresponding ... detours to the clause nodes. From such a normal path. we can ... – PowerPoint PPT presentation

Number of Views:153
Avg rating:3.0/5.0
Slides: 21
Provided by: giorgija
Category:

less

Transcript and Presenter's Notes

Title: Additional NP-complete problems


1
Additional NP-complete problems
Giorgi Japaridze Theory of
Computability
Section 7.5
2
Why we want to see more NP-completeness proofs
7.5.a
Giorgi Japaridze Theory of Computability
For reasons that are not well understood,
most naturally occurring NP-problems are known
to be either in P or to be NP-complete (the
graph isomorphism problem being one notable
exception so was the COMPOSITES problem until a
few years ago). So, if you seek a
polynomial time algorithm for a new NP-problem,
spending part of your effort attempting to prove
it NP-complete is sensible because doing so may
prevent you from wasting time. This
explains why we want to exercise more with
NP-completeness proofs. Such proofs
usually proceed by finding a polynomial reduction
from an already known NP-complete language, most
typically from 3SAT. When doing so, we look for
structures in the language under question that
can simulate the variables and clauses of Boolean
formulas. For example, when reducing 3SAT to
CLIQUE, variables were simulated by vertices,
and clauses by triples. Such structures are often
called gadgets.


3
The NP-completeness of CLIQUE
7.5.b
Giorgi Japaridze Theory of Computability
Corollary 7.43 CLIQUE is NP-complete.
Proof. As was already (easily) observed,
CLIQUE is in NP. Next, Theorem 7.32 showed that
3SAT is polynomial time reducible to CLIQUE. In
turn, by Corollary 7.42, 3SAT is
NP-complete. But Theorem 7.36 says that if an
NP-complete language is polynomial time reducible
to an NP-language C, then C is NP-complete. Hence
CLIQUE is NP-complete.


4
The VERTEX-COVER problem defined
7.5.c
Giorgi Japaridze Theory of Computability
G
If G is an undirected graph, a vertex cover of G
is a subset of the nodes where every edge of G
touches (at least) one of those nodes.
1
2
3
4
VERTEX-COVER ltG,kgt G is an undirected
graph that has a k-node vertex cover
ltG,4gt ? VERTEX-COVER?
ltG,3gt ? VERTEX-COVER?
ltG,2gt ? VERTEX-COVER?
ltG,1gt ? VERTEX-COVER?


5
The NP-completeness of VERTEX-COVER (a)
7.5.d
Giorgi Japaridze Theory of Computability
Theorem 7.44 VERTEX-COVER is NP-complete.
Proof. Obviously VERTEX-COVER?NP (why?).
Next, we are going to set up a polynomial time
reduction from 3SAT to this language. It maps a
3cnf-formula ? to a graph G and a value k, such
that ? is satisfiable iff G has a vertex cover of
size k.
For each variable x in ?, we produce a
horizontal edge connecting two nodes. We label
the two nodes in this gadget x and x. Setting x
to be TRUE is going to correspond to selecting
the left node for the vertex cover, and setting
it to be FALSE correspond to selecting the right
node. For example, when
? (x ? x ? z) ? (x ? z ? z) ? (x ? z ?
z), the reduction produces the following two
variable gadgets
x
x
z
z


6
The NP-completeness of VERTEX-COVER (b)
7.5.e
Giorgi Japaridze Theory of Computability
? (x ? x ? z) ? (x ? z ? z) ? (x ? z ? z)
Next, for each clause, we produce a triangle
of (interconnected) nodes, each node of a
triangle labeled with the corresponding literal
of the corresponding clause. These triangles
are clause gadgets.
Finally, we connect each variable-gadget node
to each clause-gadget node with the identical
label.
x
x
z
z
x
x
x
z
x
z
z
z
z


7
The NP-completeness of VERTEX-COVER (c)
7.5.f
Giorgi Japaridze Theory of Computability
Thus, G has 2m3l nodes, where m is the
number of variables in ? and l is the number of
clauses. Let k be m2l. In the present
example, k 2(2?3) 8.
Claim. ? is satisfiable iff G has a vertex cover
of size k.
? (x ? x ? z) ? (x ? z ? z) ? (x ? z ? z)
x
x
z
z
x
x
x
z
x
z
z
z
z


8
The NP-completeness of VERTEX-COVER (d)
7.5.g
Giorgi Japaridze Theory of Computability
Suppose ? is satisfiable.

Include the variable-gadget nodes corresponding
to true literals in the VC.
Next, for each
clause gadget, select a true-literal-labeled
node, and include the other two nodes in the VC.
We got the total of k nodes.
All edges within the variable and clause
gadgets are obviously covered.


And every intergadget edge
is covered either by a (true) variable-gadget
node, or by one of the two nodes of the clause
gadget that have been included in the vertex
cover.
? (x ? x ? z) ? (x ? z ? z) ? (x ? z ? z)
x
x
z
z
x
x
x
z
x
z
z
z
z


9
The NP-completeness of VERTEX-COVER (e)
7.5.h
Giorgi Japaridze Theory of Computability
Suppose now G has a VC of size k. Clearly
it should include at least one node from each
variable gadget and at least two nodes from each
clause gadget.


As this number sums up to k, those
nodes are exactly the nodes of the vertex cover.


We take the nodes of the variable
gadgets that are in the VC and assign TRUE to the
corresponding literals.
This assignment satisfies ? because, if
you take any clause gadget, the node which is
not in the VC is (has to be) connected with an
edge to a true-literal node of a variable
gadget, for otherwise that intergadget edge
would not be covered.
? (x ? x ? z) ? (x ? z ? z) ? (x ? z ? z)
x
x
z
z
x
x
x
z
x
z
z
z
z


10
The NP-completeness of HAMPATH (a)
7.5.i
Giorgi Japaridze Theory of Computability
Theorem 7.46 HAMPATH is NP-complete.
Proof. That HAMPATH is in NP has already been
shown. Now we set up a polynomial time reduction
from 3SAT to HAMPATH. Consider an
arbitrary 3cnf-formula ? with k clauses
? (p1 ? q1 ? r1) ? (p2 ? q2 ? r2) ? ?
(pk ? qk ? rk)
c1 c2
ck
We assume that ? contains l variables x1,,xl.
Each such variable will be represented with a
diamond-shaped structure with 3k5 nodes
And each clause will be represented with a single
node
cj

xi


11
The NP-completeness of HAMPATH (b)
7.5.j
Giorgi Japaridze Theory of Computability
s
The overall structure of G looks like
this. There are additional edges connecting
clause nodes with internal nodes of diamonds,
explained on the next slide.

x1
c1

x2
c2
c3
. . .
. . .
ck

xl
t


12
The NP-completeness of HAMPATH (c)
7.5.k
Giorgi Japaridze Theory of Computability
The horizontal nodes in a diamond structure are
grouped as follows

xi
c1 c2
c3 ck
cj
Additional edges when clause cj contains xi


xi
cj
cj
Additional edges when clause cj contains xi


xi
cj


13
The NP-completeness of HAMPATH (d)
7.5.l
Giorgi Japaridze Theory of Computability
s
Suppose ? is satisfiable. Consider the path that
zig-zags through true diamonds, and
zag-zigs through false diamonds.

x1
TRUE zig-zag
c1

x2
c2
It covers all the nodes except the clause nodes
c1,,ck. We can easily include them by selecting
one true literal in each clause and then adding
a detour from the corresponding pair of
horizontal nodes of the of the corresponding
diamond. E.g.,when c1 includes x1 and x1 is
Selected for c1, we have
FALSE zag-zig
c3
. . .
. . .
ck

xl
TRUE zig-zag
t


14
The NP-completeness of HAMPATH (e)
7.5.m
Giorgi Japaridze Theory of Computability
s
On the other hand, if c1 included x2 and x2
was selected for c1, we would set up the detour
in the opposite direction as you see. The same
story for c2, only the detour will be from the
next pair of horizontal nodes, i.e. nodes 6-7
(rather than 3-4). And so on. The resulting
path with detours is obviously Hamiltonian.

x1
TRUE zig-zag
c1

x2
c2
FALSE zag-zig
c3
. . .
. . .
ck

xl
TRUE zig-zag
t


15
The NP-completeness of HAMPATH (e)
7.5.n
Giorgi Japaridze Theory of Computability
s
For the reverse direction, assume G has a
Hamiltonian path from s to t. With a little
thought, one can see that the path should be
normal, meaning that it goes through the
diamonds in order from the top one to the
bottom one, except for the detours to the
clause nodes. From such a normal path we
can easily obtain a satisfying assignment if it
zig-zags through the diamond, assign TRUE to
the corresponding variable. And if it zag-zigs,
then assign FALSE.

x1
TRUE zig-zag
c1

x2
c2
FALSE zag-zig
c3
. . .
. . .
ck

xl
TRUE zig-zag
t


16
The NP-completeness of UHAMPATH
7.5.o
Giorgi Japaridze Theory of Computability
UHAMPATH is the undirected version of HAMPATH.
Theorem 7.55 UHAMPATH is NP-complete.
Proof By reducing HAMPATH to UHAMPATH. Given a
directed graph G, we construct its undirected
equivalent G by replacing each node u of G by
three nodes uin, umid and uout except the node
s which gets replaced by sout, and the node t
which gets replaced by tin. G has two
types of edges. One type connects each umid with
uin and uout. The other type connects each uout
with vin, as long as there is an edge from u to v
in G. Now, suppose G has a Hamiltonian
path
s, u1, u2, , uk, t
Then obviously the following is a Hamiltonian
path in G
sout, u1in, u1mid, u1out, u2in, u2mid, u2out, ,
ukin, ukmid, ukout, tin
For the reverse direction, suppose G has a
Hamiltonian path. With a little thought we find
that it has to look like

. But then obviously
is a Hamiltonian path
in G.
sout, u1in, u1mid, u1out, u2in, u2mid, u2out, ,
ukin, ukmid, ukout, tin
s, u1, u2, , uk, t


17
The NP-completeness of SUBSET-SUM (a)
7.5.p
Giorgi Japaridze Theory of Computability
Theorem 7.56 SUBSET-SUM is NP-complete.
Proof That SUBSET-SUM?NP was shown in Theorem
7.25. Now we construct a polynomial time
reduction from 3SAT to SUBSET-SUM. Let ? be
a 3-cnf Boolean formula with variables x1,,xl
and clauses c1,,ck. We construct an
(lk)?(2l2k1) table of decimal digits.
The columns are labeled with x1,,xl, c1,,cl,
and the rows are labeled with y1,z1, y2,z2, ,
yl,zl, g1,h1, g2,h2, , gk,hk, t. The
rows of this table are read as decimal numbers.
The first 2l2k rows, as numbers, comprise the
set S, and the last row is the target number t.
It will be seen later that S has a subset R
summing up to t iff ? is satisfiable.
Specifically, row/number t consists of l 1s
followed by k 3s. Each row yi has a 1 in the
xi column, and also in each cj column such that
clause cj contains xi. Each row zi has a 1
in the xi column, and also in each cj column such
that clause cj contains xi. Finally, each
row gi and hi has a 1 in the ci column.
Digits not specified above are all 0s.


18
The NP-completeness of SUBSET-SUM (b)
7.5.q
Giorgi Japaridze Theory of Computability
x1
x2
x3
x4

xl
c1
c2

ck
y1
1
1
z1
1
y2
1
1
z2
1
1
y3
1
1
1
z3
1
1

yl
1
zl
1
g1
1
h1
1
g2
1
h2
1

gk
1
hk
1
t
1 1 1 1 1 3 3 3


19
The NP-completeness of SUBSET-SUM (c)
7.5.r
Giorgi Japaridze Theory of Computability
Suppose ? has a satisfying assignment. We
construct a subset R of S as follows
Select yi if xi is assigned TRUE, and select
zi if xi is assigned FALSE. If we add up what
we have selected so far, we obtain a 1 in each
of the first l digits because we have selected
either yi or zi for each i. Furthermore, each
of the last k digits is a number between 1 and 3
because each clause is satisfied and so contains
between 1 and 3 true literals. Now we further
select enough of the g and h numbers to bring
each of the last k digits up to 3, thus hitting
the target.
x1
x2
x3
x4

xl
c1
c2

ck
y1
1
1
z1
1
y2
1
1
z2
1
1
y3
1
1
1
z3
1
1

yl
1
zl
1
g1
1
h1
1
g2
1
h2
1

gk
1
hk
1
t
1 1 1 1 1 3 3 3


20
The NP-completeness of SUBSET-SUM (d)
7.5.s
Giorgi Japaridze Theory of Computability
Now suppose a subset R of S sums to t.
Observe that each column in the table
describing S has at most five 1s. So, a
carry into the next column never occurs when a
subset of S is added. To get a 1 in each
of the first l columns of t, we must have either
yi or zi for each i, but not both. If it is yi,
we assign xi TRUE, otherwise assign FALSE.
This assignment must satisfy ? because in
each of the final k columns the sum is always 3.
In column cj, at most 2 can come from gj and hj,
so at least 1 in this column should come from
some yi or zi in the subset. If it is
yi, then xi appears in cj and is assigned TRUE,
so cj is satisfied. If it is zi, then xi appears
in cj and xi is assigned FALSE, so cj is
satisfied. Therefore, ? is satisfied.
x1
x2
x3
x4

xl
c1
c2

ck
y1
1
1
z1
1
y2
1
1
z2
1
1
y3
1
1
1
z3
1
1

yl
1
zl
1
g1
1
h1
1
g2
1
h2
1

gk
1
hk
1
t
1 1 1 1 1 3 3 3

Write a Comment
User Comments (0)
About PowerShow.com