:- include(randompath1000). % 2nd way of reading input facts :- table path/2. path(X,Y) :- edge(X,Y). % Way 1 %path(X,Y) :- edge(X,Z), path(Z,Y). % Way 2 path(X,Y) :- path(X,Z), edge(Z,Y). % Way 3 %path(X,Y) :- path(X,Z), path(Z,Y). cycle(X) :- path(X,X), !. printPath :- path(X, Y), fail. printPath. timePath :- cputime(X), printPath, cputime(Y), T is Y-X, write(T).