Boost logo

Boost Users :

Subject: Re: [Boost-users] [Graph] How to do multi source shortest path
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-03-07 10:25:19


On Wed, 7 Mar 2012, Gordon Woodhull wrote:

>
>
> On Mar 7, 2012, at 8:27 AM, Leo Hidd <leohidd_at_[hidden]> wrote:
>
>> and how do I create this "super source" vertex? The
>> dijkstra_shortest_paths function takes only one vertex_descriptor, not
>> an array of it (isn't it?).
>
> I meant, just add a special vertex to your graph and connect it with
> zero-weight edges to all the sources you want, and specify that as the
> source. Requires a little bit of detective work at the end to see which
> source a path goes through, but it should get you your answer.

Even that isn't too hard -- keep a predecessor map, then walk up it from
each vertex until you reach one of the source vertices; that will be the
closest one.

-- Jeremiah Willcock


Boost-users 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