This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am mahadi on github. | |
* I am mahadi (https://keybase.io/mahadi) on keybase. | |
* I have a public key ASBVtR9Us_sRFE5_DtOFym5woONJ3ALJo1piD8UVuzXnmAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dijkstra's algorithm for shortest paths | |
# David Eppstein, UC Irvine, 4 April 2002 | |
# source http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/117228 | |
class priorityDictionary(dict): | |
def __init__(self): | |
"""Initialize priorityDictionary by creating binary heap | |
of pairs (value,key). Note that changing or removing a dict entry will | |
not remove the old pair from the heap until it is found by smallest() or | |
until the heap is rebuilt.""" |