pub trait ParametricAPI<E, R>{
// Required methods
fn distance(&self, ratio: &R, edge: &EdgeReference<'_, R>) -> R;
fn zero_cancel(&self, cycle: &[EdgeReference<'_, R>]) -> R;
}Expand description
API trait for parametric shortest path problems.
The parametric shortest path problem finds the maximum ratio $r$ such that:
$$ d_v - d_u \le w_{uv} - r \quad \forall (u,v) \in E $$
Implement this trait to define how distances are computed and how to find the ratio that cancels a cycle.
Required Methods§
Sourcefn distance(&self, ratio: &R, edge: &EdgeReference<'_, R>) -> R
fn distance(&self, ratio: &R, edge: &EdgeReference<'_, R>) -> R
Compute the effective edge distance $d’(w, r) = w - r$.
Sourcefn zero_cancel(&self, cycle: &[EdgeReference<'_, R>]) -> R
fn zero_cancel(&self, cycle: &[EdgeReference<'_, R>]) -> R
Compute $r^* = \frac{\sum_{(u,v) \in C} w_{uv}}{|C|}$ such that the cycle’s total distance is zero.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".