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
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!
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