
Can a visitor modify properties in a graph? I would like to use the following visitor with the breadth_first_search algorithm: struct ExecPriorityVisitor : public boost::default_dfs_visitor { ExecPriorityVisitor(); void start_vertex( Vertex v, Graph& g ){ g[v].priority = 0; } void examine_edge( Edge e, Graph& g ){ const Vertex src = boost::source(e,g); Vertex dest = boost::target(e,g); int& priority = g[dest].priority; priority = std::max( priority, g[src].priority + 1 ); } }; However, it fails to compile because apparently the graph argument must be const. That implies that I cannot modify graph properties from within the visitor? Why not? Is the suggested approach to record the modifications in yet another object and later impose that on the graph, or is there a way to accomplish this through a visitor? James