34 template<
class Type,
class Key>
39 template<
class Type,
class Key>
42 heap_.insert(elem, key);
46 template<
class Type,
class Key>
50 if (
heap_.empty())
return 1;
57 template<
class Type,
class Key>
61 if (
heap_.empty())
return 1;
63 minKey =
heap_.getMinKey();
68 template<
class Type,
class Key>
72 if (
heap_.empty())
return 1;
74 min =
heap_.extractMin();
79 template<
class Type,
class Key>
86 template<
class Type,
class Key>
93 template<
class Type,
class Key>
96 return heap_.number();
100 template<
class Type,
class Key>
103 if (newSize <
size()) {
104 Logger::ifout() <<
"AbaPrioQueue::realloc : priority queue cannot be decreased\n";
108 heap_.realloc(newSize);
int number() const
Returns the number of elements stored in the priority queue.
int getMin(Type &min) const
Retrieves the element with minimal key from the priority queue.
int extractMin(Type &min)
Retrieves and removes the minimal element from the priority queue.
AbaPrioQueue(int size)
The constructor of an empty priority queue.
static std::ostream & ifout()
stream for forced output (global; used by internal libraries, e.g. Abacus)
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
AbaBHeap< Type, Key > heap_
The heap implementing the priority queue.
int size() const
Returns the maximal number of elements which can be stored in the priority queue. ...
void clear()
Makes the priority queue empty.
int getMinKey(Key &minKey) const
Retrieves the key of the minimal element in the priority queue.
void insert(Type elem, Key key)
Inserts an element in the priority queue.
void realloc(int newSize)
Increases the size of the priority queue.