Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #215: Handle non-contiguous numbering in rustworkx backend #225

Conversation

thierry-martinez
Copy link
Contributor

This commit resolves a bug, as tested in the new test case test_pauli_non_contiguous, which previously passed with the networkx backend but failed with the rustworkx backend.

The method BaseGraphState.neighbors now returns an iteration over (Graphix) node indices, rather than rustworkx vertex indices.

These indices are then passed to BaseGraphState.subgraph in BaseGraphState.local_complement. BaseGraphState.subgraph expects node indices, as it converts them back to rustworkx vertex indices.

…ackend

This commit resolves a bug, as tested in the new test case
`test_pauli_non_contiguous`, which previously passed with the
`networkx` backend but failed with the `rustworkx` backend.

The method `BaseGraphState.neighbors` now returns an iteration
over (Graphix) node indices, rather than `rustworkx` vertex
indices.

These indices are then passed to `BaseGraphState.subgraph` in
`BaseGraphState.local_complement`. `BaseGraphState.subgraph` expects
node indices, as it converts them back to `rustworkx` vertex indices.
@EarlMilktea EarlMilktea linked an issue Oct 14, 2024 that may be closed by this pull request
graphix/graphsim/rxgraphstate.py Outdated Show resolved Hide resolved
tests/test_pattern.py Outdated Show resolved Hide resolved
@EarlMilktea
Copy link
Contributor

EarlMilktea commented Oct 18, 2024

@thierry-martinez

I merged master to run the CI against this PR.

@thierry-martinez
Copy link
Contributor Author

Thanks. Everything is green: may I merge?

@thierry-martinez thierry-martinez merged commit b60ff8b into TeamGraphix:master Oct 18, 2024
20 checks passed
@thierry-martinez
Copy link
Contributor Author

Merged! Thanks.

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.

[Bug]: rustworkx fails to handle non-contiguous node numbering
3 participants