CSE505/Assignment1/A/cycle.P
2024-02-22 17:33:26 -05:00

9 lines
123 B
OpenEdge ABL

edge(1,2).
edge(2,1).
edge(1,3).
path(X,Y) :- edge(X,Y).
path(X,Y) :- edge(X,Z), path(Z,Y), !.
cycle(X) :- path(X,X), !.