Skip to content

num::concepts::addressable_priority_queue

Defined in header <structures/concepts.hpp>

template <typename T, typename Key = double, typename Index = num::idx>
concept addressable_priority_queue =
    std::totally_ordered<Key> && requires(T pq, Index index, const Key &key) {
      { pq.push(index, key) } -> std::same_as<void>;
      { pq.pop() } -> std::same_as<void>;
      { pq.top_index() } -> std::same_as<Index>;
      { pq.top_key() } -> std::convertible_to<Key>;
      { pq.contains(index) } -> std::same_as<bool>;
      { pq.update(index, key) } -> std::same_as<void>;
      { pq.empty() } -> std::same_as<bool>;
      { pq.size() } -> std::same_as<Index>;
    };

Totally ordered key set with addressable elements and a retrievable minimum.

top_key() is the minimum over every contained key, maintained across push, pop, and update. update revises a key in place, which is what Dijkstra and Prim need and a plain priority queue cannot do.