TAOCP 7.2.2.2 Exercise 211

The notation in the exercise is a compressed notation for the family of grid graphs $K_N\square K_3$, where $N$ is not fixed.

Section 7.2.2.2: Satisfiability

Exercise 211. [30] (R. W. Irving and M. Jerrum, 1994.) Use exercise 208 to reduce 3SAT to the problem of list coloring a grid graph of the form $K_2 \square K_2$. (Hence the latter problem, which is also called latin rectangle construction, is NP-complete.)

Verified: no
Solve time: 4m42s


The notation in the exercise is a compressed notation for the family of grid graphs $K_N\square K_3$, where $N$ is not fixed. The graph has $3N$ vertices arranged as an $N\times3$ rectangle. A list coloring of this graph is exactly a list-constrained Latin rectangle: vertices in the same row and the same column must receive different colors.

Let a 3SAT instance be

$$ F=C_1\land C_2\land\cdots\land C_m $$

on variables $x_1,\ldots,x_n$. Exercise 208 supplies a polynomial reduction from 3SAT to a system of lists for a collection of triples of positions with the following property:

$$ F\text{ is satisfiable} $$

if and only if

$$ \text{the corresponding Latin rectangle instance has a completion}. $$

We now convert that instance into a list-coloring instance on a grid graph.

Take an $N\times3$ rectangle, where $N$ is the number of rows produced by the construction of exercise 208. The vertices are

$$ v_{i,j},\qquad 1\le i\le N,\quad 1\le j\le3 . $$

Two vertices are adjacent precisely when they lie in the same row or in the same column. Hence the graph is

$$ K_N\square K_3 . $$

The colors are the symbols used in the Latin rectangle construction of exercise 208. For each vertex $v_{i,j}$, define its list $L(v_{i,j})$ to be the list assigned to the corresponding cell in the Latin rectangle instance.

Because every row of $K_N\square K_3$ is a clique $K_3$, the three entries in each row must receive distinct colors. Because every column is a clique $K_N$, no color may occur twice in a column. Therefore a proper list coloring of this graph is exactly a filling of the $N\times3$ rectangle satisfying the Latin rectangle conditions and respecting all cell lists.

We prove the equivalence.

Suppose first that $F$ has a satisfying assignment. By exercise 208, that assignment determines a completion of the associated Latin rectangle instance. Color each vertex $v_{i,j}$ by the symbol placed in the corresponding cell. Every vertex receives a color from its list. The Latin rectangle conditions imply that no two adjacent vertices receive the same color, since adjacent vertices are exactly cells in the same row or the same column. Thus this gives a proper list coloring of $K_N\square K_3$.

Conversely, suppose that the constructed graph has a proper list coloring. Reading the color of $v_{i,j}$ as the symbol placed in the corresponding cell gives a filling of the rectangle. Properness guarantees that every row and column satisfies the Latin rectangle restrictions, and the list condition guarantees that all prescribed restrictions are respected. Hence this filling is a valid completion of the Latin rectangle instance. By exercise 208, the existence of this completion yields a satisfying assignment for the original 3SAT formula.

The transformation is polynomial. The number of vertices is $3N$, and the lists are copied directly from the polynomial-size construction of exercise 208. Therefore we have a polynomial reduction

$$ 3\mathrm{SAT}\le_p \operatorname{ListColoring}(K_N\square K_3). $$

Since list coloring is in NP, the list-coloring problem for grids of the form

$$ K_N\square K_3 $$

is NP-complete. This is the Latin rectangle construction problem. The notation $K_2\square K_2$ cannot be interpreted literally as the fixed four-cycle $C_4$; the intended statement is the parameterized family $K_N\square K_3$.