[BGL] BFS visitor question
Hello,
I'm using the BFS visitor that appears in the BGL book (p 66), which can
also be found here:
http://boost.org/libs/graph/doc/kevin_bacon.html
I would like to compute a quantity that depends on the bacon number of a
vertex, but only to distance d_max as my graphs are quite big (and I need to
compute the quantity for each vertex, so I want a speedy computation).
Ideally, I'd like to write something like the code below (my code appears
after the comment), but this doesn't seem to work. Am I missing something
basic?
template <typename DistanceMap>
class bacon_number_recorder : public default_bfs_visitor
{
public:
bacon_number_recorder(DistanceMap dist) : d(dist) { }
template
Hi Rui, You need to throw and exception. (the FAQ explains this a bit more) Cheers, Jeremy On Aug 2, 2005, at 2:17 PM, Rui Carvalho wrote:
Hello,
I'm using the BFS visitor that appears in the BGL book (p 66), which can also be found here: http://boost.org/libs/graph/doc/kevin_bacon.html
I would like to compute a quantity that depends on the bacon number of a vertex, but only to distance d_max as my graphs are quite big (and I need to compute the quantity for each vertex, so I want a speedy computation). Ideally, I'd like to write something like the code below (my code appears after the comment), but this doesn't seem to work. Am I missing something basic?
template <typename DistanceMap> class bacon_number_recorder : public default_bfs_visitor { public: bacon_number_recorder(DistanceMap dist) : d(dist) { }
template
void tree_edge(Edge e, const Graph& g) const { typename graph_traits<Graph>::vertex_descriptor u = source(e, g), v = target(e, g); d[v] = d[u] + 1; //end BFS if v is at a distance greater than d_max if (d[v]>dmax) return; } private: DistanceMap d; }; Thanks, Rui
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Jeremy Siek
participants (2)
-
Jeremy Graham Siek
-
Rui Carvalho