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

3SAT → HAMPATH · gadget reduction

Variable diamonds + clause spreaders. Path = assignment.

CLO-4R2·30 ptsL12
🔊 Listen

3SAT ≤p HAMPATH (Sipser §7.5). The reduction builds a graph whose Hamiltonian paths correspond to satisfying assignments. Two pieces:

Variable gadget · the diamond

For each variable xi, build a "diamond" — a long row of nodes connected so that a Hamiltonian path must traverse the diamond either left-to-right (encoding xi = true) or right-to-left (encoding xi = false). No mixed traversal possible.

Clause gadget · the spreader

For each clause C, add a single "clause node" cj. Connect cj to specific diamond positions corresponding to literals appearing in C: if xi appears positively, cj connects to a left-to-right edge in xi's diamond; if ¬xi appears, cj connects to a right-to-left edge.

The Hamiltonian path must visit each cj. The only way to do so without breaking the diamond's required traversal is to use an edge that the assigned literal makes "available" — i.e., an edge in a diamond being traversed in the direction matching the clause's literal. So a Hamiltonian path exists iff every clause has at least one true literal.

🔊 Listen
Build the gadget for n=2, m=2 Auto-plays
🔊 Listen
🔊 Listen
🔊 Listen

Sipser: Theorem 7.46, Figures 7.49–7.51. Lecture notes: Module 5 slide 5. Companion problems: P23 (HAMPATH verifier), P29 (SUBSET-SUM).