Reductions Set Cover Subset Sum Clique abhi shelat

L26
Reductions
Set Cover
Subset Sum
Clique
4102
!"#$%$&&:
abhi shelat
final exam
mon
7
tue
8
handed out 5p
wed
9
thu
10
fri
11
due 10p
closed book: no aids, notes, internet, colleagues, etc.
How can we
compare
problems?
2 IDEAS TODAY
SEARCH PROBLEM
Clue: fictional word meaning clear to me.
SEARCH PROBLEM
decision problem
SOLVING=DECIDING
search
triplet(x1 , . . . , xn )
decision
search
maxindset(G)
decision
search
7
6
2
1
4
8
3
9
5
minvertexcover(G)
decision
Major idea:
veil
GENERALIZATI
gadget
http://knol.google.com/k/-/-/262x5l9dzrxcp/vz007y/generallee.jpg
http://theappslab.com/wp-content/uploads/2009/01/inspector-gadget.jpg
INDEPENDENT SET
BASEBALL: VERTEX COVER
7
6
2
1
4
8
3
9
5
maxindset ≤O(V) minvertexcover
7
6
2
1
4
8
3
9
5
maxindset ≤O(V) minvertexcover
Thm: Set S is an independent set of G iff V-S is a vertex cover.
GENERALEEZATION
WHICH OS PROBLEM?
mac
make slides
make lectures
itunes
unix programs
latex
java
pdf
tax
security
linux
win
beos
freebsd
SET COVER PROBLEM
SET COVER PROBLEM
U
S1 , . . . , Sn
Si1 , . . . , Sik
Si ⊂ U
�
j
Sij = U
WANT TO SHOW THAT
vertexcover ≤ setcover
vertexcover ≤ setcover
7
2
5
1
8
6
3
4
vertexcover ≤ setcover
7
2
5
1
8
6
3
4
veil
GENERALIZATION
GADGET
http://theappslab.com/wp-content/uploads/2009/01/inspector-gadget.jpg
d
g
h
e
b
i
f
z
a
c
node-disjoint
paths
edge-disjoint
paths
SUBSET SUM (S,T)
SUBSET SUM (S, t)
Goal: given set
S = {x1 , . . . , xn }
is there a subset
T ⊆S
such that
xi = t
�
xi ∈T
COMPARE SUBSET SUM TO
vertex cover
which problem is new?
COMPARE SUBSET SUM TO
vertex cover
subset sum
how do we say subset is as hard as vertex?
which problem is new?
vertexcover ≤p subsetsum
given:
vertexcover ≤p subsetsum
given:
(G, k)
u
v
w
x
vertexcover ≤p subsetsum
given:
(G, k)
produce:
u
v
w
x
S = { x1 , . . . , x n }, t
number every edge
EXAMPLE (IN BASE 4)
(G, k)
given:
u
v
w
x
EXAMPLE (IN BASE 4)
(G, k)
1, 4, 4 , 4 , 4
000001
000010
000100
001000
010000
au = 45 + (1 + 4)
100011
av = 45 + (1 + 42 + 43 )
101101
given:
u
v
w
x
2
3
4
5
2
110110
4
aw = 4 + (4 + 4 + 4 )
5
3
111000
4
ax = 4 + (4 + 4 )
5
2
3
4
t = 2 · 4 + 2(1 + 4 + 4 + 4 + 4 ) 222222
vertexcover ≤p subsetsum
given:
(G, k)
u
v
w
x
f
(G, k) ∈ vc =⇒


 1, 4, 16, 64, 256, 
1029, 1105, 1300,
S=


1344
t=2730
vertexcover ≤p subsetsum
(G, k)
given:
S
u
v
w
x
000001
000010
000100
001000
010000
100011
101101
110110
111000
t
222222
(G, k) ∈ vc =⇒
vertexcover ≤p subsetsum
given:
(G, k)
u
w
v
x
f
f((G, k)) ∈ subset =⇒
(bi , av , t) ∈ subset =⇒
number every edge
i
∀i ∈ [0, m − 1] bi = 4
�
m
i
∀v ∈ V av = 4 +
4
m−1
�
i∈E(v)
m
i
2·4
set t = k4 +
i=0
vertexcover ≤p subsetsum
(bi , av , t) ∈ subset =⇒
000001
000010
000100
001000
010000
100011
101101
110110
111000
222222
extra credit
(G, k)
u
v
w
x
MORE EXAMPLES
PROBLEMS WE KNOW
CLIQUE
CLIQUE PROBLEM (G,K)
WE WANT TO DETERMINE
THE HARDNESS OF CLIQUE
WE WANT TO STUDY THE
HARDNESS OF CLIQUE
CLIQUE
INDY SET
≤
INDY
SET
p
≤p
CLIQUE
INDY SET
≤p
CLIQUE
INDY SET
≤p
CLIQUE
EXTRA CREDIT
GADGET
RUDRATA PATH
kavyalankara
KNIGHT’S TOUR
GIVEN
does
GOAL:
relate vertex cover and hamiltonian path
VERTEX
HAMPATH
≤p HAMPATH
≤p VERTEX
vertexcover ≤ hampath
what must we do?
vertexcover ≤ hampath
(G, k)
u
v
w
x
u
v
w
x
(u,v)
u
(u,w)
w
v
(v,w)
x
1
(u,v)
u
v
(u,w)
(v,w)
(w,x)
w
x
2
1
(u,v)
u
v
(u,w)
(v,w)
(w,x)
w
x
2
1
(u,v)
(v,u)
1
(v,u)
u
v
u
(u,w)
w
w
x
G
v
(v,w)
(v,x)
(u,w)
x
(w,u)
G
�
(w,v)
(v,w)
(v,x)
(w,v)
(x,v)
(x,v)
(w,x)
(w,u)
2
(x,w)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
Vertex chains are colored to match their corresponding vertices.
(w,x)
The transformation from G to G� takes at most O(n2 ) time, so the Hamiltonian cycle problem is
NP-hard. Moreover, since we can easily verify a Hamiltonian cycle in linear time, the Hamiltonian
cycle problem is in NP, and therefore NP-complete.
A closely related problem to Hamiltonian cycles is the famous traveling salesman problem—
Given a weighted graph G, find the shortest cycle that visits every vertex. Finding the shortest cycle
is obviously harder than determining if a cycle exists at all, so the traveling salesman problem is
also NP-hard.
2
(x,w)
21.11 Subset Sum (from Vertex Cover)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
The last problem that we will prove NP-hard is the S UBSET S UM problem considered in the very first
Vertex
colored
match
their
corresponding
vertices.
lecture on recursion: Given
a set X chains
of integersare
and an
integer t, to
determine
whether
X has
a subset
whose elements sum to t.
To prove this problem is NP-hard, we apply a reduction from the vertex cover problem. Given
� it into set of integers X and an2integer t, such
a graph G and an integer k, we need to transform
The transformation from G to G takes at most O(n ) time, so the Hamiltonian cycle problem is
1
(u,v)
(v,u)
1
(v,u)
u
v
u
(u,w)
w
w
x
G
v
(v,w)
(v,x)
(u,w)
x
(w,u)
G
�
(w,v)
(v,w)
(v,x)
(w,v)
(x,v)
(x,v)
(w,x)
(w,u)
2
(x,w)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
Vertex chains are� colored to match their corresponding vertices.
(G, K) ∈ vc ⇐⇒ G ∈ hampath
(w,x)
The transformation from G to G� takes at most O(n2 ) time, so the Hamiltonian cycle problem is
NP-hard. Moreover, since we can easily verify a Hamiltonian cycle in linear time, the Hamiltonian
cycle problem is in NP, and therefore NP-complete.
A closely related problem to Hamiltonian cycles is the famous traveling salesman problem—
Given a weighted graph G, find the shortest cycle that visits every vertex. Finding the shortest cycle
is obviously harder than determining if a cycle exists at all, so the traveling salesman problem is
also NP-hard.
2
(x,w)
21.11 Subset Sum (from Vertex Cover)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
The last problem that we will prove NP-hard is the S UBSET S UM problem considered in the very first
Vertex
colored
match
their
corresponding
vertices.
lecture on recursion: Given
a set X chains
of integersare
and an
integer t, to
determine
whether
X has
a subset
whose elements sum to t.
To prove this problem is NP-hard, we apply a reduction from the vertex cover problem. Given
� it into set of integers X and an2integer t, such
a graph G and an integer k, we need to transform
The transformation from G to G takes at most O(n ) time, so the Hamiltonian cycle problem is
1
(u,v)
(v,u)
1
(v,u)
u
v
u
(u,w)
w
w
x
G
v
(v,w)
(v,x)
(u,w)
x
(w,u)
G
�
(w,v)
(v,w)
(v,x)
(w,v)
(x,v)
(x,v)
(w,x)
(w,u)
2
(x,w)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
Vertex chains are� colored to match their corresponding vertices.
(G, K) ∈ vc ⇐⇒ G ∈ hampath
(w,x)
The transformation from G to G� takes at most O(n2 ) time, so the Hamiltonian cycle problem is
NP-hard. Moreover, since we can easily verify a Hamiltonian cycle in linear time, the Hamiltonian
cycle problem is in NP, and therefore NP-complete.
A closely related problem to Hamiltonian cycles is the famous traveling salesman problem—
Given a weighted graph G, find the shortest cycle that visits every vertex. Finding the shortest cycle
is obviously harder than determining if a cycle exists at all, so the traveling salesman problem is
also NP-hard.
2
(x,w)
21.11 Subset Sum (from Vertex Cover)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
The last problem that we will prove NP-hard is the S UBSET S UM problem considered in the very first
Vertex
colored
match
their
corresponding
vertices.
lecture on recursion: Given
a set X chains
of integersare
and an
integer t, to
determine
whether
X has
a subset
whose elements sum to t.
To prove this problem is NP-hard, we apply a reduction from the vertex cover problem. Given
� it into set of integers X and an2integer t, such
a graph G and an integer k, we need to transform
The transformation from G to G takes at most O(n ) time, so the Hamiltonian cycle problem is
1
(u,v)
(v,u)
1
(v,u)
u
v
u
(u,w)
w
w
x
v
(v,w)
(v,x)
(u,w)
x
(w,u)
(w,v)
(v,w)
(v,x)
(w,v)
(x,v)
(x,v)
(w,x)
(w,u)
2
(x,w)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
Vertex chains are colored to match their corresponding vertices.
(w,x)
The transformation from G to G� takes at most O(n2 ) time, so the Hamiltonian cycle problem is
NP-hard. Moreover, since we can easily verify a Hamiltonian cycle in linear time, the Hamiltonian
cycle problem is in NP, and therefore NP-complete.
A closely related problem to Hamiltonian cycles is the famous traveling salesman problem—
Given a weighted graph G, find the shortest cycle that visits every vertex. Finding the shortest cycle
is obviously harder than determining if a cycle exists at all, so the traveling salesman problem is
also NP-hard.
2
(x,w)
21.11 Subset Sum (from Vertex Cover)
The original graph G with vertex cover {v, w}, and the transformed graph G� with a corresponding Hamiltonian cycle.
The last problem that we will prove NP-hard is the S UBSET S UM problem considered in the very first
Vertex
colored
match
their
corresponding
vertices.
lecture on recursion: Given
a set X chains
of integersare
and an
integer t, to
determine
whether
X has
a subset
whose elements sum to t.
To prove this problem is NP-hard, we apply a reduction from the vertex cover problem. Given
� it into set of integers X and an2integer t, such
a graph G and an integer k, we need to transform
The transformation from G to G takes at most O(n ) time, so the Hamiltonian cycle problem is
COMMON
PROPERTIES
DEFINITION OF NP
a language L belongs to the class NP iff
WHY IS VC IN NP?
7
6
2
1
4
8
3
9
5
vertexcover(G,k)
WHY IS TRIPLETS IN NP?
(x1 , x2 , . . . , xn )
What is a reduction?
Why study reductions?
How does one reduce problem A to problem B?
Describe one reduction discussed in class today
userid: