Well, just relaxing the already visited nodes in a modified version of Dijkstra is not enough (and this will give you the wrong answer on the chart containing negative edges). In addition, you need to put ANY weakened edge in your container (for example, a priority queue or just a queue). Therefore, you can review the code from line 19 as:
if v is in priority queue then decrease-key(v) else add v into priority queue
In this case, your algorithm may work. In addition, the performance for the modified version of Dijkstra will not decrease for a positive weighted schedule. This is easy to prove because it is, naturally, a greedy algorithm.
However, for graphs containing negative edges, the new algorithm may become slow in terms of theoretical analysis, but it will work well in practice.
Actually, you can take a look at the SPFA (Fastest Fast Track Algorithm) algorithm published by Dingfan Duan in China (1994). Many OIer (Olympic of Info) know this algorithm, because sometimes it can beat Dijkstra.
Cherish
source share