Skip to content

Commit 9fda230

Browse files
authored
Bump petgraph to 0.8.1 (#1424)
This commit bumps the petgraph version used in rustworkx to the latest release 0.8.1. This is technically an api change for rustworkx-core as some of the generics (mostly around MatrixGraph) changed, but also because now when building rustworkx-core only petgraph 0.8.1 objects are accepted and older releases are no longer compatible with rustworkx-core. This is not generally an issue if you use the rustworkx-core petgraph re-export at ``rustworkx_core::petgraph``, but as 0.8.1 does contain some api changes users will need to account for those when upgrading to rustworkx-core 0.17.0.
1 parent 4c671c0 commit 9fda230

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

Cargo.lock

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fixedbitset = "0.5.7"
3030
indexmap = { version = ">=1.9, <3", features = ["rayon"] }
3131
ndarray = { version = "0.16.1", features = ["rayon"] }
3232
num-traits = "0.2"
33-
petgraph = "0.7"
33+
petgraph = "0.8"
3434
hashbrown = { version = ">=0.13, <0.16", features = ["rayon"] }
3535
numpy = "0.24"
3636
rand = "0.8"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
upgrade:
3+
- |
4+
The version of petgraph used in ``rustworkx-core`` has been bumped to
5+
0.8.1 from 0.7.1. This means for users of ``rustworkx-core`` that are
6+
passing graph objects built using petgraph to algorithm functions you need
7+
to ensure you upgrade your petgraph usage accordingly. This is handled
8+
correctly if you use the petgraph re-export from ``rustworkx_core::petgraph``.
9+
Any API changes around the usage of petgraph will need to be reflected in
10+
the upgrade of your usage however. Refer to the release documentation for
11+
petgraph 0.8.0 for details.

rustworkx-core/src/graph_ext/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
//! | EdgeRemovable | x | x | | | | |
6565
//! | EdgeFindable | x | x | | | | |
6666
67+
use std::hash::BuildHasher;
68+
6769
use petgraph::graph::IndexType;
6870
use petgraph::graphmap::{GraphMap, NodeTrait};
6971
use petgraph::matrix_graph::{MatrixGraph, Nullable};
@@ -119,8 +121,8 @@ where
119121
}
120122
}
121123

122-
impl<N, E, Ty: EdgeType, Null: Nullable<Wrapped = E>, Ix: IndexType> NodeRemovable
123-
for MatrixGraph<N, E, Ty, Null, Ix>
124+
impl<N, E, S: BuildHasher, Ty: EdgeType, Null: Nullable<Wrapped = E>, Ix: IndexType> NodeRemovable
125+
for MatrixGraph<N, E, S, Ty, Null, Ix>
124126
{
125127
type Output = Option<Self::NodeWeight>;
126128
fn remove_node(&mut self, node: Self::NodeId) -> Self::Output {

src/connectivity/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ pub fn graph_all_simple_paths(
843843
Some(depth) => depth - 2,
844844
};
845845
let cutoff_petgraph: Option<usize> = cutoff.map(|depth| depth - 2);
846-
let result: Vec<Vec<usize>> = algo::all_simple_paths(
846+
let result: Vec<Vec<usize>> = algo::all_simple_paths::<Vec<_>, _, ahash::RandomState>(
847847
&graph.graph,
848848
from_index,
849849
to_index,
@@ -897,7 +897,7 @@ pub fn digraph_all_simple_paths(
897897
Some(depth) => depth - 2,
898898
};
899899
let cutoff_petgraph: Option<usize> = cutoff.map(|depth| depth - 2);
900-
let result: Vec<Vec<usize>> = algo::all_simple_paths(
900+
let result: Vec<Vec<usize>> = algo::all_simple_paths::<Vec<_>, _, ahash::RandomState>(
901901
&graph.graph,
902902
from_index,
903903
to_index,

0 commit comments

Comments
 (0)