# Why does Dijkstra's algorithm not account for updating node distances after expanding a node?

Why does Dijkstra's algorithm not re-evaluate/re-expand nodes who have been expanded and later had their weight changed?

For example, in the accepted answer of this question (link), if the algorithm simply understands that d(b) has been updated and it should re-expand b, the shortest cost would be found.

Am i missing something?

There is no way to construct a graph where no costs are negative and there exists a path from a to b shorter than the one Dijkstra's algorithm finds.
• Dijkstra's algorithm assumes there are no negative cycles, as I mentioned in the answer above. If you need to handle negative cycles, use Bellman–Ford algorithm instead. – Filip Haglund Apr 20 '16 at 23:35