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

Unexpected output with parallel boundary edges #81

Closed
basudha-srivastava opened this issue Nov 2, 2023 · 1 comment · Fixed by #86
Closed

Unexpected output with parallel boundary edges #81

basudha-srivastava opened this issue Nov 2, 2023 · 1 comment · Fixed by #86

Comments

@basudha-srivastava
Copy link

When decoding this matching graph:

from pymatching import Matching
import matplotlib.pyplot as plt

m = Matching()
m.set_boundary_nodes({0, 3, 4})
m.add_edge(0, 1, fault_ids=0, weight=2.6, merge_strategy='independent')
m.add_edge(1, 2, fault_ids=1, weight=2.6, merge_strategy='independent')
m.add_edge(2, 3, fault_ids=2, weight=5.3, merge_strategy='independent')
m.add_edge(2, 4, fault_ids=3, weight=2.6, merge_strategy='independent')
m.add_edge(0, 3, weight=0.0)
m.add_edge(0, 4, weight=0.0)
m.add_edge(4, 3, weight=0.0)

z_error = m.decode([0, 0, 1, 0, 0])

print(z_error)

pymatching outputs [1 1 0 0] but I would have expected [0 0 0 1]. Do you know what the reason could be for this? Thanks!

oscarhiggott added a commit that referenced this issue Feb 1, 2024
…erGraph boundary nodes results in parallel boundary edges. Fixes #81.
oscarhiggott added a commit that referenced this issue Feb 1, 2024
…ersion from UserGraph to MatchingGraph/SearchGraph (#86)

* Ensure that parallel edge with minimum weight is kept when merging UserGraph boundary nodes results in parallel boundary edges. Fixes #81.

* Update pm::UserGraph::to_search_graph to match parallel boundary edge behaviour of pm::UserGraph::to_matching_graph

* Refactor by adding UserGraph::to_matching_or_search_graph_helper

* Bump stim version in ci

* Unpin ninja version in ci

* Remove matrix.python-version in ci

* Add setup-python action to build_wheels in ci

* Update cibuildwheel to v2.16.5

* Specify python-version in pip_install ci

* Add back macosx deployment target in build_wheels in ci
@oscarhiggott
Copy link
Owner

oscarhiggott commented Feb 1, 2024

Hi Basudha, thanks for flagging this, this issue has now been fixed in PR #86 (which correctly outputs [0 0 0 1] for your example) and the fix will be released in the next version of pymatching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants