Graph path define issue
问题 The solution ppath(X,Y,M,Path,[Y|Path]) :- edge(X,Y,M),\+ memberchk(Y,Path). path(X,Y,P,SoFar,Path) :- edge(X,W,M), \+ memberchk(W,SoFar), path(W,Y,N,[W|SoFar],Path), P is M+N. pravilo(X,Y,Z) :- aggregate(min(W), P^path(X,Y,W,[],P),Z). Here is the code i have. The question is that starting point is a, and ending point is z. There is an error after execution, the result is displayed like [z, c, h, b]. But the correct answer should [a,b,c,z]. Please help to fix my problem. 回答1: library