Shortest path faster algorithm (source code)

= Shortest path faster algorithm
{wiki=Shortest_path_faster_algorithm}

The Shortest Path Faster Algorithm (SPFA) is an algorithm used for finding the shortest path in a graph. It is an optimization of the Bellman-Ford algorithm and is particularly effective for graphs with non-negative edge weights. SPFA is often used in scenarios where the graph is dense or when edge weights can be both positive and negative, excluding negative weight cycles.