Post on 27-Jul-2015
3-Coloring is NP-Hard
Feliciano colella
December 4, 2014
Algorithm Design Homework 02
Outline of the presentation
1. De�nition of 3-Satis�ability.
2. De�nition of 3-Coloring.
3. Proof that 3-Sat ≤P 3-Color.
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 2 / 8
Algorithm Design Homework 02
The problems
3-Satis�ability
Input CNF formula Φ where each clause contains exactly 3 di�erent
literals.
Output Satisfying truth assignment for the formula Φ.
k-Coloring
Input A graph G = (V ,E ) with |V | = n vertices and |E | = medges.
Output A k-Coloring c : V → {1, . . . , k}, s.t.∀(x , y) ∈ E , C (x) 6= C (y).
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 3 / 8
Algorithm Design Homework 02
The problems
3-Satis�ability
Input CNF formula Φ where each clause contains exactly 3 di�erent
literals.
Output Satisfying truth assignment for the formula Φ.
k-Coloring
Input A graph G = (V ,E ) with |V | = n vertices and |E | = medges.
Output A k-Coloring c : V → {1, . . . , k}, s.t.∀(x , y) ∈ E , C (x) 6= C (y).
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 3 / 8
Algorithm Design Homework 02
The reduction
3-Coloring is in NP
Certi�cate A 3-Coloring c : V → {1, 2, 3}Certi�er Check if ∀(u, v) ∈ E , c(u) 6= c(v)
Hardness
I Show that the formula Φ is satis�able IFF exist a 3-Coloring for the
graph G .
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 4 / 8
Algorithm Design Homework 02
The gadgets
Literals Gadget Clause gadget
x1 ¬x1
x2 ¬x2
xn ¬xn
R
T
F
ci1 ci2 ci3
R
T
F
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 5 / 8
Algorithm Design Homework 02
The gadgets
Literals Gadget Clause gadget
x1 ¬x1
x2 ¬x2
xn ¬xn
R
T
F
ci1 ci2 ci3
R
T
F
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 5 / 8
Algorithm Design Homework 02
The gadgets
Literals Gadget Clause gadget
x1 ¬x1
x2 ¬x2
xn ¬xn
R
T
F
ci1 ci2 ci3
R
T
F
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 5 / 8
Algorithm Design Homework 02
The construction
x1 ¬x1
x2 ¬x2
xn ¬xn
R
T
F
c13
c12
c11
c23
c22
c21
c`3
c`2
c`1
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 6 / 8
Algorithm Design Homework 02
The theorem
TheoremA CNF Formula Φ is satis�able ⇐⇒ exists a 3-Coloring for the graph GΦ.
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 7 / 8
Algorithm Design Homework 02
The theorem
TheoremA CNF Formula Φ is satis�able ⇐⇒ exists a 3-Coloring for the graph GΦ.
Φ is satis�able =⇒ GΦ is 3-Colorable
I Take a truth assignment φ for Φ and color the literals gadgets;
I Each clause have at least 1 literal set to True;
I All the clause gadget can be colored with respect to the constraint;
I We have a 3-Coloring.
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 7 / 8
Algorithm Design Homework 02
The theorem
TheoremA CNF Formula Φ is satis�able ⇐⇒ exists a 3-Coloring for the graph GΦ.
GΦ is 3-Colorable =⇒ Φ is satis�able
I Take a 3-Coloring for GΦ;
I If a literal is colored with True, set it to True in the formula Φ;
I For any clause, it cannot be that all the literals are True or False.
Otherwise we would have a clause gadget colored to False, but this is
impossible since they are connected to Base and False and we have
started from a 3-Coloring for GΦ;
I We have hence correct a truth assignment for Φ
Feliciano colella 3-Coloring is NP-Hard December 4, 2014 7 / 8
Thank you for the attention.