welcome: please sign in
location: attachment:GraphColouring.core.asp.txt of EncodingsExamples

Attachment 'GraphColouring.core.asp.txt'

Download

   1 % Guess colours.
   2 chosenColour(N,C) v notChosenColour(N,C) :- node(N), colour(C).
   3 
   4 % At least one color per node.
   5 :- node(X), not colored(X).
   6 colored(X) :- chosenColour(X,_).
   7 
   8 % Only one color per node.
   9 :- chosenColour(N,C1), chosenColour(N,C2), C1!=C2. 
  10 
  11 % No two adjacent nodes have the same colour. 
  12 :- link(X,Y),  X<Y, chosenColour(X,C), chosenColour(Y,C).

Attached Files

You are not allowed to attach a file to this page.