Rust port of the Python stdlib graphlib modules
Project description
graphlib2
This is a Rust port of Python's stdlib graphlib. It passes all of the standard libraries tests and is a drop in replacement. This also happens to be Python 3.7 compatible, so it can be used as a backport. Since usage is exactly the same as the standard libraries, please refer to their documentation for usage details.
Example
from graphlib2 import TopologicalSorter
graph = {0: [1], 1: [2]} # 0 depends on 1, 1 depends on 2
ts = TopologicalSorter(graph)
ts.prepare()
while ts.is_active():
ready_nodes = ts.get_ready()
ts.done(*ready_nodes) # all at a time or one by one
Motivation
This was primarily written for di and for me to learn Rust. In other words: please vet the code yourself before using this.
Differences with the stdlib implementation
- Additional APIs for removing nodes from the graph (
TopologicalSorter.remove_nodes
) and copying a preparedTopologicalSorter
(TopologicalSorter.copy
). - A couple factors (~5x) faster for large highly branched graphs.
- Unlocks the GIL during certain operations, which can considerably speed up multithreaded workloads.
Development
- Clone the repo.
- Run
make init
- Run
make test
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
graphlib2-0.2.2.tar.gz
(75.5 kB
view hashes)
Built Distributions
graphlib2-0.2.2-cp37-abi3-win32.whl
(144.9 kB
view hashes)
Close
Hashes for graphlib2-0.2.2-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1cd699967d5d1edaefcc995998436d49f6d67130339c9f4c52dfb3ef4999a5b |
|
MD5 | 8a6b2f2f75e1091ebc32b43a1fb2dcbe |
|
BLAKE2b-256 | e3182283010070348ab5ead67486c648824388353918784aac7f8d6add88c1a6 |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d500fe998a3372f0795b6ed505956739f69a7d66748ee7f48f95c1efe960192c |
|
MD5 | bb4e3443e627153193f723128efcac12 |
|
BLAKE2b-256 | 7f26d336cae802a7ca5689f27451fd1c51ddfd74c824ab960a4f6828efdfef06 |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 249a1e2c7e119cdfa9c3ddd2812fbd774c4b273015ca0faae5e940520e9ec955 |
|
MD5 | af61271a110a63d68c60c25858c594b4 |
|
BLAKE2b-256 | 43126fa4bb940abd7866d4807465ee5332096abb8a2ae62f3f0d531013fd636e |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c49f697a0ebfd49dd344f7bb63ca5f82085a2d9cd86a343ce094c4ec8068f1be |
|
MD5 | f052c490a68f1aaa8bbd10bd1ffefb7a |
|
BLAKE2b-256 | cee28ac4894179070d9243a2d48217a29d6a21546cdd5cfbce1ddfe8779b344c |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 646d971090fe09228fe627e16842b800d30f630920ee071b321de8b8d3b4b111 |
|
MD5 | 12ac7aca9c3f570f1203d6e516fb8232 |
|
BLAKE2b-256 | 3e9739c0553711708b076150395435872cbd343126600e4d023fabfa0bdbf890 |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3d864f56e72ab71194bb46bec0f641bb55fc0b3075ff3b53403e599da408d97 |
|
MD5 | d078062fd0495ce3a98b06fa539a8135 |
|
BLAKE2b-256 | b22035ae22bf2a66d21ddc80e9729d1b8f710e4b4f29b275f134e386834527e0 |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0be6fc5322d22045d8e90bfaa2a653e0b5cfa9f7bc60efd9c0cda1e27af021a1 |
|
MD5 | fff0a7f1dcf0b2dd6274d6fc8929851a |
|
BLAKE2b-256 | d1b4ff1bba2c568ecc1183f670b4e9527adc1be91def0659ce240dc3562e375f |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f6dae5845967060be2716a38e7278ba2e89e5df741503da4588cdeabab4367f |
|
MD5 | 76a701a8c4e4efdae2879c0710ab0959 |
|
BLAKE2b-256 | cda54ef325844d64c0e5b19af4110a5c37359fae9fc828ccd6c81cc8e32f07a4 |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8bba06b5c834117ce05c402ec73698f9b44eb373e0be3138f2a34f352aecf4e |
|
MD5 | 6bd94b5f1d29c0163671d10e425a21e5 |
|
BLAKE2b-256 | 61a111ccfc4be2594e8c293b0f58144e89d191f88d21c975a9a284f64712c146 |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcf2ae5bd0f256e754cd15056100bc7fb6dc56909ad45e0ae45381601096fbb3 |
|
MD5 | 62f0d6e42c967d1680211588b5357f3a |
|
BLAKE2b-256 | 658eb0391148ca9ee527263817f837c1dc79448174e5aa7c62a2bb5a3f7b0546 |
Close
Hashes for graphlib2-0.2.2-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3035d7ea9a860cdb842f5961632a9d8f9f7a787f8652fb2f51d71269b372806 |
|
MD5 | 1040b14460e47af9e71c3f1c5e6463e8 |
|
BLAKE2b-256 | 42a465e68c764290a5f1ffe1d8e8e9186369d94012f5db9420a893ed5910efc4 |