Trait rs_graph::collections::ItemPriQueue
source · pub trait ItemPriQueue<K, V> {
type Item;
// Required methods
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;
}
Required Associated Types§
Required Methods§
sourcefn push(&mut self, key: K, value: V) -> Self::Item
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
.
sourcefn decrease_key(&mut self, item: &mut Self::Item, value: V) -> bool
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.