Challenges : Graphs, Ques : Chicago - 106 miles to chicago

Code link: https://ide.codingblocks.com/s/454297

why is it failing for 2 test cases?

Hello @deep4013

why u r using kruskal here?

u have to always start from source and whatever path u will choose its net probability will depend on what all edges we have considered.
so use dijkastra . push source , update probabilty of all neighours.
pick neighour with max probabiltiy and again continue from here.

note probability till neigbour= probability till current node * probabiltiy of edge between current node and neighbour

I thought that maximum spanning tree would work. Would try with dijkstra too. Thanks!

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.