I’m looking at using boost::d_ary_heap_indirect in my code, but I’m having trouble understanding one of the template arguments, DistanceMap. The comments (full source availible here) have this to say:
// - DistanceMap must be a ReadablePropertyMap from Value to something
// (typedef'ed as distance_type).
I tried looking at it’s usage in boost classes, but when used in boost::astar_search, it is created by detail::make_property_map_from_arg_pack_gen<tag::rank_map, D>(D())(g, arg_pack), which I understand even less…
Looking at the source, I get the feeling it could be the priorities, but that seems wierd when called “distance”.
Yes,
DistanceMapis a map from value to priority, aka key. D-ary heap is commonly used for Dijkstra‘s algorithm. In Dijkstra‘s algorithm, the priority is, especially, represented by the edge path cost(distance). I guess that’s why its named like this.E.g., there is a method
keys()to return this map.