Dijkstra's Algorithm_

In the video, how this single for_loop is setting all distance to INT_MAX.
I think this will set all the parent nodes to INT_MAX not all the nodes.

these lines of code:

for(auto j:m){dist[j.first]=INT_MAX;}

@sayedwajahatullah1234
m here is the adjacency list for our graph.
When we run the for each loop
for(auto j:m)
{dist[j.first]=INT_MAX;}

j takes each pair of m one by one.
j.first represents each node while j.second is a linked list of pairs as defined in the code.
We set dist[j.first] = INT_MAX ;
The shortest distance to all nodes is hence initially set to INT_MAX.

If we wish to do any modifications to the parent nodes , we will need to make changes in the parent[ ] .

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.