FibHeap Class Template Reference
[Auxiliary Data Structures]

#include <fib_heap.h>

List of all members.


Detailed Description

template<typename Item, typename Prio, typename ItemIntMap, typename Compare>
class lemon::FibHeap< Item, Prio, ItemIntMap, Compare >

This class implements the Fibonacci heap data structure. A heap is a data structure for storing items with specified values called priorities in such a way that finding the item with minimum priority is efficient. Compare specifies the ordering of the priorities. In a heap one can change the priority of an item, add or erase an item, etc.

The methods increase and erase are not efficient in a Fibonacci heap. In case of many calls to these operations, it is better to use a binary heap.

Parameters:
Item Type of the items to be stored.
Prio Type of the priority of the items.
ItemIntMap A read and writable Item int map, for the usage of the heap.
Compare A class for the ordering of the priorities. The default is std::less<Prio>.
Author:
Jacint Szabo

Definition at line 65 of file fib_heap.h.

Public Member Functions

int size () const
 The number of items stored in the heap.
bool empty () const
 Checks if the heap stores no items.
void set (Item const item, PrioType const value)
 item gets to the heap with priority value independently if item was already there.
void push (Item const item, PrioType const value)
 Adds item to the heap with priority value.
Item top () const
 Returns the item with minimum priority relative to Compare.
PrioType prio () const
 Returns the minimum priority relative to Compare.
PrioType & operator[] (const Item &item)
 Returns the priority of item.
const PrioType & operator[] (const Item &item) const
 Returns the priority of item.
void pop ()
 Deletes the item with minimum priority relative to Compare.
void erase (const Item &item)
 Deletes item from the heap.
void decrease (Item item, PrioType const value)
 Decreases the priority of item to value.
void increase (Item item, PrioType const value)
 Increases the priority of item to value.
state_enum state (const Item &item) const
 Returns if item is in, has already been in, or has never been in the heap.


Member Function Documentation

int size  )  const [inline]
 

Returns the number of items stored in the heap. Definition at line 94 of file fib_heap.h.

bool empty  )  const [inline]
 

Returns true if and only if the heap stores no items. Definition at line 101 of file fib_heap.h.

Item top  )  const [inline]
 

This method returns the item with minimum priority relative to Compare.

Precondition:
The heap must be nonempty.
Definition at line 127 of file fib_heap.h.

PrioType prio  )  const [inline]
 

It returns the minimum priority relative to Compare.

Precondition:
The heap must be nonempty.
Definition at line 135 of file fib_heap.h.

PrioType& operator[] const Item &  item  )  [inline]
 

This function returns the priority of item.

Precondition:
item must be in the heap.
Definition at line 143 of file fib_heap.h.

const PrioType& operator[] const Item &  item  )  const [inline]
 

It returns the priority of item.

Precondition:
item must be in the heap.
Definition at line 153 of file fib_heap.h.

void increase Item  item,
PrioType const  value
[inline]
 

This method sets the priority of item to value. Though there is no precondition on the priority of item, this method should be used only if it is indeed necessary to increase (relative to Compare) the priority of item, because this method is inefficient. Definition at line 193 of file fib_heap.h.

References FibHeap::erase(), and FibHeap::push().

Here is the call graph for this function:

state_enum state const Item &  item  )  const [inline]
 

This method returns PRE_HEAP if item has never been in the heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP otherwise. In the latter case it is possible that item will get back to the heap again. Definition at line 207 of file fib_heap.h.


The documentation for this class was generated from the following file:
Generated on Thu Sep 30 12:18:37 2004 for LEMON by doxygen 1.3.8