Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are...

12
COMPUTABILITY AND COMPLEXITY, 2020 FALL SEMESTER Lec 11. More on NP-completeness Eunjung Kim

Transcript of Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are...

Page 1: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

COMPUTABILITY AND COMPLEXITY, 2020 FALL SEMESTER

Lec 11. More onNP-completeness

Eunjung Kim

Page 2: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: SAT TO 3SAT

THE FOLLOWING PROBLEMS ARE NP-COMPLETE

3SAT

INDEPENDENT SET

3-COLORING

DIRECTED HAMILTONIAN PATH

COMPUTABILITY & COMPLEXITY 1 / 11

Page 3: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: SAT TO 3SAT

PROBLEM 3SATINPUT a 3-CNF formula ϕ

QUESTION is there a satisfying assignment to the variables of ϕ?

KEY STEP IN THE REDUCTION

C = (x1 ∨ x̄2 ∨ x3 ∨ x̄4) C1 = (x1 ∨ x̄2) ∪ z), C2 = (x3 ∨ x̄4 ∪ z̄)

COMPUTABILITY & COMPLEXITY 2 / 11

Page 4: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: SAT TO 3SAT

Replace each clause C with i ≥ 4 literals by two clauses C1,C2.

C1,C2 are (simultaneously satisfied) if and only if C is satisfied .

How to: divide the literals of C roughly into two equal parts, and add anew variable z to toggle

COMPUTABILITY & COMPLEXITY 3 / 11

Page 5: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: 3SAT TO IND

An independent set I of a graph is a vertex subset I of G s.t. any two verticesu, v ∈ I is non-adjacent.

PROBLEM INDEPENDENT SET

INPUT a graph G and an integer kQUESTION does G have an independent set of size (at least) k?

COMPUTABILITY & COMPLEXITY 4 / 11

Page 6: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: 3SAT TO IND

KEY STEP IN THE REDUCTION

For each variable xi , create two vertices vi and v ′i (correspond to

positive and negative literals).

For a clause Ci = (x ∨ y ∨ z) in the 3-CNF formula φ, create 7 vertices.

Each of 7 vertices corresponds to satisfying partial assignments.

Incompatible assignments between two clauses is expressed as anedge.

COMPUTABILITY & COMPLEXITY 5 / 11

Page 7: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: 3SAT TO 3-COLORING

A 3-Coloring of a graph G = (V ,E) is a mapping from V to{red , yellow ,green} such that each color class is an independent set.

PROBLEM 3-COLORING

INPUT a graph G.QUESTION does G have 3-Coloring?

COMPUTABILITY & COMPLEXITY 6 / 11

Page 8: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: 3SAT TO 3-COLORINGvariable gadgets the x. y ,z , a. b. c .

.. these vertices

U,a-• v.

' in the clause gadgets are

provided by VVV'

ve now!douse gadgets ⇐ cxvyvz)→ To Ug

'

d

.

X•-•

" TT.

-•

Ni ow Ni'

y •- ⑨ /Z •--•

:) '

÷t

Una .- Uni a•-

of-•

Une o_0 Un' b •- ⑨ /

un .- on, c .--• )i.

COMPUTABILITY & COMPLEXITY 7 / 11

Page 9: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: 3SAT TO DIRECTED

HAMILTONIAN PATH

A Hamiltonian path of a directed graph G = (V ,E) is a directed path whichvisits every vertex of G precisely once.

PROBLEM DIRECTED HAMILTONIAN PATH

INPUT a graph G.QUESTION does G have a Hamiltonian path?

COMPUTABILITY & COMPLEXITY 8 / 11

Page 10: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: 3SAT TO DIRECTED

HAMILTONIAN PATH

variable

gadgets sootart

v. oo-j.gg#ozgIs.&aIooI.&I.F#÷ clauses

As •T→Jf•#•#•••••at VA Vito '

o, •⇐.gg#ozso.a.IiaIoE& ÷::*,

v.4.o-j.gg#o#•¥••••e¥•' clauses

: Ivrea Vita)v. oo-j.gg#e3foyooJoI.yI.T

• end .

COMPUTABILITY & COMPLEXITY 9 / 11

Page 11: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REDUCTION: 3SAT TO DIRECTED

HAMILTONIAN PATH

variable CU, Vaz viz )CVzVTt3VV4) (Td, ✓Varig)

gadgets• sootart

••

n¥÷⇐t! ...v. [email protected] r

v, •-#J&#o•#•8•• clauses

v.4.o-j.gg#o#•#••••¥s¥•' clauses

:

v. oo-j.gg#ozg&oyomIoEo.yI.T

• end .

COMPUTABILITY & COMPLEXITY 10 / 11

Page 12: Lec 11. More on NP-completenesskim/lecture/... · 2020. 12. 16. · the following problems are np-complete 3sat independent set 3-coloring directed hamiltonian path computability

REFERENCE

For Class NP, polynomial-time many-one reduction, Karp-LevinTheorem, and other NP-complete problems, see Chapter 2 ofComputational Complexity - A Modern Approach: Sanjeev Arora, BoazBarak (2009), pdf.

COMPUTABILITY & COMPLEXITY 11 / 11