pub struct TransitionLengths {
pub straightline_distance: f64,
pub route_length: f64,
}Fields§
§straightline_distance: f64The great circle distance between source and target
route_length: f64The path of the optimal route between candidates
Implementations§
Source§impl TransitionLengths
impl TransitionLengths
Sourcepub fn deviance(&self) -> f64
pub fn deviance(&self) -> f64
Calculates the deviance in straightline distance to the length of the entire route. Returns values between 0 and 1. Where values closer to 1 represent more optimal distances, whilst those closer to 0 represent less optimal distances.
The route length is defined as the cumulative distance between nodes in the optimal transition path, plus the offsets into the edges by which the candidates live.
The straightline distance is defined as the haversine (great circle) distance between the two candidates.
Therefore, our deviance is defined as the ratio of straightline distance to the route length, which measures how much farther the actual route was than a virtual path directly between the candidates.
For example:
- If two candidates were
100mapart, but had a most optimal route between them of130m, the deviance would be~0.77. - If two alternate candidates were
100mapart but instead had an optimal route between them of250m, the deviance is0.4.
Note that a lower deviance score means the values are less aligned.
Auto Trait Implementations§
impl Freeze for TransitionLengths
impl RefUnwindSafe for TransitionLengths
impl Send for TransitionLengths
impl Sync for TransitionLengths
impl Unpin for TransitionLengths
impl UnsafeUnpin for TransitionLengths
impl UnwindSafe for TransitionLengths
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more