CouplingMapfor each connected component.
The connected components of a
CouplingMapare the subgraphs that are not part of any larger subgraph. For example, if you had a coupling map that looked like:
0 --> 1 4 --> 5 ---> 6 --> 7 | | | | V V 2 --> 3
then the connected components of that graph are the subgraphs:
0 --> 1 | | | | V V 2 --> 3
4 --> 5 ---> 6 --> 7
For a connected
CouplingMapobject there is only a single connected component, the entire
This method will return a list of
CouplingMapobjects, one for each connected component in this
CouplingMap. The data payload of each node in the
graphattribute will contain the qubit number in the original graph. This will enables mapping the qubit index in a component subgraph to the original qubit in the combined
CouplingMap. For example:
from qiskit.transpiler import CouplingMap cmap = CouplingMap([[0, 1], [1, 2], [2, 0], [3, 4], [4, 5], [5, 3]]) component_cmaps = cmap.connected_components() print(component_cmaps.graph)
0in the second component is qubit 3 in the original cmap.
- A list of
CouplingMapobjects for each connected
components. The order of this list is deterministic but implementation specific and shouldn’t be relied upon as part of the API.
- A list of
- Return type