Skip to main content

CostFn

Trait CostFn 

pub trait CostFn {
    type Weight: EdgeObservableRead + Send;
    type Cost: Clone + PartialOrd + Send + Sync;

    // Required methods
    fn initial_cost(&self) -> Self::Cost;
    fn min_cost(&self) -> Option<Self::Cost>;
    fn into_cost_fn(
        self,
    ) -> Box<dyn Fn(Self::Cost, &Self::Weight, usize) -> Self::Cost>;
}
Expand description

Definition of a fold like cost function usable with graph traversal trait.

Required Associated Types§

Required Methods§

fn initial_cost(&self) -> Self::Cost

The initial cost that will be modified by the cost function.

fn min_cost(&self) -> Option<Self::Cost>

The minumum cost, below which the cost function will force discard upon traversal.

fn into_cost_fn( self, ) -> Box<dyn Fn(Self::Cost, &Self::Weight, usize) -> Self::Cost>

The cost function accepting graph properties to establish the final cost.

Implementors§

§

impl<C, W> CostFn for HoprCostFn<C, W>
where C: Clone + PartialOrd + Send + Sync + 'static, W: EdgeObservableRead + Send + 'static,

§

type Cost = C

§

type Weight = W

§

impl<C, W> CostFn for LoopbackPathCostFn<C, W>
where C: Clone + PartialOrd + Send + Sync + 'static, W: EdgeObservableRead + Send + 'static,

§

type Cost = C

§

type Weight = W

§

impl<C, W> CostFn for SimpleHoprCostFn<C, W>
where C: Clone + PartialOrd + Send + Sync + 'static, W: EdgeObservableRead + Send + 'static,

§

type Cost = C

§

type Weight = W