You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shortest Path Faster Algorithm (SPFA) is an improvement of the Bellman–Ford algorithm which computes single-source shortest paths in a weighted directed graph. The algorithm is believed to work well on random sparse graphs and is particularly suitable for graphs that contain negative-weight edges.
Pseudo-code for procedure Shortest-Path-Faster-Algorithm(G, s):
for each vertex v ≠ s in V(G)
d(v) := ∞
d(s) := 0
offer s into Q
while Q is not empty
poll Q
for each edge (u, v) in E(G)
if d(u) + w(u, v) < d(v) then
d(v) := d(u) + w(u, v)
if v is not in Q then
offer v into Q
The text was updated successfully, but these errors were encountered:
Pseudo-code for procedure Shortest-Path-Faster-Algorithm(G, s):
The text was updated successfully, but these errors were encountered: