Boost logo

Boost Users :

From: Rui Carvalho (rui.carvalho_at_[hidden])
Date: 2005-08-02 14:17:50


I'm using the BFS visitor that appears in the BGL book (p 66), which can
also be found here:

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

  template <typename DistanceMap>
  class bacon_number_recorder : public default_bfs_visitor
    bacon_number_recorder(DistanceMap dist) : d(dist) { }

    template <typename Edge, typename Graph>
    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)
      DistanceMap d;


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at