pub(crate) fn spfa_loop<G, F, K>(
graph: G,
distances: Vec<K>,
predecessors: Option<Vec<Option<G::NodeId>>>,
queue: VecDeque<G::NodeId>,
in_queue: Vec<bool>,
edge_cost: F,
) -> Result<(Vec<K>, Option<Vec<Option<G::NodeId>>>), NegativeCycle>where
G: IntoEdges + IntoNodeIdentifiers + NodeIndexable,
F: FnMut(G::EdgeRef) -> K,
K: BoundedMeasure + Copy,Expand description
The main cycle of the SPFA algorithm. Calculating the predecessors is optional.
The queue must be pre-initialized by at least one source node.
The content of in_queue must match to queue.