How i can print how many nodes he have traveled to reach the dest

how I can give the output of how many nodes we have traveled to reach the dest.

hello @toshitvarshney11
just store one more information for each node ie count of node.

for each node initialse it with one.

now while performing any updation .
check how many nodes the parent node have and then add 1 to it to get count of nodes for current node.

how can i add that parameter in the set or i have to use map instead of set

please help me to code it out

use pair < int, pair< int,int > >
for ur set .
where first param is for distance , second param is for vertex number and third param is for count

check thi s->

i have kept everything same,
just added cnt vector to store number of nodes