Skip to content

Commit d93a33f

Browse files
committed
Convert from daggy to petgraph stabledigraph
This commit migrates the internal graph representation of a PyDAG object from daggy to use stabledigraph in petgraph directly. This removes an abstraction layer from the stack and also makes it easier to use the dag in python since the indexes are stable now. The implementation of the petgraph trait implementations is borrowed heavily from mitchmindtree/daggy#21 which added a stable graph dag implementation to daggy. If/when daggy pushes a new release that includes this implementation and keeps up to date with the latest version of petgraph it will probably be worth switching back to that newer version of daggy. The current issue is most of the petgraph algorithms do not work with StableGraph types and instead rely solely on Graph types. As a workaround for this we will need to add local implementations of these algorithms in the repo. Then after we fix these issues upstream and include them in a release we can switch back to petgraph's implementation. Also, right now the scaling performance of this is limited by the cycle detection. At sizes above 10,000 nodes it will take more than a second to add a child, parent, or edge. To avoid this we can either remove the runtime cycle detection on every add operation. Or alternatively looking into adapting the rolling cycle detection we were previously getting for free from daggy. Fixes #6
1 parent 6905f2a commit d93a33f

File tree

3 files changed

+301
-93
lines changed

3 files changed

+301
-93
lines changed

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ name = "retworkx"
1616
crate-type = ["cdylib"]
1717

1818
[dependencies]
19-
petgraph = "0.4"
20-
daggy = "0.6"
19+
petgraph = "0.5"
2120

2221
[dependencies.pyo3]
23-
version = "0.8.3"
22+
version = "0.8.5"
2423
features = ["extension-module"]

0 commit comments

Comments
 (0)