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:
parent
c294a29cb2
commit
a406cb43bd
@ -1,12 +1,9 @@
|
|||||||
colored(V, red) :- vertex(V), not colored(V, green), not colored(V, blue).
|
#external color(1).
|
||||||
colored(V, green) :- vertex(V), not colored(V, red), not colored(V, blue).
|
#external edge(2).
|
||||||
colored(V, blue) :- vertex(V), not colored(V, red), not colored(V, green).
|
#external vertex(1).
|
||||||
|
#show color/2.
|
||||||
|
|
||||||
:- edge(V1, V2), colored(V1, C), colored(V2, C).
|
{color(V,C)} :- vertex(V), color(C).
|
||||||
|
covered(V) :- color(V, _).
|
||||||
vertex(a).
|
:- vertex(V), not covered(V).
|
||||||
vertex(b).
|
:- color(V1,C), color(V2,C), edge(V1,V2).
|
||||||
vertex(c).
|
|
||||||
|
|
||||||
edge(a, b).
|
|
||||||
edge(a, c).
|
|
||||||
|
Loading…
Reference in New Issue
Block a user