This software offers a heap structure with the ability to decrease and increase keys.
Adding and consuming items with HeapDict is a simple process, as shown in this example: hd = HeapDict() hd[obj1] = priority1 hd[obj2] = priority2 # ... obj = hd.pop()
Compared to an ordinary dict, HeapDict offers new methods for managing priorities. For example, you can use the popitem() method to remove and return the (key, priority) pair with the lowest priority. Alternatively, the peekitem() method returns the (key, priority) pair with the lowest priority, without removing it.
Apart from these changes, HeapDict also stands out from other Python libraries thanks to its ability to efficiently change the priority of an existing object. This feature is critical for implementing many algorithms like Dijkstra's Algorithm and A*. Ultimately, if you need a versatile and lightweight priority queue module in Python, HeapDict could be a valuable addition to your toolkit.
Version 1.0.0: N/A