Toggle navigation
?
users online
Logout
Open hangout
Open chat for current file
% nacteni: /* ['2.9.1_21.pl']. */ path(A,Z,Graph,Cesta) :- path1(A,[Z],Graph,Cesta). path1(A,[A|Cesta1],_,[A|Cesta1]). path1(A,[Y|Cesta1],Graph,Cesta) :- adjacent(X,Y,Graph), \+ member(X,Cesta1),path1(A,[X,Y|Cesta1],Graph,Cesta). adjacent(X,Y,graph(_,Edges)) :- member(e(X,Y),Edges) ;member(e(Y,X),Edges). graph([a,b,c,d],[e(a,b),e(b,d),e(b,c),e(c,d)]). % demonstracni vypis start:- write('Cesta v grafu'),nl, nl, write('path(a, c, graph, Cesta) : '), graph(Nodes,Edges), path(a, c, graph(Nodes,Edges), Cesta), write(Cesta), nl, nl. ?-start.
true