Regarding negative weight

Can you please tell why negative weight giving error here? I just wanted to know in this code where would dijkstra fail?

This might help https://stackoverflow.com/questions/13159337/why-doesnt-dijkstras-algorithm-work-for-negative-weight-edges

But the implementation here in which we compare and then add, shouldn’t it add there the negative one?

@punetha.anmol001 dijkstra produces wrong answer for negative weight cycles

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.