[BugFix, Feature] Fix KeyError in NXGraphCompiler and extending the class of embeddable graphs to unit disk graphs#116
Merged
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #116 +/- ##
==========================================
- Coverage 39.91% 38.81% -1.11%
==========================================
Files 17 17
Lines 1175 1211 +36
Branches 136 140 +4
==========================================
+ Hits 469 470 +1
- Misses 677 712 +35
Partials 29 29 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
Thanks for the PR, I'll try and review it by tomorrow. |
RolandMacDoland
approved these changes
May 2, 2025
Contributor
RolandMacDoland
left a comment
There was a problem hiding this comment.
Thanks a lot @lmoroml nice work indeed :) LGTM. Minor comments.
Co-authored-by: RolandMacDoland <9250798+RolandMacDoland@users.noreply.github.com>
Co-authored-by: RolandMacDoland <9250798+RolandMacDoland@users.noreply.github.com>
Contributor
|
My apologies for the delay, I've been sick :/ Looks good to me, thanks for the PR! |
Yoric
approved these changes
May 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces the following improvements and bug fixes:
Fix for KeyError in NXGraphCompiler: an issue was identified where a
KeyError: "x"occurred when a NetworkX graph was passed to the NXGraphCompiler. This error was caused by a missing check for the existence of the "x" attribute in the graph. The fix involves adding a validation step to ensure that the "x" attribute is present before it is accessed.New Method: is_unit_disk_graph: a new method,
is_unit_disk_graph(), has been added to the BaseGraph class. This method provides a straightforward way to check whether a graph is a unit disk graph, rather than a disk graph.Update to is_embeddable Method: the
is_embeddable()method has been modified to useis_unit_disk_graph()rather than the previousis_disk_graph()method. The change was made because the old implementation, which used a radius of min_atom_distance + epsilon, while correct in theory, unnecessarily limited the class of embeddable graphs. By restricting embeddability to only those unit disk graphs with edges betweenmin_atom_edge_distanceandmin_atom_edge_distance + epsilon, the method was excluding graphs that should have been considered embeddable. The new approach broadens the criteria allowing to embed unit disk graphs.