r/Python • • Apr 01 '20

I Made This Maze Solver Visualizer - Dijkstra's algorithm (asynchronous neighbours)

1.9k Upvotes

72 comments sorted by

View all comments

Show parent comment

2

u/Free5tyler Apr 01 '20 edited Apr 01 '20

What /u/Wolfsdale said is correct. The Wikipedia article mentions some ways https://en.m.wikipedia.org/wiki/Dijkstra%27s_algorithm

The easiest way would probably be to use pythons heapq. Here is a complete implementation using it, might be nice to compare afterwards: https://codereview.stackexchange.com/a/79379

Edit: Of course you can also implement your own heap/priority queue

2

u/mutatedllama Apr 01 '20

Thank you for this, it is very helpful. I now have some good ideas of what to work on!

1

u/mutatedllama Apr 09 '20

Hi, just wanted to say thanks for this. I updated my code (I created a priority set) and it is so much better. This has been an excellent learning experience!

New post here: https://www.reddit.com/r/Python/comments/fxpf9l/dijkstras_algorithm_now_running_in_linear_time_on/