Neural Ninjas Β· DSA Simulation Labs Β· Lab 34

πŸ” The Bellman-Ford Detector

Every edge in the graph gets relaxed, in one full sweep, exactly V-1 times β€” enough to guarantee every shortest path is found, even through negative-weight edges. Run one sweep MORE, and if anything still changes, that's not a bug β€” it's proof of a negative cycle.

Relaxation Log

Controls

πŸ” LoopI sweep every single edge, in order, once per full loop. I don't stop early just because nothing changed this time β€” I always complete exactly V-1 full sweeps.
⚠️ DetectorAfter all V-1 loops are done, I run one more sweep just to check. If even one edge still wants to improve, that's impossible in a normal graph β€” it means a negative cycle exists.
Pick a level above to begin.