Dijkstra's algorithm can sometimes work on the graph of some negative edges, for example:
A-->B-->C
while w(A, B) = -1 and w(B, C) = -2 .
But when there is at least one negative edge, it cannot always be correct. as:
A-->B-->C-->D \ / \ _____ /
where w(A, B) = 1 , w(B, C) = 3 , w(C, D) = -5 , w(A, D) = 2 .
If you choose A as the starting point, you will get the shortest path length from A to D, will be 2 Dijkstra's algorithms, not -1 .
This is because Dijkstra's algorithm is a greedy algorithm, and its validation routine uses that all its edges are non-negative to get a contradiction. You can find the proof procedure in Theorem 24.6 (The correctness of Dijkstra's algorithm), Introduction to the algorithm.
source share