Shortest Path
Dijkstra: Greedy, faster, doesn't handle negative weights.
Bellman-Ford: Slower, handles negative weights, detects negative cycles.
d^{(k)}(s,v) = \min\{d^{(k-1)}(s,v), \min_u\{d^{(k-1)}(s,u) + w(u,v)\}\}
Bellman-Ford relaxes edges repeatedly, gradually improving distance estimates.
Bellman-Ford handles negative weights and can detect negative cycles, making it more flexible than Dijkstra.
How would you handle currencies with exchange rates that create profitable cycles?
d^{(k)}(s,v) = \min\{d^{(k-1)}(s,v), \min_u\{d^{(k-1)}(s,u) + w(u,v)\}\}
Use this formula to calculate the relationship between different variables in this concept.
Detecting arbitrage opportunities in currency exchange rates.