Skip to main content

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::Vertex) -> Option<Vec<G::Vertex>>

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

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> UnsafeUnpin for ShortestPathWithParent<G, S, P>

§

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> ToArrayVecScalar for T

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.