Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate an n-Sudoku graph
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. |
The first few sudoku graphs on differently sized sudoku boards:
In[1]:= |
Out[1]= |
The Sudoku graph is automatically laid out in the order of the cell numeration on the Sudoku board:
In[2]:= |
Out[2]= |
Highlight the vertex 1:
In[3]:= |
Out[3]= |
Highlight the edge 16:
In[4]:= |
Out[4]= |
Label individual vertices:
In[5]:= |
Out[5]= |
Label all vertices:
In[6]:= |
Out[6]= |
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]= |
Find a vertex coloring of a sudoku graph:
In[9]:= |
In[10]:= |
Out[10]= |
This work is licensed under a Creative Commons Attribution 4.0 International License