
Boost Users : 
Subject: Re: [Boostusers] Dijkstra example
From: Cedric Laczny (cedric.laczny_at_[hidden])
Date: 20110607 03:19:58
Hi,
On Tuesday, 7. June 2011 00:32:33 David Doria wrote:
> I tried to modify this example:
>
> http://www.boost.org/doc/libs/1_34_0/libs/graph/example/dijkstraexample.cp
> p
>
> to create the graph in a clearer fashion:
> http://codepad.org/DDKs45oe
>
> However, I now get compiler errors inside dijkstra_shortest_paths.hpp
>
> Can anyone see where I have gone wrong?
Was not yet able to look at it.
>
> Also, I don't really understand the "distances and parents" output  I
> just want to know the shortest path between two vertices. In fact I
> don't even see the start and end vertices specified in the original
> example?
You should perhaps have a look at the description of this function of the
boostlibrary again, where it says:
Dijkstra's algorithm finds all the shortest paths from the source vertex to
every other vertex by iteratively ``growing'' the set of vertices S to which
it knows the shortest path.
s.
http://www.boost.org/doc/libs/1_34_0/libs/graph/doc/dijkstra_shortest_paths.html
This basically means that you only need to specify the source vertex (called
"s" in the example), and no end vertex.
To get your shortest path, you would simply start with your endvertex of
choice, go to is predecessor, to the predecessor of the predecessor and so on
until you find your startvertex (this is called backtracking, IIRC). Here
again, I would suggest you to read the documentation again (s. above)
>
> Thanks,
>
> David
> _______________________________________________
> Boostusers mailing list
> Boostusers_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boostusers
Hope that helps.
Best,
Cedric
Boostusers list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net