Apex › Storage & databases

Bellman-Ford & arbitrage detection

The shortest-path algorithm that survives negative edges — and detects the negative cycles where "shortest" breaks down. Step the relaxation passes to watch distances settle on a graph Dijkstra would get wrong, then turn the same machinery into a currency-arbitrage detector: model each rate as −ln(rate) and a profitable trading loop becomes a negative cycle.

More in Storage & databases