"Examine" seems to work once on first encounter (is that correct??) so might worth a try. I did try the code below but I got errors on the part the works with the
color map. Any ideas?
class dijkstra_2step : public boost::default_dijkstra_visitor { public: dijkstra_2step(std::vector<Weight> dists, double threshold): distances(dists), threshold(threshold) {}
void examine_vertex(boost::graph_traits <unGraph>::vertex_descriptor u, const unGraph& g){ boost::property_map< unGraph, boost::vertex_color_t >::type
colorMap = boost::get(boost::vertex_color, g); >> if( distances[u] > threshold ) colorMap[u] = boost::color_traits::black(); >> } >> std::vector<Weight> distances; >> double threshold; >>};
If I understand correctly, your distances vector is another one than the one
that the dijkstra_shortest_path is working on? Otherwise, it seems that this
visitor makes little sense. Upon examination the distance for all vertices
is distance_inf, because that is how they are initialized.
You may want to make better use of property maps for your visitor. Remember,
visitors are passed by value internally, you don't want to copy your
distance vector all the time. You will need to create your own color map and
pass it both to dijkstra_shortest_path and your visitor.
Beware that you cannot use the named parameter variation of
dijkstra_shortest_paths if you want to specify your own color map:
http://comments.gmane.org/gmane.comp.lib.boost.devel/206220
template