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.0.tar.gz
(77.5 kB
view hashes)
Built Distributions
graphlib2-0.2.0-cp37-abi3-win32.whl
(144.9 kB
view hashes)
Close
Hashes for graphlib2-0.2.0-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8954f45a8c577ae69bf737e51fd333120d2b0fb405d8b32ce7add232eb65012e |
|
MD5 | daeea4a8d215fba7918ca7e674ac2faf |
|
BLAKE2b-256 | b88926762d201da494d85c8a3de7585d7c3ac94b0d2d32bb6f2a3ae5958625f3 |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 093f6a8f0ae60ee5017f39598f773214322beefadd4f100c8a9ddb0551e38435 |
|
MD5 | ad3c0d2c85a3c458404db1defeae791d |
|
BLAKE2b-256 | fefb7acbe626349e2d4243ef37b1a9e33c3826377cd3534e5ba4b937eec9870b |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f91bd18af5f93ff6e99758ddf0bb18ac8e22acd20b8f826f28c1a04a81b65b47 |
|
MD5 | 739d281fa59fb7401c79736f435f5429 |
|
BLAKE2b-256 | e65225af2d5e69e8729ed1659315deeed76e561b347b7dc0fbfceabfb59bf948 |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f759fce1256d2a865958c1a7b66ac3dc179e2ed858a179236bf37a357bcfee13 |
|
MD5 | 70bb6744166a7e68ac7ebe86636e6550 |
|
BLAKE2b-256 | 17254f0688f7e2bbf0d3ae903c23c423dffd290ca670058307b13a90e7795c9a |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93844336531ff342d17cd9823860f86e7b82cbe016f8e398ae6b4df119fedbb7 |
|
MD5 | 017a50034c1e0c09a563f7bd39fdce1f |
|
BLAKE2b-256 | 9ffbce21ec31efd19e6a12f3142c7537363fddfc2a09e1c363a335957ef28f11 |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dc14f73df999dedbcb576afb31612965308307ea09831706bde706a9af0eebf |
|
MD5 | b43dd9b88549520ffe46de4dce58e5d8 |
|
BLAKE2b-256 | 26d4683846ff679ab7d5adcf899275958577ca11979f107bd4c9c1c6eea2630e |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f9262cdaebf4432b4a97f7eeaf3fc3561bd96936c36aad03cd35ec714a5cd67 |
|
MD5 | 574d6f1c5dcbef15996d96bce13f9fe0 |
|
BLAKE2b-256 | c1c0d2d380ac9983e1b7a043efbd489aa6460c078e2cbe1c16190377d24faf22 |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bc18be508f748c3a241025a99950ad561d7889bb577db2001ea49895b121b80 |
|
MD5 | b7e56626d986bf114c970278681625a6 |
|
BLAKE2b-256 | 2ccfd85dd258b1176a8230034b1660be5916a04fede7d5aa605ca0f263ae1655 |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ee719fe2722faa386cc81d9ec7d155a578d86b0c4a4d0b59e3b5ac16faaf0ad |
|
MD5 | 14c75ec4c8b3f6bee41b0be6e656a316 |
|
BLAKE2b-256 | 2dbbcde51b1cdf60698fc24dc1dc3568597a94af32d825aaa840960c129492f2 |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d46aa683788e312e48c87003d6b687a25712267f5fb6b3a37644d50c9084992 |
|
MD5 | 5e11504f499227c8fd22e5906ee0f013 |
|
BLAKE2b-256 | 1c4fbd0df1938901a92379e96aac87912b4bee1ecd3354eaf78b90a8cf0bb084 |
Close
Hashes for graphlib2-0.2.0-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e57b4979d43335f0291bf4af4504c9c35392e4748dfaeeda78cad3bdb0e47e14 |
|
MD5 | 678fcb45c0cfa794ed8c3a2936735f4c |
|
BLAKE2b-256 | 89cdec78196d418b3cabf15741ddbcd87b7e14edab9b19136dc5f0e561e520a3 |