Boost logo

Boost :

Subject: [boost] shortest path between vertex A and B
From: Alexandre de Morais Amory (amamory_at_[hidden])
Date: 2010-02-23 15:07:35


Hi,

I am starting to use BGL. I manage to read/write in dot format, add few
attribs, etc.

my next task is to get the set of vertex in the shortest path between vertex
A and B.
In a graph like this:

a - b
b - c
c - d

assuming 'a' and 'c', the result would be {a,b,c}.

I know it sounds silly, but most similar examples I could find are much
 more complex than this.
I guess breadth_first_search would solve the problem, but I am having
trouble with the visitor concept...
how to implement a visitor to get the set of vertex in the path between two
points.

Other features of the problem:
I am assuming an undirected graph. all edges have unitary distances.
If there are multiple shortest paths between A and B, any of the valid
solutions can be returned.

thanks in advance for any clue !
Regards,
Alexandre Amory


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk