Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connected(X, Y) :-
- edge(X, Y); edge(Y, X).
- path(X, Y, Path) :-
- path(X, Y, [X, Y], P1),
- Path = [X|P1].
- path(X, Y, _, Path) :-
- connected(X, Y),
- Path = [Y].
- path(X, Y, Visited, Path) :-
- connected(X, Z),
- not(member(Z, Visited)),
- path(Z, Y, [Z|Visited], P1),
- Path = [Z|P1].
Add Comment
Please, Sign In to add comment