class bfs_vis : public boost::default_bfs_visitor
{
public:
bfs_vis(unGraph::vertex_descriptor source, boost::shared_ptr<VertexStorage> storage) : s(source), cont(storage) { }
template <typename Edge, typename Graph>
void tree_edge(Edge e, const Graph& g) const
{
typename boost::graph_traits<Graph>::vertex_descriptor
u = source(e, g), v = target(e, g);
cont->depth_from->at(v) = cont->depth_from->at(u) + 1.0;
}
template <typename Edge, typename Graph>
void discover_vertex(Edge e, Graph& g)
{
cont->node_count = cont->node_count + 1;
}
private:
boost::shared_ptr<VertexStorage> cont;
unGraph::vertex_descriptor s;
};