Dijkstra's algorithm fails when the graph has?
Dijkstra's algorithm fails when the graph has?
Choose an Option
Answer
Negative weight edges
Theory
Dijkstra's greedy strategy assumes once a node is finalized, its shortest distance won't decrease.
Solution
Negative edges break this invariant — use Bellman-Ford instead.