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

Fixes digraph_union if merge_edges is set to true. #439

Merged
merged 6 commits into from Sep 8, 2021

Conversation

georgios-ts
Copy link
Collaborator

Previously, digraph_union would falsely keep or delete
edges if merge_edges is set to true. This commit fixes
the logic of digraph_union to skip an edge from the second
graph if both its endpoints were merged to nodes from the
first graph and these nodes already share an edge with equal
weight data. At the same time, a new function graph_union
was added that returns the union of two PyGraphs.
Closes #432.

Previously, `digraph_union` would falsely keep or delete
edges if `merge_edges` is set to true. This commit fixes
the logic of `digraph_union` to skip an edge from the second
graph if both its endpoints were merged to nodes from the
first graph and these nodes already share an edge with equal
weight data. At the same time, a new function `graph_union`
was added that returns the union of two `PyGraph`s.
Closes Qiskit#432.
@coveralls
Copy link

coveralls commented Sep 7, 2021

Pull Request Test Coverage Report for Build 1213842881

  • 97 of 106 (91.51%) changed or added relevant lines in 4 files are covered.
  • 10 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.1%) to 97.452%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/union.rs 76 77 98.7%
src/graph.rs 0 8 0.0%
Files with Coverage Reduction New Missed Lines %
src/shortest_path/all_pairs_dijkstra.rs 1 99.39%
src/shortest_path/astar.rs 9 91.74%
Totals Coverage Status
Change from base Build 1205986848: -0.1%
Covered Lines: 10172
Relevant Lines: 10438

💛 - Coveralls

@mtreinish mtreinish mentioned this pull request Sep 7, 2021
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

Overall LGTM, definitely an improvement in the logic and does make the behavior of merge_edges more clear. Just a few inline comments and suggestions. The other thing is do you think it's worth adding a dispatch function union to retworkx/__init__.py?

releasenotes/notes/bugfix-union-7da79789134a3028.yaml Outdated Show resolved Hide resolved
releasenotes/notes/bugfix-union-7da79789134a3028.yaml Outdated Show resolved Hide resolved
releasenotes/notes/bugfix-union-7da79789134a3028.yaml Outdated Show resolved Hide resolved
src/union.rs Outdated Show resolved Hide resolved
src/union.rs Outdated Show resolved Hide resolved
Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick updates

releasenotes/notes/bugfix-union-7da79789134a3028.yaml Outdated Show resolved Hide resolved
releasenotes/notes/bugfix-union-7da79789134a3028.yaml Outdated Show resolved Hide resolved
@mtreinish mtreinish merged commit 466b884 into Qiskit:main Sep 8, 2021
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.

digraph_union fails if merge_edges is set to true
3 participants