reached(X) :- start(X).
reached(X) :- in_hm(_,X).

in_hm(X,Y) v out_hm(X,Y) :- reached(X), arc(X,Y).

:- in_hm(X,Y), in_hm(X,Y1), Y != Y1.
:- in_hm(X,Y), in_hm(X1,Y), X != X1.

:- arc(X,_), not reached(X).

% start -- the initial node of the path, and
% arc -- specifying the input graph
% should be provided in the EDB.
