pub struct Path { /* private fields */ }
Expand description
A path from a src to a dst storing all edges in between.
Implementations§
Source§impl Path
impl Path
Sourcepub fn new(
src_idx: NodeIdx,
src_id: i64,
dst_idx: NodeIdx,
dst_id: i64,
edges: Vec<EdgeIdx>,
) -> Path
pub fn new( src_idx: NodeIdx, src_id: i64, dst_idx: NodeIdx, dst_id: i64, edges: Vec<EdgeIdx>, ) -> Path
ATTENTION! This method does not calculate the path’s cost.
This can be done, e.g., with calc_cost(...)
or flatten(...)
.
Accessing the costs without calculating them will lead to panics.
pub fn src_idx(&self) -> NodeIdx
pub fn dst_idx(&self) -> NodeIdx
Sourcepub fn costs(&self) -> &DimVec<f64>
pub fn costs(&self) -> &DimVec<f64>
ATTENTION! This method panics if the costs hasn’t been calculated (e.g. calc_cost(...)
or flatten(...)
).
Sourcepub fn calc_costs(&mut self, graph: &Graph) -> &DimVec<f64>
pub fn calc_costs(&mut self, graph: &Graph) -> &DimVec<f64>
Calculates the path’s cost, but only if not calculated already.
Sourcepub fn try_flatten(self, graph: &Graph) -> Result<Path>
pub fn try_flatten(self, graph: &Graph) -> Result<Path>
Flattens shortcuts, out-of-place, and calculates the flattened path’s cost.
pub fn flatten(self, graph: &Graph) -> Path
Trait Implementations§
Source§impl<'a> IntoIterator for &'a Path
impl<'a> IntoIterator for &'a Path
Source§impl IntoIterator for Path
impl IntoIterator for Path
impl Eq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.