Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2004-11-17 21:53:43


[I'm answering this on the User's list, not on the developer's list[

On Nov 17, 2004, at 4:12 PM, Manas Singh wrote:

> The graph algorithms like depth first search and breadthe search works
> fine
> when you have the graph readily available before you call the BFS/DFS
> function.
>
> But I am trying to make the DFS and BFS work when I have a dynamiccaly
> growing graph.
> More specifically I start with only one node and call the DFS
> function. When the DFS
> discovers a node, I add more nodes to the graph in the visitor
> discover function.
> But I am not able to grow the graph's color map. So although I am
> adding vertices
> to the graph the color map remains the same, and so the DFS fails.
>
> Is there any way I can make DFS work with dynamically growing graphs.

Supply your own color map; just make sure you initialize the properties
appropriately when you add the vertex to the graph. One easy way to
build a color map is with vector_property_map; or you could make the
color property internal to the vertex.

        Doug


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