[][src]Trait rs_graph::collections::ItemPriQueue

pub trait ItemPriQueue<K, V> {
    type Item;
    fn is_empty(&self) -> bool;
fn clear(&mut self);
fn push(&mut self, key: K, value: V) -> Self::Item;
fn decrease_key(&mut self, item: &mut Self::Item, value: V) -> bool;
fn pop_min(&mut self) -> Option<(K, V)>;
fn value(&self, item: &Self::Item) -> &V; }

Associated Types

type Item

Handle for an item in the queue.

Loading content...

Required methods

fn is_empty(&self) -> bool

Return true iff the queue contains no element.

fn clear(&mut self)

Remove all elements from the queue.

fn push(&mut self, key: K, value: V) -> Self::Item

Push the element with given key and value onto the queue.

Return a handle referencing the element. That handle can be used in a subsequent call to decrease_key.

fn decrease_key(&mut self, item: &mut Self::Item, value: V) -> bool

Decrease the value of some item in the queue.

Returns true if the new value is smaller than the old one.

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

Remove and return the element with the smallest value from the queue or None if the queue is empty.

fn value(&self, item: &Self::Item) -> &V

Return the current value associated with some item in the queue.

Loading content...

Implementations on Foreign Types

impl<'a, P, K, V> ItemPriQueue<K, V> for &'a mut P where
    P: ItemPriQueue<K, V>, 
[src]

type Item = P::Item

Loading content...

Implementors

impl<K, V, ID> ItemPriQueue<K, V> for BinHeap<K, V, ID> where
    K: Clone,
    V: PartialOrd + Clone,
    ID: FromPrimitive + ToPrimitive + Copy + Eq
[src]

type Item = ID

Loading content...