This code solves the 9x9 Sudoku puzzle by treating it as a Graph Coloring and a Constraint Satisfaction Problem.

First a constraint graph of the board is drawn and each square can be colored in 10 ways (0-9) with the squares connected by an edge getting different colors.


(Image from Google Search Results)