← Student tools · Problem 31 · Lecture 12 · Round 2 (30 pts)

3COLOR is NP-complete · 3SAT → 3COLOR

Variable gadgets + OR-gadgets. Graph is 3-colorable iff formula is satisfiable.

CLO-4R2·30 ptsL12
🔊 Listen

3COLOR = {⟨G⟩ : G is 3-colorable} — assign one of 3 colors to each vertex so no edge has same-colored endpoints. This is NP-complete via a gadget reduction from 3SAT.

Three colors with logical meaning

Label the three colors T (true), F (false), B (base). The construction includes a fixed "palette triangle" so the three colors are globally distinguishable.

Variable gadget

For each variable xi: a triangle on three nodes (xi, ¬xi, B). Three mutually-connected nodes need three different colors; with B fixed to base, xi and ¬xi are forced to take T and F (one each). That's the Boolean encoding — colorings ↔ assignments.

OR gadget for clause (a ∨ b ∨ c)

A specific 5-node sub-graph wired so that the gadget is 3-colorable iff at least one of a, b, c is colored T. The wiring forces "if all three inputs are F, no valid coloring exists; otherwise some valid coloring exists."

Combine n variable triangles with m OR gadgets: total O(n + m) nodes, O(n + m) edges. The graph is 3-colorable iff every clause has ≥ 1 true literal iff φ is satisfiable.

🔊 Listen
Build the gadget piece by piece Auto-plays
🔊 Listen
🔊 Listen
🔊 Listen

Sipser: §7.5, Exercise 7.27 / Karp's original. Lecture notes: Module 5 slide 5. Companion problems: P27 (3SAT → CLIQUE), P28 (CLIQUE → VC).