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

From: Joachim Schimpf <jschimpf_at_...311...>
Date: Tue, 08 Oct 2013 13:47:25 +0100
On 07/10/2013 18:57, Paul Cannongeyser wrote:
> ...
> :-lib(ic).
> :-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),
> single_pair_shortest_path(Graph,-1,a,e,Path).
> -----
> 
> (I know now that SourceNode is the source node number (integer) and SinkNode is the sink node number 
> (integer) in the single_pair_shortest_path predicate.)
> 
> How does one use the make_graph_symbolic predicate in the same program as the 
> single_pair_shortest_path predicate?

Translate node name to node number with
http://eclipseclp.org/doc/bips/lib/graph_algorithms/nodename_to_node-3.html


-- Joachim
Received on Tue Oct 08 2013 - 12:47:35 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:21 CEST