Python: Dijkstra's algorithm using the pqdict module