Function Repository Resource:

# SudokuGraph

Generate an n-Sudoku graph

Contributed by: Alejandra Ortiz
 ResourceFunction["SudokuGraph"][n] generates an undirected graph with n4 vertices corresponding to the cells of an n2x n2 sudoku board and with edges corresponding to all pairs of cells that belong to the same row, column, or block of the puzzle.

## Details

ResourceFunction["SudokuGraph"] takes the same options as Graph.

## Examples

### Basic Examples (1)

The first few sudoku graphs on differently sized sudoku boards:

 In[1]:=
 Out[1]=

### Scope (1)

The Sudoku graph is automatically laid out in the order of the cell numeration on the Sudoku board:

 In[2]:=
 Out[2]=

### Options (6)

#### GraphHighlight (2)

Highlight the vertex 1:

 In[3]:=
 Out[3]=

Highlight the edge 16:

 In[4]:=
 Out[4]=

#### VertexLabels (2)

Label individual vertices:

 In[5]:=
 Out[5]=

Label all vertices:

 In[6]:=
 Out[6]=

#### VertexSize (2)

By default, the size of vertices is computed automatically:

 In[7]:=
 Out[7]=

Specify the size of all vertices using symbolic vertex size:

 In[8]:=
 Out[8]=

### Applications (1)

Find a vertex coloring of a sudoku graph:

 In[9]:=
 In[10]:=
 Out[10]=

## Publisher

Wolfram Summer School

## Version History

• 1.0.0 – 14 June 2023