I am trying to get minimum value from a set in python by using min().
Constraints:
- I am using a dictionary which maps a node to a value but this dictionary is constantly being updated.
- I am reducing the size of set constantly.
My set has 510650 elements.
current = min(unvisited, key=lambda node: distanceTo[node])
.
Name of dictionary is 'distanceTo'.
Name of set is 'unvisited'.