ShortestPathWithParent

Struct ShortestPathWithParent 

Source
pub struct ShortestPathWithParent<G, S, P = RecordParent>{
    pub dist: <G as VertexMap<S::T>>::Vmap,
    pub parent: P::State,
}

Fields§

§dist: <G as VertexMap<S::T>>::Vmap§parent: P::State

Implementations§

Source§

impl<G, S> ShortestPathWithParent<G, S, RecordParent>

Source

pub fn path_to(&self, graph: &G, target: G::VIndex) -> Option<Vec<G::VIndex>>

Examples found in repository?
crates/library_checker/src/graph/shortest_path.rs (line 11)
6pub fn shortest_path(reader: impl Read, mut writer: impl Write) {
7    let s = read_all_unchecked(reader);
8    let mut scanner = Scanner::new(&s);
9    scan!(scanner, n, m, s, t, (g, c): @DirectedGraphScanner::<usize, u64>::new(n, m));
10    let sp = g.standard_sp_additive().with_parent().dijkstra([s], &c);
11    if let Some(path) = sp.path_to(&g, t) {
12        iter_print!(writer, sp.dist[t], path.len() - 1; @it2d path.windows(2));
13    } else {
14        iter_print!(writer, -1);
15    }
16}

Auto Trait Implementations§

§

impl<G, S, P> Freeze for ShortestPathWithParent<G, S, P>
where <G as VertexMap<<S as ShortestPathSemiRing>::T>>::Vmap: Freeze, <P as ParentPolicy<G>>::State: Freeze,

§

impl<G, S, P> RefUnwindSafe for ShortestPathWithParent<G, S, P>

§

impl<G, S, P> Send for ShortestPathWithParent<G, S, P>
where <G as VertexMap<<S as ShortestPathSemiRing>::T>>::Vmap: Send, <P as ParentPolicy<G>>::State: Send,

§

impl<G, S, P> Sync for ShortestPathWithParent<G, S, P>
where <G as VertexMap<<S as ShortestPathSemiRing>::T>>::Vmap: Sync, <P as ParentPolicy<G>>::State: Sync,

§

impl<G, S, P> Unpin for ShortestPathWithParent<G, S, P>
where <G as VertexMap<<S as ShortestPathSemiRing>::T>>::Vmap: Unpin, <P as ParentPolicy<G>>::State: Unpin,

§

impl<G, S, P> UnwindSafe for ShortestPathWithParent<G, S, P>

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.