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

[Bug]: rustworkx fails to handle non-contiguous node numbering #215

Open
thierry-martinez opened this issue Sep 30, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@thierry-martinez
Copy link
Contributor

thierry-martinez commented Sep 30, 2024

The following code raises KeyError in rxgraphviews.get_node_index when use_rustworkx is True:

    @pytest.mark.parametrize("use_rustworkx", [False, True])
    def test_pauli_non_contiguous(self, use_rustworkx) -> None:
        pattern = Pattern(input_nodes=[0])
        pattern.extend([
            N(node=2, state=PlanarState(plane=Plane.XY, angle=0.0)),
            E(nodes=(0, 2)),
            M(node=0, plane=Plane.XY, angle=0.0, s_domain=set(), t_domain=set())
        ])
        pattern.perform_pauli_measurements(use_rustworkx=use_rustworkx)

The bug seems to be between RXGraphState.neighbors, RXGraphState.subgraphs and RXGraphState.local_complement: the indexes returned by neighbors are in the rustworkx numbering, whereas local_complement calls subgraphs on these nodes, which expects them to be in the graphix numbering.

A fix could be to add a idx_to_num mapping in rxgraphviews and convert neighbors in the graphix numbering.

Related issues: #206 (problem with rxgraphviews).

@thierry-martinez thierry-martinez added the bug Something isn't working label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant