#include <lemon/concept/heap.h>
Public Types | |
enum | state_enum |
Type to represent the items states. More... | |
Public Member Functions | |
Heap (ItemIntMap &_iim) | |
The constructor. | |
int | size () const |
Returns the number of items stored in the heap. | |
bool | empty () const |
Checks if the heap stores no items. | |
void | push (const Item &i, const Prio &p) |
Insert an item into the heap with the given heap. | |
Item | top () const |
Returns the item with minimum priority. | |
Prio | prio () const |
Returns the minimum priority. | |
void | pop () |
Deletes the item with minimum priority. | |
void | erase (const Item &i) |
Deletes i from the heap. | |
Prio | operator[] (const Item &i) const |
Returns the priority of i . | |
void | set (const Item &i, const Prio &p) |
i gets to the heap with priority p independently if i was already there. | |
void | decrease (const Item &i, const Prio &p) |
Decreases the priority of i to p . | |
void | increase (const Item &i, const Prio &p) |
Increases the priority of i to p . | |
state_enum | state (const Item &i) const |
Returns if item is in, has already been in, or has never been in the heap. |
|
Each Item element have a state associated to it. It may be "in heap", "pre heap" or "post heap". The later two are indifferent from the heap's point of view, but may be useful to the user. The ItemIntMap _should_ be initialized in such way, that it maps PRE_HEAP (-1) to any element to be put in the heap... |
|
The constructor.
|
|
The number of items stored in the heap. |
|
Returns |
|
Adds
|
|
This method returns the item with minimum priority.
|
|
It returns the minimum priority.
|
|
This method deletes the item with minimum priority.
|
|
This method deletes item
|
|
This function returns the priority of item
|
|
This method calls push(
|
|
This method decreases the priority of item
|
|
This method sets the priority of item
|
|
This method returns PRE_HEAP if
|