(This article was first published on

**Xi'an's Og » R**, and kindly contributed to R-bloggers)**I**n a paper arXived on Friday, Roberto Fontana relates the generation of Sudoku grids to the one of Latin squares (which is unsurprising) and to maximum cliques of a graph (more surprising). The generation of a random Latin square proceeds in three steps:

- generate a random Latin square L with identity permutation matrix on symbol 1 (in practice, this implies building the corresponding graph and picking one of the largest cliques at random);
- modify L into L’ using a random permutation of the symbols 2,…,n in L’;
- modify L’ into L” by a random permutation of the columns of L’.

**A** similar result holds for Sudokus (with the additional constraint on the regions). However, while the result is interesting in its own right, it only covers full Sudokus, rather than partially filled Sudokus with a unique solution, whose random production could be more relevant. (Or maybe not, given that the difficulty matters.) *[The code uses some R packages, but then moves to SAS, rather surprisingly.] *

Filed under: Books, R, Statistics Tagged: arXiv, cliques, graphs, sudoku

To

**leave a comment**for the author, please follow the link and comment on his blog:**Xi'an's Og » R**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...