Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- short_path(X, Y, L):- short_path_imp([[X]], Y, L).
- short_path_imp(L, Y, R):- add_v(L, [], V), member(RX,V), last(RX,T),T=Y,!,member(R,V), last(R,T),T=Y.
- short_path_imp(L, Y, R):- add_v(L, [], V), short_path_imp(V,Y,R).
- add_v([X|R], S, L):- pathesfrom(X, V), append(V, S, S1), add_v(R, S1, L).
- add_v([], L, L).
- pathesfrom(X, List):- last(X, S), findall(L, pathfrom(X, S, L), List).
- pathfrom(X, S, L):- edgeX(S, A, _), not_member(A, X), append(X, [A], L).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement