I am not able to find the shortest distance for the last vertex of the graph (i.e 4). because the vertex is not adding in the graph pleass see my code one's

hello @anshulgurawalia


intead of iterating on map .
iterate from 1 to V (vertex number) .
and initialise it with 0.

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.