Skip to main content

spfa

Function spfa 

Source
pub fn spfa<G, F>(
    graph: &G,
    source: G::Node,
    edge_cost: F,
) -> Result<Option<BellmanFord<G::Node>>>
where G: IndexGraphView, F: Fn(G::Edge) -> i64,
Expand description

Computes signed single-source paths with the queue-based SPFA algorithm.

ยงErrors

Returns an error for arithmetic overflow or a reachable negative cycle.