Subject: RE:

From: "Douglas R. Miles" <[email-masked]>
Date: Tue, 12 Dec 2000 19:48:47 -0800

Kevin,

My favorite prolog traceroute is implemented in Sicstus as ugraph or wgraph
in the library directories.

min_path(+V1, +V2, +Graph, -Path, -Cost) 
	Path is a shortest path of cost Cost from V1 to V2 in Graph. Takes
O(N^2) time. 
min_paths(+Vertex, +Graph, -Tree) 
	Tree is a tree of all the shortest paths from Vertex to every other
vertex in Graph. This is the single-source shortest paths problem. 
path(+Vertex, +Graph, -Path) 
	Given a Graph and a Vertex of Graph, returns a maximal Path rooted
at Vertex, enumerating more paths on backtracking. 

http://clwww.essex.ac.uk/manuals/sicstus-3.7/sicstus_26.html  It is easily
used in SWI.

% Douglas

-----Original Message-----
From: Richard A. O'Keefe [mailto:[email-masked]]
Sent: Monday, December 11, 2000 3:03 PM
To: [email-masked]; [email-masked]
Subject: Re:

"Kevin Dunne" <[email-masked]> wrote
that he is trying to write a public transport route finding 
program in Prolog.

	I have written up all my facts and rules about all these
	different things but I am having real trouble trying to write
	the code to input a source and a destination and to search
	through all of my data, to find the easiest way to get from
	source to destination using whatever transport available???
	Any ideas anybody
	
Open any good data structures and algorithms textbook (Cormen, 
Leiserson,
and Rivest is an *extremely* good one), turn to the index, and look up
"shortest path".  You will find several algorithms given, depending on
whether you want to find the shortest path for a given pair or for all
pairs.

----------------
* To UNSUBSCRIBE, please use the HTML form at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist

or send mail to [email-masked] using the 
Subject: "unsubscribe"
(without the quotes) and *no* message body.

** An ARCHIVE of this list is maintained at

    http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/