In this case, you probably need to write your own visitor.
struct found_vertex {};
template
struct reachable_visitor : boost::bfs_visitor<> { public: reachable_visitor(const Vertex& v) : vertex(v) {} void discover_vertex(const Vertex& v, const Graph&) const { if(v == vertex) throw found_vertex(); } private: Vertex vertex; }; template
bool reachable(const Graph& g, const Vertex& start, const Vertex& end) { try { boost::breadth_first_search(g, start, boost::visitor(reachable_visitor (end))); } catch(found_vertex&) { return true; } return false; }
Nice, but is throw-to-return-type-idiom really the best to be used here? Isn't there a "better" way to do this? regards Jens Weller -- Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a