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.4.tar.gz
(73.7 kB
view hashes)
Built Distributions
Close
Hashes for graphlib2-0.2.4-pp38-pypy38_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cae8dd154b5fd513df910066a1fff4f363850ee858eefd96c7eaa4194633428d |
|
MD5 | 32fee62b4187b741fc8a0355962d9084 |
|
BLAKE2b-256 | 362767b5a4f1cd60b4e3fb1b660d1a0a9c1a1eb75b694f30036adda380dcc0fa |
Close
Hashes for graphlib2-0.2.4-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ba06316d85cb5e69cff900e6aaa646f2a2930f04f2fb2f61d41b1ea8c46026 |
|
MD5 | 22a271bca5b5d94520f78a6ba7d18b06 |
|
BLAKE2b-256 | f0ff6217ebdd74c3ca077431c03416cda9a3b71d32f3d7c16330fe1bbdaf130c |
Close
Hashes for graphlib2-0.2.4-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba51731ed8c39b4757efef86b724b6dae9c6b4a544566ba2576338e34ebe96fc |
|
MD5 | cbd826e364c0a765e7058adf615ed480 |
|
BLAKE2b-256 | 493481d82496a5052ed2133baa75166e8911bf2321ae7a4051fe7d9c6fccbb8d |
Close
Hashes for graphlib2-0.2.4-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f475f972a029299c7b088d0a91f175c2bcface7909ccf1d0ac10344807935a2 |
|
MD5 | b2a82bc6a2c2bd3f5b66e352b478c400 |
|
BLAKE2b-256 | 5d34d603d460dbd9e64aa6749be09ecae979b0e97baca602d9ee87d93d898397 |
Close
Hashes for graphlib2-0.2.4-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ebe638c856b31bbdc05d75cee0e64a93fb189a22125f20e9e644b71539a3e4f |
|
MD5 | e8d3b16a3745a85ad2bf45dd6f364e45 |
|
BLAKE2b-256 | 13c73ff6646b006b598bc809a07b6e3141efd835dc0eaca99120e5a43c693244 |
Close
Hashes for graphlib2-0.2.4-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff8d1604725186188f68dd1bfeb87f822e2e09b44ba203600411d305bdb2ea5e |
|
MD5 | e6d381f5efefc1b9fbdfbc0f2e40cc04 |
|
BLAKE2b-256 | e333e041810824ce50364489c6dffc76aba59e227a08f5b9c05bc5f00e4efcd4 |
Close
Hashes for graphlib2-0.2.4-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d7fbed4fd9ebaf4ef39f26cc88926e532a35e56e0b4670022abff818a8c1dc8 |
|
MD5 | d25803a2c9fd08142be4216d9ae452e8 |
|
BLAKE2b-256 | 84775dbb40c3cd49a9b1eb01fef54b46746dd3b782e6729c3ce3349e2a6f485a |
Close
Hashes for graphlib2-0.2.4-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e81667ed29ab35256ccb582bb702fb71c3915e575027d402da3cf3f16be348d |
|
MD5 | edc78befd8172895df9fcde2c54450fc |
|
BLAKE2b-256 | 3858155dcc45a7a8c63721b67c743b6e5b7acfebfde991b866cda1c331f01a0d |
Close
Hashes for graphlib2-0.2.4-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d818e9c56cf33defc331856d1854f4360f9ac546a988e449d7a068455247cd50 |
|
MD5 | e2b6d0acf80b54fd64f78752ee3ad9bc |
|
BLAKE2b-256 | 91cf2ad63fdffb30f4746536bcabf1f1297f7dce7fff547803670529e9bfefd7 |
Close
Hashes for graphlib2-0.2.4-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35ed473f96ffe9f991c6852cbc8d62cf3763ab3b78f00c929f3df479f4b57c3d |
|
MD5 | fa074d0d869382b56773a95403151b7b |
|
BLAKE2b-256 | 430e9703234a916027d9818ed4f1f08a59125d661109d15f6a63610f62e9ffcd |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93806efe104237838104bb1a6825aece96b444269454ca9404c934cb583b3ac6 |
|
MD5 | cf93ba4dae2015a780e44b2168870e61 |
|
BLAKE2b-256 | 46c6886131e421e95c8b911bc41e5b9130855ae3ce084a2c2414142a041e0c63 |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7de99b77fe8557f506ddeca26b07d62e77de7ae1a2d3878a1567e5cf4b13c1cc |
|
MD5 | cdb7ab70dd1b9a29e0a005a323c0ad5c |
|
BLAKE2b-256 | c98b995d724ddb23ac404658d6dcfcc0a69a9d9ca4bc71cab3eba50b5896aca9 |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad987ae66933d1e86634c66ed12f5bede2b9dec66dd3dfc454d432f4df629a95 |
|
MD5 | 641b12833ba6e8864e97ec81e4fb152a |
|
BLAKE2b-256 | a4e672996f45a6a27db0ee2d6b3fe89445d4fa55ea657ff743630e4f00e52fd5 |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-musllinux_1_1_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b156ffbb2516010c72af034114ada65c755bf80b36e09c05aa6b9a0e65fea0d5 |
|
MD5 | a9d73a297a0f85c1b28d36f9fd1e03a6 |
|
BLAKE2b-256 | f263c09739ad9a97e0f4a1f6aac58250b95988a95aaf1c56930cdd8a21d1f9b2 |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a78473e5bfa02eccdb51d32b11d53cad010ba74c432c12204bb6bc330c64e47 |
|
MD5 | 059153cfe87740869526e52c00a8f74a |
|
BLAKE2b-256 | 1249928c6aeb739f08aee1448806e4f59c9e49023226721dbd857e580ec84128 |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a0e1b705dd3f8959b9cfe1d855883b2aebf9917c074a588b65cfcd2d3cafd1c |
|
MD5 | 5d67ba0cd271c868204d0e592cf75259 |
|
BLAKE2b-256 | 4fde5307d8d739d6e427a176d8b4dc373a06b946063602d324d0fee77e594a8b |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab04045b4b2374f68c7e8fa69580480471e67aac6e7fc465e97e9a8aae13b3b7 |
|
MD5 | 7c6de404882af20dc1fbd63665914ef6 |
|
BLAKE2b-256 | 55cd7bdd993b934111589a12bba0182fd9e8c8910c74bf9f7f3fa45458033a26 |
Close
Hashes for graphlib2-0.2.4-cp37-abi3-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9925328d48b3cbf019f77f028b361571447f2182e03f9185d6ee268c4167dbb0 |
|
MD5 | a09d3ee43a3e3f98a3f0dbd598b5619b |
|
BLAKE2b-256 | d3539dc913c71d4a4fe2d3475608959a662ea890dc15f105431838a59e5df2d2 |