Skip to content

feat: Port and rewrite MatrixGraph#964

Open
RaoulLuque wants to merge 8 commits intomasterfrom
rl/port_matrix_graph
Open

feat: Port and rewrite MatrixGraph#964
RaoulLuque wants to merge 8 commits intomasterfrom
rl/port_matrix_graph

Conversation

@RaoulLuque
Copy link
Member

This PR ports and rewrites the existing MatrixGraph to the new traits.

Some cleaning up was done, which resulted in a lot of code being removed, or moved to the DirectedGraph and UndirectedGraph trait impls. Separate modules for the Directed and Undirected impls and their helpers were created.

In particular, I used a new crate for MatrixGraph as this allows to import and use MatrixGraph in testing for petgraph-algorithms or other crates without creating a circular dependency (like it would be the case if MatrixGraph was part of the main petgraph crate).

Some of the existing tests were adapted, while most were deleted, as they are redundant once #947 lands.

Notably, a mutable iterator over the edge data for undirected MatrixGraphs was added which uses unsafe. The implementation of this is an adaption of the IterMut implementation for Slice in the standard library.

Documentation as well as node and edge addition and removal methods can still be adapted of course, but with this PR we'd have a first "real" working graph to extend our testing capabilities with.

@RaoulLuque RaoulLuque requested a review from indietyp February 18, 2026 19:49
@RaoulLuque RaoulLuque changed the title feat: Port and rewrite MatrixGraph feat!: Port and rewrite MatrixGraph Feb 18, 2026
@RaoulLuque RaoulLuque changed the title feat!: Port and rewrite MatrixGraph feat: Port and rewrite MatrixGraph Feb 18, 2026
@RaoulLuque RaoulLuque mentioned this pull request Feb 18, 2026
16 tasks
@RaoulLuque
Copy link
Member Author

Semver checks seem to fail as a new crate is created and thus no comparison to the old one can be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant