pub trait DistanceMap<K, V> {
    // Required methods
    fn build(num_elements: usize) -> Self;
    fn get_item(&self, pos: K) -> Option<&V>;
    fn put_item(&mut self, pos: K, val: V);
}
Expand description

A mapping for storing the distances of nodes for shortest path algorithms.

Required Methods§

source

fn build(num_elements: usize) -> Self

Create mapping with support for items between 0 and num_elements - 1.

source

fn get_item(&self, pos: K) -> Option<&V>

Get the distance to the item at pos. If the distance does not exist, the function returns None.

source

fn put_item(&mut self, pos: K, val: V)

Insert item at position pos with distance V.

Implementations on Foreign Types§

source§

impl<K: IndexType, V: Clone> DistanceMap<K, V> for Vec<Option<V>>

source§

fn build(num_elements: usize) -> Self

source§

fn get_item(&self, pos: K) -> Option<&V>

source§

fn put_item(&mut self, pos: K, val: V)

source§

impl<K: Eq + Hash, V: Clone> DistanceMap<K, V> for HashMap<K, V>

source§

fn build(_num_elements: usize) -> Self

source§

fn get_item(&self, pos: K) -> Option<&V>

source§

fn put_item(&mut self, pos: K, val: V)

Implementors§

source§

impl<K: Eq + Hash, V: Clone> DistanceMap<K, V> for DictMap<K, V>