Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. short_path(X, Y, L):- short_path_imp([[X]], Y, L).
  2.  
  3. 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.
  4. short_path_imp(L, Y, R):- add_v(L, [], V), short_path_imp(V,Y,R).
  5.  
  6. add_v([X|R], S, L):- pathesfrom(X, V), append(V, S, S1), add_v(R, S1, L).
  7. add_v([], L, L).
  8.  
  9. pathesfrom(X, List):- last(X, S), findall(L, pathfrom(X, S, L), List).
  10. 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