Update graph coloring example with placeholders

This replaces the former graph coloring example with a new formulation
that makes use of the newly supported placeholders.
This commit is contained in:
Patrick Lühne 2018-04-08 20:28:04 +02:00
parent c294a29cb2
commit a406cb43bd
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 8 additions and 11 deletions

View File

@ -1,12 +1,9 @@
colored(V, red) :- vertex(V), not colored(V, green), not colored(V, blue).
colored(V, green) :- vertex(V), not colored(V, red), not colored(V, blue).
colored(V, blue) :- vertex(V), not colored(V, red), not colored(V, green).
#external color(1).
#external edge(2).
#external vertex(1).
#show color/2.
:- edge(V1, V2), colored(V1, C), colored(V2, C).
vertex(a).
vertex(b).
vertex(c).
edge(a, b).
edge(a, c).
{color(V,C)} :- vertex(V), color(C).
covered(V) :- color(V, _).
:- vertex(V), not covered(V).
:- color(V1,C), color(V2,C), edge(V1,V2).