Trait NodeWeightArray

Source
pub trait NodeWeightArray<WeightType> {
    // Required methods
    fn new(size: usize) -> Self;
    fn get(&self, node_index: usize) -> WeightType;
    fn get_mut<'this: 'result, 'result>(
        &'this mut self,
        node_index: usize,
    ) -> &'result mut WeightType;
    fn set(&mut self, node_index: usize, weight: WeightType);
    fn clear(&mut self);
    fn size(&self) -> usize;
}
Expand description

An array to store minimal node weights for Dijkstra’s algorithm.

Required Methods§

Source

fn new(size: usize) -> Self

Create a new NodeWeightArray of given size.

Source

fn get(&self, node_index: usize) -> WeightType

Returns the current weight of the given node index.

Source

fn get_mut<'this: 'result, 'result>( &'this mut self, node_index: usize, ) -> &'result mut WeightType

Returns the current weight of the given node index as mutable reference.

Source

fn set(&mut self, node_index: usize, weight: WeightType)

Sets the current weight of the given node index.

Source

fn clear(&mut self)

Resets the weights of all node indices to infinity

Source

fn size(&self) -> usize

Returns the number of nodes whose weight is stored in the data structure.

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: DijkstraWeight + Copy> NodeWeightArray<WeightType> for Vec<WeightType>

Source§

fn new(size: usize) -> Self

Source§

fn get(&self, node_index: usize) -> WeightType

Source§

fn get_mut<'this: 'result, 'result>( &'this mut self, node_index: usize, ) -> &'result mut WeightType

Source§

fn set(&mut self, node_index: usize, weight: WeightType)

Source§

fn clear(&mut self)

Source§

fn size(&self) -> usize

Implementors§

Source§

impl<WeightType: DijkstraWeight + Copy> NodeWeightArray<WeightType> for EpochNodeWeightArray<WeightType>