Boost logo

Boost Users :

From: Jeremy Graham Siek (jsiek_at_[hidden])
Date: 2005-08-02 14:27:27


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 <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)
> return;
> }
> private:
> DistanceMap d;
> };
>
>
>
> Thanks,
> Rui
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
_______________________________________________
Jeremy Siek <Jeremy.G.Siek_at_[hidden]>
http://www.cs.rice.edu/~jgs3847
Post-Doc, Rice University
_______________________________________________


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