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::StateImplementations§
Source§impl<G, S> ShortestPathWithParent<G, S, RecordParent>
impl<G, S> ShortestPathWithParent<G, S, RecordParent>
Sourcepub fn path_to(&self, graph: &G, target: G::Vertex) -> Option<Vec<G::Vertex>>
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>where
<G as VertexMap<<S as ShortestPathSemiRing>::T>>::Vmap: RefUnwindSafe,
<P as ParentPolicy<G>>::State: RefUnwindSafe,
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>where
<G as VertexMap<<S as ShortestPathSemiRing>::T>>::Vmap: UnsafeUnpin,
<P as ParentPolicy<G>>::State: UnsafeUnpin,
impl<G, S, P> UnwindSafe for ShortestPathWithParent<G, S, P>where
<G as VertexMap<<S as ShortestPathSemiRing>::T>>::Vmap: UnwindSafe,
<P as ParentPolicy<G>>::State: 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