Struct fibonacci_heap::FibonacciHeap [-] [+] [src]

pub struct FibonacciHeap<K, V> {
    // some fields omitted
}

Struct that represents the Fibonacci Heap data structure.

Algorithms for this are as seen in the Introduction to Algorithms by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein.

The key, K, is the priority used to order the heap. The value, V, is the data associated with the key.

Methods

impl<K, V> FibonacciHeap<K, V> where K: Clone + Eq + Ord, V: Clone + Eq + Hash

fn new() -> FibonacciHeap<K, V>

Creates a new empty FibonacciHeap.

fn insert(&mut self, key: K, value: V)

Inserts the value into the heap with priority key.

fn minimum(&self) -> Option<(K, V)>

Peeks at the minimum of the heap.

Returns None if the heap is empty.

fn extract_min(&mut self) -> Option<(K, V)>

Exctracts the minimum of the heap.

Returns None if the heap is empty.

fn decrease_key(&mut self, value: V, key: K) -> Result<(), ()>

Decreases the priority of the value to the key.

Returns Err if the value is not in the heap or if the key is greater than the current priority of the value.