pub struct Dijkstra<T, F>{
pub dist: Vec<F>,
pub adjacency_list: Vec<Vec<(usize, F)>>,
/* private fields */
}
Expand description
§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§
Trait Implementations§
Auto Trait Implementations§
impl<T, F> Freeze for Dijkstra<T, F>where
T: Freeze,
impl<T, F> RefUnwindSafe for Dijkstra<T, F>where
T: RefUnwindSafe,
F: RefUnwindSafe,
impl<T, F> Send for Dijkstra<T, F>
impl<T, F> Sync for Dijkstra<T, F>
impl<T, F> Unpin for Dijkstra<T, F>
impl<T, F> UnwindSafe for Dijkstra<T, F>where
T: UnwindSafe,
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more