Skip to main content

compute_paths

Function compute_paths 

Source
fn compute_paths<G, C>(
    graph: &G,
    src: &OffchainPublicKey,
    dest: &OffchainPublicKey,
    length: NonZeroUsize,
    take: usize,
    cost_fn: C,
) -> Vec<PathWithCost>
where G: NetworkGraphTraverse<NodeId = OffchainPublicKey> + NetworkGraphView<NodeId = OffchainPublicKey>, <G as NetworkGraphTraverse>::Observed: EdgeObservableRead + Send + 'static, C: CostFn<Weight = <G as NetworkGraphTraverse>::Observed, Cost = f64>,
Expand description

Compute candidate paths from src to dest through graph.

length is the number of edges to traverse (= intermediate hops + 1). take caps the number of candidate paths returned. The source node is stripped from every returned path; callers receive ([intermediates..., dest], cost).