We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Dijkstra's Algorithm

Now it's time to put it all together!

Interactive example available with JavaScript enabled.

Assignment

Complete the dijkstra function.

Inputs

  • graph: An adjacency list (a dictionary of dictionaries)
  • src: The key of the starting node
  • dest: The key of the destination node

Outputs

  • The shortest path from src to dest, represented as a list of node keys (i.e., a list of strings)

Algorithm