i writing the program who find path in edges but for preventing :
i used "!" sign is returned only one path but i need to return all path and then use shortest pathe631: The predicate 'factorial::fac/2 (i,o), which is declared as 'procedure', is actually 'multi'
how can do it ?
Code: Select all
connected(Window,X,Z):-edge(X,Z,L),L>"0",
draw(Window,X,Z),nVal:=nVal+toterm(L),
stdio::write(X, " to ",Z," by weight ", L," all ",nVal,"\n"),!.
connected(Window,X,Z):-edge(X,Y,L),L>"0",
connected(Window,Y,Z),nVal:=nVal+toterm(L),
stdio::write(X, " to ",Y," by weight ", L," all ",nVal,"\n"),
draw(Window,X,Y),!.
connected(_Window,_X,_Y).