My assignment: Graph coloring - Write an answer set program to check if a graph had a 4-coloring and, if it does, the answer set should contain the coloring. If there isn't a coloring, it wont have an answer set. The program should consist of the code to do the 4-coloring and a sample graph representation.
I have this (from ASP Graph Coloring Wikipedia), but I don't understand how exactly it works - could someone please explain this code?
c(1..n).
1 {color(X,I) : c(I)} 1 :- v(X).
:- color(X,I), color(Y,I), e(X,Y), c(I).
v(1..100). % 1,...,100 are vertices
e(1,55). % there is an edge from 1 to 55