You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unless I'm missing something, sortedcontainers doesn't support dictionaries sorted by value. This is useful to implement priority queues (à-la heapq) where an item's priority can change over time. For example, graph algorithms (e.g., Dijkstra's algorithm for shortest paths) benefit from this. Here's an old Python cookbook recipe of mine for something like that (based, in turn, on an idea by David Eppstein): http://code.activestate.com/recipes/522995-priority-dict-a-priority-queue-with-updatable-prio/ .
I wonder if sortedcontainers would be a good place to put a similar container in a widely used library.
The text was updated successfully, but these errors were encountered:
Hi!
Unless I'm missing something, sortedcontainers doesn't support dictionaries sorted by value. This is useful to implement priority queues (à-la heapq) where an item's priority can change over time. For example, graph algorithms (e.g., Dijkstra's algorithm for shortest paths) benefit from this. Here's an old Python cookbook recipe of mine for something like that (based, in turn, on an idea by David Eppstein): http://code.activestate.com/recipes/522995-priority-dict-a-priority-queue-with-updatable-prio/ .
I wonder if sortedcontainers would be a good place to put a similar container in a widely used library.
The text was updated successfully, but these errors were encountered: