heapdict implements the MutableMapping ABC, meaning it works pretty much like a regular Python dict. It’s designed to be used as a priority queue, where items are added and consumed as follows:
hd = heapdict() hd[obj1] = priority1 hd[obj2] = priority2 # ... (obj, priority) = hd.popitem()
Compared to an ordinary dict, a heapdict has the following differences:
- popitem():
Remove and return the (key, priority) pair with the lowest priority, instead of a random object.
- peekitem():
Return the (key, priority) pair with the lowest priority, without removing it.
Unlike the Python standard library’s heapq module, the heapdict supports efficiently changing the priority of an existing object (often called “decrease-key” in textbooks). Altering the priority is important for many algorithms such as Dijkstra’s Algorithm and A*.
Release files for HeapDict 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| HeapDict-1.0.1.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| HeapDict-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / HeapDict-1.0.1.tar.gz
| Download URL | HeapDict-1.0.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8495f57b3e03d8e46d5f1b2cc62ca881aca392fd5cc048dc0aa2e1a6d23ecdb6
|
|
BLAKE2b-256 checksum How to use checksums |
5a9bd8963ae7e388270b695f3b556b6dc9adb70ae9618fba09aa1e7b1886652d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8rc1
|
Release files / HeapDict-1.0.1-py3-none-any.whl
| Download URL | HeapDict-1.0.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6065f90933ab1bb7e50db403b90cab653c853690c5992e69294c2de2b253fc92
|
|
BLAKE2b-256 checksum How to use checksums |
b69dcd4777dbcf3bef9d9627e0fe4bc43d2e294b1baeb01d0422399d5e9de319
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.8rc1
|