Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class DistMap>
- class djk_max_visitor:
- public boost::dijkstra_visitor<null_visitor>
- {
- public:
- djk_max_visitor(DistMap dist_map,
- typename property_traits<DistMap>::value_type max_dist, size_t target)
- : _dist_map(dist_map), _max_dist(max_dist), _target(target) {}
- template <class Graph>
- void examine_vertex(typename graph_traits<Graph>::vertex_descriptor u,
- Graph&)
- {
- if (_dist_map[u] > _max_dist)
- throw stop_search();
- std::size_t search = _target.find(u);
- if (search != _target.end())
- {
- _target.erase(*search)
- if _target.empty()
- throw stop_search();
- }
- }
- private:
- DistMap _dist_map;
- typename property_traits<DistMap>::value_type _max_dist;
- std::unordered_set<std::size_t> _target;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement