Why doesn't Dijkstra's algorithm work for negative weight edges?
问题 Can somebody tell me why Dijkstra's algorithm for single source shortest path assumes that the edges must be non-negative. I am talking about only edges not the negative weight cycles. 回答1: Recall that in Dijkstra's algorithm, once a vertex is marked as "closed" (and out of the open set) - the algorithm found the shortest path to it , and will never have to develop this node again - it assumes the path developed to this path is the shortest. But with negative weights - it might not be true.