Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

FibHeap Class Template Reference
[Auxiliary Data Structures]

#include <lemon/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>.
See also:
BinHeap

Dijkstra

Author:
Jacint Szabo

Definition at line 67 of file fib_heap.h.

Public Types

enum  state_enum { IN_HEAP = 0, PRE_HEAP = -1, POST_HEAP = -2 }
 Status of the nodes. More...

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 Enumeration Documentation

enum state_enum
 

Enumeration values:
IN_HEAP  The node is in the heap.
PRE_HEAP  The node has never been in the heap.
POST_HEAP  The node was in the heap but it got out of it.

Definition at line 82 of file fib_heap.h.


Member Function Documentation

int size  )  const [inline]
 

Returns the number of items stored in the heap.

Definition at line 100 of file fib_heap.h.

bool empty  )  const [inline]
 

Returns true if and only if the heap stores no items.

Definition at line 107 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 133 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 141 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 149 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 159 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 199 of file fib_heap.h.

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 213 of file fib_heap.h.


The documentation for this class was generated from the following file:
Generated on Sat Mar 19 10:58:50 2005 for LEMON by  doxygen 1.4.1