Negative weights using Dijkstra’s Algorithm
The algorithm you have suggested will indeed find the shortest path in this graph, but not all graphs in general. For example, consider this graph: Let’s trace through the execution of your algorithm. First, you set d(A) to 0 and the other distances to ∞. You then expand out node A, setting d(B) to 1, … Read more