[][src]Struct competitive_hpp::dijkstra::Dijkstra

pub struct Dijkstra<T, F> where
    T: PrimInt,
    F: Num + Bounded + Clone + Copy + PartialOrd
{ pub dist: Vec<F>, pub adjacency_list: Vec<Vec<(usize, F)>>, // some fields omitted }

Dijkstra

Example:

use competitive_hpp::prelude::*;
// edge: Vec<(from, to, cost)>
let edges = vec![(0, 1, 1),(0, 2, 6),(1, 3, 2)];

//Dijkstra::new(vertex num, edges, start vertex)
let dijkstra = Dijkstra::new(4, &edges, 0);
assert_eq!(dijkstra.dist[0], 0);
assert_eq!(dijkstra.dist[1], 1);
assert_eq!(dijkstra.dist[2], 6);

Fields

dist: Vec<F>adjacency_list: Vec<Vec<(usize, F)>>

Implementations

impl<T, F> Dijkstra<T, F> where
    T: PrimInt,
    F: Num + Bounded + Clone + Copy + PartialOrd
[src]

pub fn new(n: T, edges: &[(usize, usize, F)], start: usize) -> Self[src]

Trait Implementations

impl<T: Clone, F: Clone> Clone for Dijkstra<T, F> where
    T: PrimInt,
    F: Num + Bounded + Clone + Copy + PartialOrd
[src]

impl<T: Debug, F: Debug> Debug for Dijkstra<T, F> where
    T: PrimInt,
    F: Num + Bounded + Clone + Copy + PartialOrd
[src]

Auto Trait Implementations

impl<T, F> RefUnwindSafe for Dijkstra<T, F> where
    F: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, F> Send for Dijkstra<T, F> where
    F: Send,
    T: Send

impl<T, F> Sync for Dijkstra<T, F> where
    F: Sync,
    T: Sync

impl<T, F> Unpin for Dijkstra<T, F> where
    F: Unpin,
    T: Unpin

impl<T, F> UnwindSafe for Dijkstra<T, F> where
    F: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.