Skip to main content

compute_paths

Function compute_paths 

Source
fn compute_paths<G, W>(
    graph: &G,
    src: &OffchainPublicKey,
    dest: &OffchainPublicKey,
    length: NonZeroUsize,
    take: usize,
    value_fn: MetricsValueFn<W>,
) -> Vec<PathWithMetrics>
where G: NetworkGraphTraverse<NodeId = OffchainPublicKey, Observed = W>, W: EdgeObservableRead + Send + 'static,
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 graph crate returns only the intermediate nodes (both src and dest stripped); this function re-appends dest so callers receive ([intermediates..., dest], cost).