34 lines
722 B
Plaintext
34 lines
722 B
Plaintext
|
arc(1, (2; 3)).
|
||
|
arc(2, 3).
|
||
|
|
||
|
% Collect the vertices
|
||
|
vertex(X) :- arc(X, _).
|
||
|
|
||
|
% Symmetry (undirected graph)
|
||
|
arc(X, Y) :- arc(Y, X).
|
||
|
|
||
|
% Representation 1:
|
||
|
% #show red/1. #show green/1. #show blue/1.
|
||
|
% red(Vertex), green(Vertex), blue(Vertex) :- vertex(Vertex).
|
||
|
% % Remove the dupes
|
||
|
% :- red(V1), red(V2), V1 != V2.
|
||
|
% :- green(V1), green(V2), V1 != V2.
|
||
|
% :- blue(V1), blue(V2), V1 != V2.
|
||
|
% Remove the adjacent edges with same color
|
||
|
% :- arc(X, Y), red(X), red(Y).
|
||
|
% :- arc(X, Y), green(X), green(Y).
|
||
|
% :- arc(X, Y), blue(X), blue(Y).
|
||
|
|
||
|
|
||
|
% Representation 2:
|
||
|
% #const n = 6.
|
||
|
|
||
|
% #show color/2.
|
||
|
|
||
|
% { color(X,1..n) } = 1 :- vertex(X).
|
||
|
% :- arc(X,Y), color(X,C), color(Y,C).
|
||
|
|
||
|
|
||
|
|
||
|
% Representation 3:
|
||
|
% TODO don't need to give it an n
|