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.1.2.tar.gz
(74.6 kB
view hashes)
Built Distributions
graphlib2-0.1.2-cp37-abi3-win32.whl
(160.5 kB
view hashes)
Close
Hashes for graphlib2-0.1.2-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4308a2536b8a92b5c57f90d5edb89c8796e52b084b674b6ade8a36370310cf5 |
|
MD5 | ddec9a0423c1173daca165fc715f9241 |
|
BLAKE2b-256 | bcb1048b3932277e083c2baf745edeaafe3d7b918f396b19a419af95ecaf2544 |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6140db01a2526ea013b1959ec2210d2b12098c9544a5ee96db9e81e119461bd8 |
|
MD5 | 32d95a7c7f8ff99f06e9c98e7a449de3 |
|
BLAKE2b-256 | cc12ad498598b0039cb5de2edf78d96919b55f738dc8a94adf06cb6439922ec8 |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e417998deb4d13ce94ff2e2249a08abc51347a82b314c635957a871a7ab497f |
|
MD5 | 225176d25c520392c42bd1d73072991d |
|
BLAKE2b-256 | 2e15465784e4ad111547ff95cd81ae435971d7def53f7bc5aad58f0c511c16d4 |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 215735aed0b7c7d07fe889e0168ebd0a7bedec44f8b0278429bfb535e9c9c460 |
|
MD5 | 39f7328dd03d415beb50e2136aa2c575 |
|
BLAKE2b-256 | 4c5fbfd3209a629564a6eba2755fba654ef74e5fb3ed8c9fd01f583819bf5284 |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9d59540ecace1fa85d6ff95699805acfbd090e2a4155b610a36a36e1001264d |
|
MD5 | e1f1ac90bb25170ff8ffa760a5bcef28 |
|
BLAKE2b-256 | 04cfbfe60a45130105dfa8685889159b88bb1bfd296bf74789a0873071eff6fd |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c2e69e8d96b1f93abefc0b763232583a99efdb20c0c357f1d9412c8dc93c5d7 |
|
MD5 | b2c329f939d23cb5276a5742cd64e2ce |
|
BLAKE2b-256 | a71dea257d99316e19d781a145f7dd4b1aecf1cc2290a638608c841a6cf56c14 |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2ed2f74fa8525e017962cd44ac33ebb81784e93da1aa92c13b987896db44d9b |
|
MD5 | a654fbae23d2529b4b5adcea3568493e |
|
BLAKE2b-256 | d04da5ca90b2d627e0120b2242856e80370b572dbc7191568f7629edeb7036f9 |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d2f10f238a4c4c5e92d6a30f80a4806416f9a2c1eabe93166e8c19263bf95d6 |
|
MD5 | 989b4a2487d85997e504bc35495293cf |
|
BLAKE2b-256 | 00cedb9fe3855d48cdf5bfdbf6d5c60dc7a435fb84b2de6a9eb0b653b7d967d8 |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333a3e26d54c1b666a974c24163cc6299541772edf73db5006214c54d8b3ab60 |
|
MD5 | f03ec0e0b26cab8f41fb813b784ec787 |
|
BLAKE2b-256 | 322a106e2f50508a1f26696bfb8b3ea2a75674a37028cce32341a9479b66c71e |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa5d167924b422f34953ce249e60009f7101cf08766486fb2c10962336b2dca8 |
|
MD5 | b27fcae0a2e833cbccda44fb8ab9d370 |
|
BLAKE2b-256 | 544bf3ed0de41f6b879f5e1b88007aebbe58e0e08c69af83dd87a51c795d2ebb |
Close
Hashes for graphlib2-0.1.2-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c8d4c6bd8b4d8609608cd8fc70e80663b16ec07e4ff072bdce85715efb4282e |
|
MD5 | 0125e1bf6bd27e00dd798c2f22b6393e |
|
BLAKE2b-256 | 560d55f22f013b31f6aaf89dc9f370d7a4efcd0324738d274f7bb2ee2b28012e |