adding an option to CouplingMap.reduce to allow disconnected coupling maps #10863
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.
Summary
This PR adds an option
check_if_connected
toCouplingMap.reduce
, defaulted toTrue
. This corresponds to the previous behavior, checking whether the reduced coupling map remains connected and raising aCouplingError
if not so. When set toFalse
, the check is skipped, allowing disconnected reduced coupling maps. This is useful for synthesis plugins (in particular for #10657) where no connectivity assumptions are necessary (for example, we may want to collect and to resynthesize blocks of consecutive swap gates).Details and comments
This blocks #10657.
The check whether the reduced coupling map is (weakly) connected is now performed only when the option
check_if_connected
is set toTrue
.The actual check now uses the
CouplingMap
's methodis_connected
instead of scipy. There was no noticeable change in performance.One additional minor point is that the reduced coupling map should have the correct number of vertices and either
coupling_map.add_physical_qubit
orcoupling_map.graph.add_node
should be used. Previously nodes with no edges would not have been added.