Problem of the Day
A new programming or logic puzzle every Mon-Fri

Dijkstra's Algorithm

Today's goal is to implement one of the most classic algorithms in path finding and graph theory, Dijkstra's algorithm. If you're unfamiliar with it or graph theory you can head over to this finding the shortest path blog post to learn more.

For bonus points be sure to submit a PR to https://github.com/mburst/dijkstras-algorithm with your implementation.

Here is an example graph with some sample cases:

Visual representation of the computer science graph that's being implemented

print graph.shortest_path('A', 'H')
[H, F, B]

print graph.shortest_path('B', 'C')
[C, F]

Permalink: http://problemotd.com/problem/dijkstras-algorithm/

Comments:

  • There are currently no comments. You can be first!

Content curated by @MaxBurstein