Skip to main content
QUICK REVIEW

[Paper Review] Random Latin squares and Sudoku designs generation

Roberto Fontana|arXiv (Cornell University)|May 16, 2013
graph theory and CDMA systems6 references4 citations
TL;DR

This paper presents a novel algorithm for uniform random generation of Latin squares and Sudoku designs by modeling them as maximum cliques in specially constructed graphs. Using graph analysis tools like Cliquer, the method efficiently samples from all possible configurations, achieving uniformity by leveraging clique enumeration and permutation-based transformations, with successful implementation up to order n=7 and feasibility for larger n via scalable graph analytics.

ABSTRACT

Uniform random generation of Latin squares is a classical problem. In this paper we prove that both Latin squares and Sudoku designs are maximum cliques of properly defined graphs. We have developed a simple algorithm for uniform random sampling of Latin squares and Sudoku designs. It makes use of recent tools for graph analysis. The corresponding SAS code is annexed.

Motivation & Objective

  • To develop a uniform random sampling method for Latin squares and Sudoku designs, addressing limitations in existing Markov chain-based approaches.
  • To establish a theoretical equivalence between Latin squares and maximum cliques in a defined graph structure, enabling new algorithmic approaches.
  • To implement a practical, efficient algorithm using graph analysis tools (e.g., Cliquer) for exact uniform sampling up to order n=7.
  • To extend the framework to Sudoku designs by modifying the graph structure to respect block constraints.
  • To explore scalability for higher orders using subgraph sampling and modern graph analytics software.

Proposed method

  • Model Latin squares as maximum cliques in a graph where nodes represent derangements (permutations with no fixed points), and edges connect mutually disjoint permutations.
  • Construct a graph 𝒢ₙ with nodes as derangements of {1,…,n}, and edges between derangements that are pairwise disjoint across all positions.
  • For Sudoku designs, define a modified graph 𝔾̃ₙ that enforces block constraints, ensuring valid 3×3 subgrid structure in 9×9 cases.
  • Use graph analysis software (e.g., Cliquer) to enumerate all maximum cliques of size n in 𝒢ₙ or 𝔾̃ₙ, corresponding to valid Latin squares or Sudoku designs.
  • Generate a uniform random Latin square by selecting a random clique, applying random permutations to symbols 2 through n, and permuting columns to achieve full uniformity.
  • For Sudoku, restrict column and row permutations to band/stack permutations to preserve block structure during randomization.

Experimental results

Research questions

  • RQ1Can Latin squares and Sudoku designs be uniformly generated by identifying them as maximum cliques in a properly defined graph?
  • RQ2What is the computational feasibility of enumerating all maximum cliques in such graphs for orders up to n=7?
  • RQ3How does the proposed clique-based method compare in efficiency and uniformity to existing Markov chain Monte Carlo approaches like Jacobson and Matthews (1996)?
  • RQ4To what extent can subgraph sampling be used to approximate uniform sampling for larger orders like n=9 in Sudoku?
  • RQ5Can modern graph analytics tools handle the scale of clique enumeration required for uniform sampling of large Latin squares?

Key findings

  • The paper successfully proves that Latin squares and Sudoku designs correspond exactly to maximum cliques in specially constructed graphs, providing a new theoretical foundation for their generation.
  • For n=7, the algorithm generated 61,479,419,904,000 valid Latin squares by enumerating 16,942,080 maximum cliques in the derangement graph.
  • The method was implemented in SAS and successfully generated a valid 9×9 Sudoku design by sampling from 809 randomly selected Sudoku derangements among 17,972 total.
  • The largest cliques in the 9×9 Sudoku subgraph had size 8, with 73 such maximum cliques identified, confirming structural feasibility.
  • The approach is scalable in principle: recent advances in graph analytics software make uniform sampling for larger n feasible, though computational cost increases with n.
  • The algorithm achieves uniform sampling by leveraging clique enumeration and subsequent random permutations of symbols and columns, ensuring no bias in the final output.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.