🟣 Bellman-Ford — Negative Weight Shortest Path
USACO C++ Book · Interactive Visualizer
🟣 Bellman-Ford — Edge Relaxation Full Demo
Shortest Path
O(V×E)
Step 0/10
📊 Graph (directed weighted graph with negative edges, starting from node 0)
🗂 Data Structures
dist[] Shortest Distance
Current Edge
Time:
O(V × E)
Space:
O(V + E)
Supports:
Negative Edges ✓
💻 Code
Hint
Click
Next Step ▶
to start and observe how each round of relaxation updates the dist array.
◀ Prev
Next Step ▶
↺ Reset
0/10
Keyboard:
→
Next
←
Prev
R
Reset