1#ifndef ROUTING_KIT_ID_QUEUE_H
2#define ROUTING_KIT_ID_QUEUE_H
144 if(
heap[parent].key >
heap[pos].key){
157 unsigned smallest_child = first_child;
159 if(
heap[smallest_child].key >
heap[c].key){
164 if(
heap[smallest_child].key >=
heap[pos].key)
169 pos = smallest_child;
unsigned id_count() const
Returns the id_count value passed to the constructor.
MinIDQueue(unsigned id_count)
void move_down_in_tree(unsigned pos)
bool empty() const
Returns whether the queue is empty. Equivalent to checking whether size() returns 0.
IDKeyPair pop()
Returns the smallest element key pair and removes it form the queue.
friend void swap(MinIDQueue &l, MinIDQueue &r)
bool contains_id(unsigned id)
Checks whether an element is in the queue.
unsigned get_key(unsigned id) const
bool decrease_key(IDKeyPair p)
void move_up_in_tree(unsigned pos)
void clear()
Removes all elements from the queue.
unsigned size() const
Returns the number of elements in the queue.
std::vector< unsigned > id_pos
IDKeyPair peek() const
Returns the smallest element key pair without removing it from the queue.
bool increase_key(IDKeyPair p)
static const unsigned tree_arity
std::vector< IDKeyPair > heap
const unsigned invalid_id
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects