Doubt in Dijkstra's Algorithm

When we remove a node from the set, why are we checking for all the neighbors of the node because there may be some neighbors which are already finalized.

hi @singhkaranpreet710_f5e2ca6a9e8e0721,
if it is already finalized then the if condition form distance less than will fail so it will not reach that

Thank you so much @talhashamim001

1 Like

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.