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
{{ message }}
Repository navigation
bellmanFord: runs in O(V²·E) rather than the O(V·E) / O(E) stated in README #2236
bellmanFord.js (lines 21–39) finds each edge again via graph.findEdge, which is a linear scan of the vertex's edge list, and has no early exit when a pass relaxes nothing. On complete digraphs with unit weights (a best-case input):
V
node visits
visits / (V·E)
time
20
79,420
10.4
3 ms
40
1.28M
20.5
10 ms
80
20.5M
40.5
136 ms
160
327.6M
80.5
1.8 s
Fix: iterate vertex.getEdges() directly (this also fixes #2230) and stop when an iteration changes nothing.
Activity