Struct Dijkstra

Source
pub struct Dijkstra<'a, W, E> { /* private fields */ }
Expand description

ダイクストラ法

Implementations§

Source§

impl<'a, E> Dijkstra<'a, E::Weight, E>
where E: EdgeTrait, E::Weight: Add<Output = E::Weight> + Copy + Ord + Zero + Unsigned,

Source

pub fn new(g: &'a Graph<impl Direction, E>, src: &[usize]) -> Self

グラフg上で、始点から各頂点への最短パスを求める。

Time complexity $O((E + V) \log V)$

Source

pub fn min_dist_table(&self) -> &[Option<E::Weight>]

最短距離の配列への参照を返す。

Source

pub fn min_dist_to(&self, to: usize) -> Option<E::Weight>

toへの最短距離を返す。 到達不可能ならば、Noneを返す。

Source

pub fn min_path_to(&self, to: usize) -> Option<Vec<&E>>

toへの最短パスを返す。 到達不可能ならば、Noneを返す。

Auto Trait Implementations§

§

impl<'a, W, E> Freeze for Dijkstra<'a, W, E>

§

impl<'a, W, E> RefUnwindSafe for Dijkstra<'a, W, E>

§

impl<'a, W, E> Send for Dijkstra<'a, W, E>
where W: Send, E: Sync,

§

impl<'a, W, E> Sync for Dijkstra<'a, W, E>
where W: Sync, E: Sync,

§

impl<'a, W, E> Unpin for Dijkstra<'a, W, E>
where W: Unpin,

§

impl<'a, W, E> UnwindSafe for Dijkstra<'a, W, E>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.