Re: [eclipse-clp-users] Trying to use single_pair_shortest_path

From: Paul Cannongeyser <paul_dice_2_at_yahoo.com>
Date: Wed, 9 Oct 2013 08:00:28 -0700 (PDT)
----- graph_3.ecl

% Run in this way: top(Path).
/*
Results:
?- top(Path).
Path = 2 - [e(7, 5, 1), e(1, 7, 1)]
Yes (0.00s cpu)

*/

:-lib(graph_algorithms).

top(Path) :-
make_graph_symbolic(
[](a,b,c,d,e,f,g,h,i,j,k,l,m),
[ edge(a,f,1),edge(a,b,1),edge(a,g,1),edge(c,a,1),edge(d,f,1),edge(e,d,1),
  edge(f,e,1),edge(g,e,1),edge(g,j,1),edge(g,c,1),edge(h,g,1),edge(h,i,1),edge(i,h,1),
  edge(j,k,1),edge(j,l,1),edge(j,m,1),edge(l,g,1),edge(l,m,1),edge(m,l,1) ],
Graph),
nodename_to_node(Graph, a, A_node),
nodename_to_node(Graph, e, E_node),
single_pair_shortest_path(Graph,-1,A_node,E_node,Path).
-----

That worked.

Thank you, Joachim.
Received on Wed Oct 09 2013 - 15:00:38 CEST

This archive was generated by hypermail 2.2.0 : Thu Oct 10 2013 - 18:13:13 CEST