Heapsort, Heap, Data Structures, Python, Sorting Algorithms.
current_distance > (distances[current_city]): continue # else get the distances and find the minimum one for childCity, distance in connections[current_city].items(): NewDistance = current_distance + distance if NewDistance < distances[childCity]: distances[childCity] = NewDistance