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

Add is_maximal_matching and is_matching functions #256

Merged
merged 9 commits into from
Mar 2, 2021

Conversation

mtreinish
Copy link
Member

This commit adds new functions for checking a provided matching set is
valid, is_matching(), and that a provided matching set is valid and
maximal, is_maximal_set(). This pairs with #229 and can be used to
partially check the output from the max_weight_matching function added
there. Equivalent functions were implemented in #229 using Python for
the tests in #229 and those tests should be updated to use these
functions instead.

Fixes #255

This commit adds new functions for checking a provided matching set is
valid, is_matching(), and that a provided matching set is valid and
maximal, is_maximal_set(). This pairs with Qiskit#229 and can be used to
partially check the output from the max_weight_matching function added
there. Equivalent functions were implemented in Qiskit#229 using Python for
the tests in Qiskit#229 and those tests should be updated to use these
functions instead.

Fixes Qiskit#255
@coveralls
Copy link

coveralls commented Feb 24, 2021

Pull Request Test Coverage Report for Build 610828102

  • 61 of 61 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 96.449%

Totals Coverage Status
Change from base Build 603735259: 0.04%
Covered Lines: 5758
Relevant Lines: 5970

💛 - Coveralls

@mtreinish mtreinish added this to the 0.8.0 milestone Feb 24, 2021
@mtreinish mtreinish requested a review from itoko February 25, 2021 12:09
Copy link
Collaborator

@itoko itoko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for a quick follow-up PR. I think we can simplify the implementation of _inner_is_matching.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
mtreinish and others added 2 commits March 1, 2021 09:42
The original implementation was based on networkx's which was getting
all the combinations of edges in the matching and checking for unique
endpoints on all those pairs. However, doing the combinations adds
extra complexity when we can just flatten the input matching to a set of
endpoints and if aduplicate is found it's not a valid matching. This
commit updates the inner is_matching function to make this change which
simplifies the code and should be faster.

Co-authored-by: Toshinari Itoko <itoko@jp.ibm.com>
@mtreinish mtreinish requested a review from itoko March 1, 2021 14:44
@mtreinish mtreinish merged commit d7e37bd into Qiskit:master Mar 2, 2021
@mtreinish mtreinish deleted the matching-functions branch March 2, 2021 00:41
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.

Add is_matching and is_maximal_matching functions
3 participants