-
Notifications
You must be signed in to change notification settings - Fork 151
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 new subsitute_subgraph() method to graph classes #823
Open
mtreinish
wants to merge
11
commits into
Qiskit:main
Choose a base branch
from
mtreinish:substitute_subgraph
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b415851
Add new subsitute_subgraph() graph classes
mtreinish 64cc4cc
Merge branch 'main' into substitute_subgraph
mtreinish 10fe40c
Fix MSRV compatibility
mtreinish 3b1df9c
Merge branch 'main' into substitute_subgraph
mtreinish 9ab2100
Fix docs build
mtreinish 980557b
Merge remote-tracking branch 'origin/main' into substitute_subgraph
mtreinish a3449e2
Add option for cycle checking
mtreinish 071125f
Merge branch 'main' into substitute_subgraph
IvanIsCoding b396965
Merge remote-tracking branch 'origin/main' into substitute_subgraph
mtreinish 3f90b72
Fix docs typos
mtreinish aeee114
Separate io_nodes into 2 vecs
mtreinish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
releasenotes/notes/add-substitute_subgraph-d491479ed931cb79.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
features: | ||
- | | ||
Added new methods, :meth:`.PyDiGraph.subsitute_subgraph` and | ||
:meth:`.PyGraph.substitute_subgraph`, which is used to replace | ||
a subgraph in a graph object with an external graph. |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name
force
for this parameter seems a bit misleading to me. In the context of this method's name, I would expect that force would mean to add the edge, even if it violates properties of the graph (e.g. introduces cycles). I'm also not a fan of us needing to pass a new parameter at all of the callsites for_add_edge
.Instead, what would you think about adding a new method called something like
_error_if_would_cycle
that takes the indices in question, and contains code moved from_add_edge
which does the cycle check and error construction:We could then call this from
_add_edge
ifself.check_cycle
istrue
, which preserves the current expectations of callers, and call it manually followed by a call toadd_edge_no_cycle_check
from methods likesubstitute_subgraph
which offer cycle detection irrespective of whether or notself.check_cycle
is enabled.