Skip to content

Commit c9fa975

Browse files
bushrat011899DasLixouatlv24
authored
Remove petgraph from bevy_ecs (#15519)
# Objective - Contributes to #15460 ## Solution - Removed `petgraph` as a dependency from the `bevy_ecs` crate. - Replaced `TarjanScc` and `GraphMap` with specialised in-tree alternatives. ## Testing - Ran CI locally. - Added new unit tests to check ordering invariants. - Confirmed `petgraph` is no longer present in `cargo tree -p bevy_ecs` ## Migration Guide The `Dag::graph` method no longer returns a `petgraph` `DiGraph` and instead returns the new `DiGraph` type within `bevy_ecs`. Edge and node iteration methods are provided so conversion to the `petgraph` type should be trivial if required. ## Notes - `indexmap` was already in the dependency graph for `bevy_ecs`, so its inclusion here makes no difference to compilation time for Bevy. - The implementation for `Graph` is heavily inspired from the `petgraph` original, with specialisations added to simplify and improve the type. - `petgraph` does have public plans for `no_std` support, however there is no timeframe on if or when that functionality will be available. Moving to an in-house solution in the interim allows Bevy to continue developing its `no_std` offerings and further explore alternate graphing options. --------- Co-authored-by: Lixou <[email protected]> Co-authored-by: vero <[email protected]>
1 parent 410f3c4 commit c9fa975

File tree

8 files changed

+843
-118
lines changed

8 files changed

+843
-118
lines changed

crates/bevy_ecs/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ bevy_tasks = { path = "../bevy_tasks", version = "0.15.0-dev" }
2727
bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
2828
bevy_ecs_macros = { path = "macros", version = "0.15.0-dev" }
2929

30-
petgraph = "0.6"
3130
bitflags = "2.3"
3231
concurrent-queue = "2.5.0"
3332
disqualified = "1.0"
@@ -43,6 +42,7 @@ derive_more = { version = "1", default-features = false, features = [
4342
nonmax = "0.5"
4443
arrayvec = { version = "0.7.4", optional = true }
4544
smallvec = { version = "1", features = ["union"] }
45+
indexmap = { version = "2.5.0", default-features = false, features = ["std"] }
4646
variadics_please = "1.0"
4747

4848
[dev-dependencies]

crates/bevy_ecs/src/schedule/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use variadics_please::all_tuples;
33
use crate::{
44
schedule::{
55
condition::{BoxedCondition, Condition},
6-
graph_utils::{Ambiguity, Dependency, DependencyKind, GraphInfo},
6+
graph::{Ambiguity, Dependency, DependencyKind, GraphInfo},
77
set::{InternedSystemSet, IntoSystemSet, SystemSet},
88
Chain,
99
},

0 commit comments

Comments
 (0)