Struct rs_graph::shortestpath::dijkstra::Dijkstra
source · pub struct Dijkstra<'a, G, W, N, E, H = BinHeap<NodeItem<N, E, W>, usize>>where
G: 'a + IndexGraph<'a, Node = N, Edge = E>,
N: 'a + Node + Hash,
E: 'a + Edge,
W: NumAssign + Ord + Copy,
H: Heap<Key = NodeItem<G::Node, G::Edge, W>, Item = usize>,{ /* private fields */ }
Expand description
Dijkstra’s shortest path algorithm.
Implementations
sourceimpl<'a, G, W, N, E, H> Dijkstra<'a, G, W, N, E, H>where
G: 'a + IndexGraph<'a, Node = N, Edge = E>,
N: 'a + Node + Hash,
E: 'a + Edge,
W: NumAssign + Ord + Copy,
H: Heap<Key = NodeItem<G::Node, G::Edge, W>, Item = usize>,
impl<'a, G, W, N, E, H> Dijkstra<'a, G, W, N, E, H>where
G: 'a + IndexGraph<'a, Node = N, Edge = E>,
N: 'a + Node + Hash,
E: 'a + Edge,
W: NumAssign + Ord + Copy,
H: Heap<Key = NodeItem<G::Node, G::Edge, W>, Item = usize>,
sourcepub fn undirected<Weights>(
&mut self,
weights: Weights,
src: G::Node,
snk: Option<G::Node>
) -> Vec<(G::Node, G::Edge)>where
Weights: EdgeMap<'a, G, W>,
pub fn undirected<Weights>(
&mut self,
weights: Weights,
src: G::Node,
snk: Option<G::Node>
) -> Vec<(G::Node, G::Edge)>where
Weights: EdgeMap<'a, G, W>,
Compute a shortest path with Dijkstra’s algorithm on an undirected graph.
Each edge can be traversed in both directions with the same weight.
weights
the (non-negative) edge weightssrc
the source nodesnk
the sink node
Return the incoming edge for each node forming the shortest path tree.
sourcepub fn bidirected<Weights>(
&mut self,
weights: Weights,
src: G::Node,
snk: Option<G::Node>
) -> Vec<(G::Node, G::Edge)>where
G: IndexNetwork<'a>,
Weights: EdgeMap<'a, G, W>,
pub fn bidirected<Weights>(
&mut self,
weights: Weights,
src: G::Node,
snk: Option<G::Node>
) -> Vec<(G::Node, G::Edge)>where
G: IndexNetwork<'a>,
Weights: EdgeMap<'a, G, W>,
Solve shortest path with Dijkstra as bidirected graph.
The graph is considered as bidirected graph with different weights for each direction.
weights
the (non-negative) arc weightssrc
the source nodesnk
the sink node
Return the incoming arc for each node forming the shortest path tree.
sourcepub fn directed<Weights>(
&mut self,
weights: Weights,
src: G::Node,
snk: Option<G::Node>
) -> Vec<(G::Node, G::Edge)>where
G: Digraph<'a>,
Weights: EdgeMap<'a, G, W>,
pub fn directed<Weights>(
&mut self,
weights: Weights,
src: G::Node,
snk: Option<G::Node>
) -> Vec<(G::Node, G::Edge)>where
G: Digraph<'a>,
Weights: EdgeMap<'a, G, W>,
Solve shortest path with Dijkstra as directed graph.
The graph is considered directed, travel is only allowed along outgoing edges.
weights
the (non-negative) arc weightssrc
the source nodesnk
the sink node
Return the incoming arc for each node forming the shortest path tree.
pub fn generic<Weights, F, Neighs, It>(
&mut self,
weights: Weights,
src: G::Node,
snk: Option<G::Node>,
accum: F,
neighs: Neighs
) -> Vec<(G::Node, G::Edge)>where
Weights: EdgeMap<'a, G, W>,
F: Fn(W, W) -> W,
Neighs: Fn(&'a G, G::Node) -> It,
It: Iterator<Item = (G::Edge, G::Node)>,
Auto Trait Implementations
impl<'a, G, W, N, E, H> RefUnwindSafe for Dijkstra<'a, G, W, N, E, H>where
G: RefUnwindSafe,
H: RefUnwindSafe,
N: RefUnwindSafe,
impl<'a, G, W, N, E, H> Send for Dijkstra<'a, G, W, N, E, H>where
G: Sync,
H: Send,
N: Send,
impl<'a, G, W, N, E, H> Sync for Dijkstra<'a, G, W, N, E, H>where
G: Sync,
H: Sync,
N: Sync,
impl<'a, G, W, N, E, H> Unpin for Dijkstra<'a, G, W, N, E, H>where
H: Unpin,
N: Unpin,
impl<'a, G, W, N, E, H> UnwindSafe for Dijkstra<'a, G, W, N, E, H>where
G: RefUnwindSafe,
H: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more