Help required in Bellman Ford code.

Can some one help me with this code? I do not know why it is giving me weird values.


[1]


  [1]: https://www.ideone.com/3QSIOt

Just add d[edges[j].u]!=INTMAX in if statement .
That is if(d[edges[j].u]!=INT
MAX && d[edges[j].v]>d[edges[j].u]+edges[j].wt).