@Arjun sir,
Dijkstra cannot work for negative edge weights.
Here, bychance it worked for A , we got correct result.
But, if we take D as source, then D -> H path we get = 2 but there is even a different path = 0.
So, surely it did work for A here, but not for all other edges , which means dijkstra must never be used for negative edge weights ?
Am i thinking right sir..??