Question: Graph = [[], [[5, 6], [3, 9]], [], [[4, 7]], [[6, 1]], [[6, 8]], [[3, 5], [1, 6]]] Suppose we have a graph given

Graph = [[], [[5, 6], [3, 9]], [], [[4, 7]], [[6, 1]], [[6, 8]], [[3, 5], [1, 6]]]

 

Suppose we have a graph given above.

I would like to perform dijkstra algorithm on it where source = 2 and destination = 6 (these values will be given in the question so the code must work on any values)

 

Write me a Dijkstras algorithm with minimum cost and the path I need to take for this minimum path.

Please use list of list provided above. Refrain from using other methods of graph such as a dictionary. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!