delhi is 0 because Amritsar to delhi there was way while delhi to amritsar not thats why
djisktra can be worked for directed uni or bi graphs also distance of weights should be positive . if neg djikstra dont work
@S19LPPP0202
Dijkshitra algorithm problem
my starting source was amritsar and if Amritsar to delhi there was way then it should have output that distance as output then…
but as you can see its giving correct on using bidirected only so i think its the error .
will see it one more time and tell you
Plz see and let me know because this is a conceptual error as well and I would like to clear it …
but as you can see its giving correct on using bidirected only so i think its the error . This is definitely not the reason as it would mean that Dijkstra will not work on directed graphs which contradicts your own statement…
@S19LPPP0202 the problem was very small. actually dist of delhi was not setting to int_max as delhi dont have any children so it was not in the graph as a key. just set its dist to int max ans will come
what was the error ??
read above i have written @S19LPPP0202
the problem was very small. actually dist of delhi was not setting to int_max as delhi dont have any children so it was not in the graph as a key. just set its dist to int max ans will come
yeah thanks for correcting the mistake …
by the way i was also facing problem in prims implementation i have posted a seperate doubt for that if u could clear it now it would be very helpful…
link of doubt :
hey just mark this as resolved someone will acknowledge that doubt
i haven’t studied prim algo otherwise would have cleared it @S19LPPP0202
how to print path of min distance…
here @S19LPPP0202 look at this i have modified your code to print it commented the changes
i hope your doubt is cleared if yes dont forget to mark it as resolved
plz reply to this doubt of mine as well…
no one is replying to this …it has been posted for a very long time…
i will mark dijkstra as resolved…
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.