|
ADS
Algorithms and Data Structures
|
The mutable heaps of Boost.Heap as queues of ADS that lower their keys natively, beyond the book, compiled only with ADS_WITH_BOOST. More...
Go to the source code of this file.
The mutable heaps of Boost.Heap as queues of ADS that lower their keys natively, beyond the book, compiled only with ADS_WITH_BOOST.
The heaps of Boost.Heap already model PriorityQueue of PriorityQueue.h, through the customization points that read push(), top() and pop(), and their handles are queue_handle_t, their handle_type; this header gives the free queue_decrease( q , h , p ) that those points find by argument-dependent lookup on a mutable heap, whose push() gives a handle (not on a d_ary_heap without mutable_< true >, which declares the members of the handles but does not compile them), so that decrease_key_of() answers native and the shortest paths and Prim's algorithm of ADS (PriorityFrontier) lower a key on the handle of the heap instead of inserting a copy.
A heap of Boost.Heap has on top the largest item in the order of its comparator, so that with std::greater (the least distance on top, as the shortest paths want) the fall of a key moves the item toward the top, which Boost.Heap calls increase() (constant amortized time in the Fibonacci heap), while its decrease() moves an item away from the top. The function of this header is therefore increase(), whatever the comparator: for ADS, to decrease is to move toward the minimum, i.e., the top. The items of such a heap are the pairs ( distance , node ), the priority and the node at once [see PriorityFrontier].