:- use_module(library(clpfd)).
:- use_module(library(lists)).

hc(Path) :-
         graph(Nodes, Edges),length(Nodes, N),
         length(Path, N),
         set_domains(Path, 1, Edges),
         circuit(Path),
         labeling([ff], Path).
set_domains([], _, _ ).
set_domains([X_I | Path], I, Edges) :-
         findall(Z, member([I,Z], Edges), [S|Ucc]),
         convert([S|Ucc],Domain),
         X_I in Domain,
         I1 is I+1, set_domains(Path, I1, Edges).
convert([A],{A}) :-!.
convert([A|R],{A} \/ S) :- convert(R,S).
