|
@@ -3344,25 +3344,26 @@ If you can color the remaining vertices in the graph with the nine
|
|
|
colors, then you have also solved the corresponding game of Sudoku.
|
|
|
Figure~\ref{fig:sudoku-graph} shows an initial Sudoku game board and
|
|
|
the corresponding graph with colored vertices. We map the Sudoku
|
|
|
-number 1 to blue, 2 to yellow, and 3 to red. We only show edges for a
|
|
|
+number 1 to black, 2 to white, and 3 to gray. We only show edges for a
|
|
|
sampling of the vertices (the colored ones) because showing edges for
|
|
|
all of the vertices would make the graph unreadable.
|
|
|
|
|
|
\begin{figure}[tbp]
|
|
|
\includegraphics[width=0.45\textwidth]{figs/sudoku}
|
|
|
-\includegraphics[width=0.5\textwidth]{figs/sudoku-graph}
|
|
|
+\includegraphics[width=0.5\textwidth]{figs/sudoku-graph-bw}
|
|
|
\caption{A Sudoku game board and the corresponding colored graph.}
|
|
|
\label{fig:sudoku-graph}
|
|
|
\end{figure}
|
|
|
|
|
|
-It turns out that some techniques for playing Sudoku correspond to
|
|
|
-heuristics used in graph coloring algorithms. For example, one of the
|
|
|
-basic techniques for Sudoku is called Pencil Marks. The idea is to use
|
|
|
-a process of elimination to determine what numbers are no longer
|
|
|
-available for a square and write down those numbers in the square
|
|
|
-(writing very small). For example, if the number $1$ is assigned to a
|
|
|
-square, then write the pencil mark $1$ in all the squares in the same
|
|
|
-row, column, and region.
|
|
|
+Some techniques for playing Sudoku correspond to heuristics used in
|
|
|
+graph coloring algorithms. For example, one of the basic techniques
|
|
|
+for Sudoku is called Pencil Marks. The idea is to use a process of
|
|
|
+elimination to determine what numbers are no longer available for a
|
|
|
+square and write down those numbers in the square (writing very
|
|
|
+small). For example, if the number $1$ is assigned to a square, then
|
|
|
+write the pencil mark $1$ in all the squares in the same row, column,
|
|
|
+and region to indicate that $1$ is no longer an option for those other
|
|
|
+squares.
|
|
|
%
|
|
|
The Pencil Marks technique corresponds to the notion of
|
|
|
\emph{saturation}\index{subject}{saturation} due to \cite{Brelaz:1979eu}. The
|
|
@@ -3380,10 +3381,10 @@ Using the Pencil Marks technique leads to a simple strategy for
|
|
|
filling in numbers: if there is a square with only one possible number
|
|
|
left, then choose that number! But what if there are no squares with
|
|
|
only one possibility left? One brute-force approach is to try them
|
|
|
-all: choose the first one and if it ultimately leads to a solution,
|
|
|
+all: choose the first one and if that ultimately leads to a solution,
|
|
|
great. If not, backtrack and choose the next possibility. One good
|
|
|
thing about Pencil Marks is that it reduces the degree of branching in
|
|
|
-the search tree. Nevertheless, backtracking can be horribly time
|
|
|
+the search tree. Nevertheless, backtracking can be terribly time
|
|
|
consuming. One way to reduce the amount of backtracking is to use the
|
|
|
most-constrained-first heuristic. That is, when choosing a square,
|
|
|
always choose one with the fewest possibilities left (the vertex with
|