|
| | TableHeap (const T &t, int n=0) |
| | the empty queue of the ids \( [ 0 , n ) \) of the table \( t \), which must outlive it
|
| void | update (int id) |
| | the id in the queue with its key in the table, inserted or moved, the ids raised to \( \mathit{id} + 1 \) if fewer
|
| void | erase (int id) |
| | the id out of the queue, if it is there
|
| bool | contains (int id) const |
| | whether the id is in the queue
|
| bool | empty (void) const |
| | whether the queue is empty
|
| std::size_t | size (void) const |
| | the number of ids in the queue
|
| const Key & | key (int id) const |
| | the key of an id in the queue, as read last from the table
|
| int | min (void) const |
| | the id of least key
|
| int | deleteMin (void) |
| | removes the id of least key and returns it
|
| void | extract (const Key &theta, std::vector< int > &out) |
| | every id of key at most \( \theta \) appended to out, by increasing keys, each removed
|
| void | clear (void) |
| | the queue emptied
|
| void | refresh (void) |
| | the ids that the table no longer has taken out, and the keys of the others read again, in \( O( s ) \) time
|
| const IndexedDaryHeap< Key, D > & | heap (void) const |
| | the heap, for the reads
|
| template<class H, class V> |
| void | on (const mod::Changed< mod::Value, H, V > &e) |
| | a value of the table written: its id updated
|
| template<class H, class K, class V> |
| void | on (const mod::Inserted< H, K, V > &e) |
| | a value of the table inserted: its id updated
|
| template<class H, class K, class V> |
| void | on (const mod::Erased< H, K, V > &e) noexcept |
| | a value of the table erased: its id out of the queue
|
| void | on (const mod::Cleared &) noexcept |
| | the table emptied: the queue too
|
| void | on (const mod::Rebuilt &) noexcept |
| | the table rebuilt: refresh()
|
template<class T, unsigned D = 4>
class ADS::TableHeap< T, D >
the ids \( [ 0 , n ) \) in a \( D \)-ary heap by the keys that the table T holds for them, read from it by update( id ): the queue of the frontier as an observer of the table of a search, in the form of the LaB-PQ of Dong et al.
The table is anything that t[ id ] reads and t.size() measures (a std::vector, an ObservableArray [see ObservableArray.h]); the queue copies the key of an id when it reads it, and update( id ) makes the id enter the queue with its present key, or move to it, in \( O( D \log_D s ) \) time, so that a search that writes the table calls update() on the ids it wrote, or attaches the queue to an observable table, whose Assigned and Inserted call it, Erased takes the id out, Cleared empties the queue and Rebuilt reads the keys of all its ids again. extract( theta , out ) takes every id of key at most \( \theta \), as the stepping algorithms do. Unlike the tournament tree of the paper, the queue updates an id at once instead of marking it for the next extraction, which costs a logarithm per update and gives the same ids to each extract().
- See also
- X. Dong, Y. Gu, Y. Sun, Y. Zhang, Efficient stepping algorithms and implementations for parallel shortest paths, Proceedings of SPAA, 184-197, 2021, doi:10.1145/3409964.3461782