I have an assignment about CLP with CT. I had a look at many block sudoku examples. I learnt how to define the list of rows, columns and boxes. However as I understood my problem is different from classical block sudoku examples.
We have a graph G=(V,E) No neighboring vertices have the same number.
gsudoku (Edges,N), label (V).
Output:
?- gsudoku([e(X,Y),e(Y,Z),e(Z,X)],2),label([X,Y,Z]).
false
?- gsudoku([e(X,Y),e(Y,Z),e(Z,X)],3),label([X,Y,Z]).
X=1 Y=2 Z=3 and (other permutations)
Should i think this as 3x3 sudoku examples because i have 3 points?
Could someone please help me how I can solve it? Advance thanks!
For the future readers here is the code:
:- use_module(library(clpfd)).
gsudoku([],_).
gsudoku([e(F,T)|XS],N):- F in 1.. N,
T in 1.. N ,
F #\= T ,
gsudoku(XS,N).