Trait DijkstraHeap

Source
pub trait DijkstraHeap<WeightType, IndexType>: Default {
    // Required methods
    fn insert(&mut self, weight: WeightType, index: IndexType);
    fn remove_min(&mut self) -> Option<(WeightType, IndexType)>;
    fn clear(&mut self);
    fn size(&mut self) -> usize;
}
Expand description

A min-heap used in Dijkstra’s shortest path algorithm.

Required Methods§

Source

fn insert(&mut self, weight: WeightType, index: IndexType)

Insert an index-weight pair into the heap.

Source

fn remove_min(&mut self) -> Option<(WeightType, IndexType)>

Remove the weight and index with the smallest weight from the heap.

Source

fn clear(&mut self)

Remove all entries from the heap.

Source

fn size(&mut self) -> usize

Returns the number of nodes the heap currently has space for.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<WeightType: Ord, IndexType: Ord> DijkstraHeap<WeightType, IndexType> for BinaryHeap<Reverse<(WeightType, IndexType)>>

Source§

fn insert(&mut self, weight: WeightType, index: IndexType)

Source§

fn remove_min(&mut self) -> Option<(WeightType, IndexType)>

Source§

fn clear(&mut self)

Source§

fn size(&mut self) -> usize

Implementors§