oscarhiggott / PyMatching

PyMatching: A Python/C++ library for decoding quantum error correcting codes with minimum-weight perfect matching.
Apache License 2.0
187 stars 32 forks source link

Keep minimum weight edge when merging parallel boundary edges in conversion from UserGraph to MatchingGraph/SearchGraph #86

Closed oscarhiggott closed 9 months ago

oscarhiggott commented 9 months ago

When converting from a pm::UserGraph to a pm::MatchingGraph or pm::SearchGraph, all boundary nodes in the pm::UserGraph are merged into one virtual boundary node. This can sometimes lead to parallel boundary edges during the conversion. Previously, when these parallel boundary edges arose, only the first-added boundary edge was kept, leading to issue #81. This PR fixes the issue by keeping only the minimum-weight parallel boundary edge, since this edge is guaranteed to be chosen over the others by blossom.

Fixes #81.

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (c30fcce) 100.00% compared to head (b90dc08) 100.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #86 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 3 3 Lines 337 337 ========================================= Hits 337 337 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.