|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.graph.util.FibonacciHeap<K,T>
K - the key typeT - the value typepublic final class FibonacciHeap<K extends Comparable<K>,T>
This Fibonacci heap is a special implementation of a priority queue tailored for graph search algorithms. Its interface is different to a standard Java PriorityQueue to facilitate an efficient "decreaseKey" operation, which reduces the priority of a value that is already in the queue. Thus, Handles are used to reference directly values already in the heap.
| Nested Class Summary | |
|---|---|
static class |
FibonacciHeap.Handle<C,V>
Handle to elements in the heap for efficient access. |
| Constructor Summary | |
|---|---|
FibonacciHeap()
|
|
| Method Summary | |
|---|---|
void |
decreaseKey(FibonacciHeap.Handle<K,T> h,
K lowerKey)
Decreases the priority of an element that is already in the heap. |
FibonacciHeap.Handle<K,T> |
insert(K key,
T item)
Inserts an element into the heap. |
boolean |
isEmpty()
Returns true if this heap contains no elements. |
T |
removeMin()
Returns and removes the element with lowest priority. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FibonacciHeap()
| Method Detail |
|---|
public boolean isEmpty()
public FibonacciHeap.Handle<K,T> insert(K key,
T item)
key - the priority of the elementitem - the element to be inserted
public T removeMin()
public void decreaseKey(FibonacciHeap.Handle<K,T> h,
K lowerKey)
h - the handle of an element already in the heaplowerKey - the new priority of the element, which must be lower than the old onepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||