Boost logo

Boost Users :

From: Elvanör (elvanor2004_at_[hidden])
Date: 2005-03-09 14:26:07


Hello,

when you are inside the visitor the () operator takes two arguments, a
vertex descriptor and a reference to the graph.

So I guess you can use this graph variable to access the property map
for color.

For example I have the following visitor:

struct SendMsg : public base_visitor <SendMsg>
{
        typedef on_finish_vertex event_filter;
        
        /* here what the visitor must do... */
        
        template <class Vertex, class Graph>
                void operator()(Vertex u, Graph& g)
        {

                        Vertex v = g[u].get_parent_node();
                        
                        typename graph_traits <Graph>::edge_descriptor e = edge(u,v,g).first;

                        g[u].send_message( g[v].get_object(), g[e] );
        }
};

I guess in that example, you need to use the g variable with the color
map in order to do what you want... take a look at
"http://www.boost.org/libs/graph/doc/depth_first_search.html" and that
should help you.

I don't know exactly how to that, because I don't know about property
maps, but that would be something like g.color_map[v] = ...

(excuse me for the absolutely wrong syntax... you'd have to use put I
guess)

Jean-Noël

On 7-Mar-05, at 10:37 PM, Stephen Torri wrote:

> I have a need to have a graph visitor algorithm similar to depth first
> search. The only difference is that if upon running discover_vertex the
> intended operation to be done on the vertex is not done I want the
> graph
> color value for this position to still be white.
>
> The reason is that the graph I am using the depth first search is a
> directed graph with no loops in it. A vertex might have two or more
> vertices providing information. If all the information is not there I
> want the visitor to try again.
>
> What do I have to do to gain access to the color map inside the visitor
> when I am in discover_vertex?
>
> Stephen
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>



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