Title: Black-box (oracle)
1Black-box (oracle)
Feed me a weighted graph G and I will tell you
the weight of the max-weight matching of G.
2Black-box (oracle)
5
Feed me a weighted graph G and I will tell you
the weight of the max-weight matching of G.
2
2
3Black-box (oracle)
5
Feed me a weighted graph G and I will tell you
the weight of the max-weight matching of G.
2
2
5
4Black-box (oracle)
Feed me a weighted graph G and I will tell you
the weight of the max-weight matching of G.
here is a graph G, find the max-weight matching
G
5Black-box (oracle)
here is a graph G, find the max-weight matching
Feed me a weighted graph G and I will tell you
the weight of the max-weight matching of G.
pick a vertex u?V(G) for each edge u,v?E(G)
w?undefined if oracle(G-u-v)
w(u,v) oracle (G) then w?v if w is
undefined then recurse on (G-u) else
print(u,w) recurse on (G-u-v)
63-SAT
x variable ?x negation of a variable
literals
clause disjunction of literals
x ? ? y ? z ? x ? z
73-SAT
INSTANCE collection C of clauses, each
clause has at most 3 literals QUESTION
does there exist an assignment of true/false
to the variables which satisfies all the
clauses in C
83-SAT
INSTANCE collection C of clauses, each
clause has at most 3 literals QUESTION
does there exist an assignment of true/false
to the variables which satisfies all the
clauses in C
x ? y ? z x ? y ? ?z x ? ?y ?x
9Independent Set
subset S of vertices such that no two vertices in
S are connected
10Independent Set
subset S of vertices such that no two vertices in
S are connected
11Independent Set
OPTIMIZATION VERSION
INSTANCE graph G SOLUTION independent set S in
G MEASURE maximize the size of S
DECISION VERSION
INSTANCE graph G, number K QUESTION does G have
independent set of size ?
K
12Independent Set ? 3-SAT
is easier than if we have a black-box for
3-SAT then we can solve Independent Set in
polynomial time
Independent Set reduces to 3-SAT
13Independent Set ? 3-SAT
if we have a black-box for 3-SAT then we can
solve Independent Set in polynomial time
Give me a 3-SAT formula and I will tell you if it
is satisfiable
We would like to solve the Independent Set
problem using the black box in polynomial time.
14Independent Set ? 3-SAT
Give me a 3-SAT formula and I will tell you if it
is satisfiable
Graph G, K ? 3-SAT formula F
efficient transformation (i.e., polynomial
time) G has independent set of size ? K ? F is
satisfiable
15Independent Set ? 3-SAT
Give me a 3-SAT formula and I will tell you if it
is satisfiable
Graph G, K ? 3-SAT formula F
V 1,...,n
variables x1,....,xn E edges
? xi? ? xj for ij? E
we need to ensure that ? K of the xi are TRUE
163-SAT ? Independent Set
Give me a graph G and a number K and I will tell
you if G has independent set of size ? K
3-SAT formula F ? graph G, number K
173-SAT ? Independent Set
Give me a graph G and a number K and I will tell
you if G has independent set of size ? K
3-SAT formula F ? graph G, number K
x ? ?y ? z
w ? y ? ?z
?y
y
z
w
?z
x
183-SAT ? Independent Set
3-SAT formula F ? graph G, number K
x ? ?y ? z
w ? y ? ?z
?y
y
z
w
?z
x
- efficiently computable
- F satisfiable ? ? IS of size ? m
- ? IS of size ? m ? F satisfiable
193-SAT ? Independent Set Independent Set ? 3-SAT
if 3-SAT is in P then Independent Set is in P if
Independent Set is in P then 3-SAT is in P
3-SAT Independent Set
20Many more reductions
Clique Subset-Sum 3-COL Planar 3-COL Hamiltonian
path
3-SAT Independent Set
21P and NP
P decision problems that can be solved
in polynomial time. NP decision problems for
which the YES answer can be certified
and this certificate can be verified in
polynomial time.
22NP decision problems for which the YES
answer can be certified and this
certificate can be verified in polynomial
time.
3-SAT Independent Set
NOT-3-SAT ?
23NP decision problems for which the YES
answer can be certified and this
certificate can be verified in polynomial
time.
COOKS THEOREM
Every problem A? NP A ? 3-SAT
24NP decision problems for which the YES
answer can be certified and this
certificate can be verified in polynomial
time.
B is NP-hard
if every problem A? NP A ? B
B is NP-complete
if B is NP-hard, and B is in NP
25NP-hard
NP-complete
P
NP
26Some NP-complete problems
Clique Subset-Sum 3-COL Planar 3-COL Hamiltonian
path
3-SAT Independent Set
27Clique
subset S of vertices such that every two vertices
in S are connected
28Clique
INSTANCE graph G, number K QUESTION
does G have a clique of size ? K?
29Subset-Sum
INSTANCE numbers a1,...,an,B QUESTIONS
is there S? 1,...,n such that ? ai
B
i?S
303-COL
INSTANCE graph G QUESTION can the
vertices of G be assigned colors
red,green,blue so that no two neighboring
vertices have the same color?
313-SAT ? 3-COL
x ?x
R G
B
B
Gtrue
?y
x
z
G
G
G
R
G
32Planar-3-COL
INSTANCE planar graph G QUESTION can the
vertices of G be assigned colors
red,green,blue so that no two neighboring
vertices have the same color?
333-COL ? Planar-3-COL
344-COL
INSTANCE graph G QUESTION can the
vertices of G be assigned one of 4 colors so
that no two neighboring vertices have the
same color?
353-COL ? 4-COL
363-COL ? 4-COL
?
G
G
37planar 4-COL
INSTANCE planar graph G QUESTION can the
vertices of G be assigned one of 4 colors so
that no two neighboring vertices have the
same color?
planar 3-COL ? planar 4-COL ???
384-COL ? 3-COL
4-COL ? NP Cook ? 4-COL ? 3-SAT 3-SAT? 3-COL
Thus 4-COL ? 3-COL
392-COL ? 3-COL
402-COL ? 3-COL
?
G
G
413-COL ? 2-COL ???
2-COL in P