% c-colorability by Ilkka Niemelä % % requires the graph as facts vertex(.) and arc(.,.) % Usage, e.g., % UNIX> graph -ladder 40 2 | cat color.lp - | lparse -1 -c c=3 -d none | smodels 1 % Note graph needs SGB libraries % Using the available graphs % UNIX> cat color.lp graphs/p300 | lparse -1 -c c=4 -d none | smodels color(V,C):- vertex(V), col(C), not othercolor(V,C). othercolor(V,C) :- vertex(V), col(C), col(C1), C != C1, color(V,C1). :- arc(V1,V2), col(C), color(V1,C), color(V2,C). col(1..c).