Problem in code discussed in dijkstra algorithm pls explain

in addedge() we are doing m[a].push_back(b) magar agar kise node ke outdegree 0 han toh vo map me as a key nahi hoga and then jab hum dist banaenge toh usme uske value int_max se intialise nahi hogi or ans galat aaega
code disscussed in this video not accepting this case

Hello @hssharma2212000 if any node is inititalise in the list with th e INT_MAx then it represents that it is yet not visited.
and it will try to visit it and if any node which is not visites ans has no child node means 0 outdegree then it will start returning rather then cotinuining further.
this means that we have reached to the end of that particular path and it will tru to find other any noide is not visited.
Happy Learnign!!

bro if a node has 0 outdegree it will not be initialised in list with int_max

@hssharma2212000 have you prepares the separate visited array for checking whether you have visited that node or not?

@hssharma2212000 instead of making the visited array we intiliase every ndie distance as intmax so that we can check if the node distance is intmax then it is not visited .

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.