# Optimal Subarchitectures¶

To compute (near-)optimal subarchitectures of quantum computing architectures with restricted connectivity as described in [9] the `SubarchitectureOrder`

class is provided. This class has functionality to compute the quasi-order that allows for fast computation of optimal subarchitectures.

Note that the initial construction of the ordering might take a while for larger architectures.

classSubarchitectureOrder[source]¶Class representing the partial order of (sub)architectures.

- covering(
nqubits,size)[source]¶Return covering for nqubit circuits.

- Parameters:

nqubits(int) – size of circuit for which the covering should be given.

size(int) – limit for the size of the covering.- Returns:
list[Graph] – Subarchitecture covering for circuits of the given size.

Note

A smaller covering might be found.

- draw_subarchitecture(
subarchitecture)[source]¶Create a matplotlib figure showing subarchitecture within the entire architecture.

Nodes that are part of the subarchitecture are drawn yellow. Nodes that are not part of the subarchitecture are drawn blue.

- Parameters:

subarchitecture(Graph | tuple[int, int]) – Subarchitecture to be drawn.- Returns:
figure.Figure – Matplotlib figure.

- draw_subarchitectures(
subarchitectures)[source]¶Create matplotlib figures showing subarchitectures within the entire architecture.

For each subarchitecture one figure is drawn. Nodes that are part of the subarchitecture are drawn yellow. Nodes that are not part of the subarchitecture are drawn blue.

- Parameters:

subarchitectures(list[Graph] | list[tuple[int, int]]) – Subarchitectures to be drawn.- Returns:
list[figure.Figure] – List of matplotlib figures.

classmethodfrom_backend(backend)[source]¶Construct the partial order from a coupling map defined as a Qiskit backend.

- Parameters:

backend(`BackendV1`

) – Qiskit backend.- Returns:

`SubarchitectureOrder`

– The resulting partial order.

classmethodfrom_backend_v2(backend)[source]¶Construct the partial order from a coupling map defined as a Qiskit backend.

- Parameters:

backend(`BackendV2`

) – Qiskit backend.- Returns:

`SubarchitectureOrder`

– The resulting partial order.

classmethodfrom_coupling_map(coupling_map)[source]¶Construct partial order from coupling map defined as set of tuples of connected qubits.

- Parameters:

coupling_map(`Iterable`

[`tuple`

[`int`

,`int`

]]) – Iterable of tuples of connected qubits.- Returns:

`SubarchitectureOrder`

– The resulting partial order.

classmethodfrom_library(lib_name)[source]¶Construct the partial order from a stored library.

- Parameters:
- Returns:

`SubarchitectureOrder`

– The resulting partial order.

classmethodfrom_qmap_architecture(arch)[source]¶Construct the partial order from a QMAP

`Architecture`

object.

- Parameters:

arch(`Architecture`

) – QMAP architecture.- Returns:

`SubarchitectureOrder`

– The resulting partial order.

classmethodfrom_retworkx_graph(graph)[source]¶Construct the partial order from retworkx graph.

- Parameters:

graph(Graph) – retworkx graph representing the architecture.- Returns:
SubarchitectureOrder – The resulting partial order.

classmethodfrom_string(name)[source]¶Construct the partial order from a library name.

- Parameters:

name(`str`

) – Name of the library.- Returns:

`SubarchitectureOrder`

– The resulting partial order.

QMAP also provides precomputed subarchitecture libraries. The available libraries are available via:

- subarchitectures.precomputed_backends
= ['rigetti_16', 'ibm_guadalupe_16']¶

Convenience methods are provided to import these precomputed orderings:

- subarchitectures.ibm_guadalupe_subarchitectures()¶
Load the precomputed ibm guadalupe subarchitectures.

- Returns:

`SubarchitectureOrder`

– The subarchitecture order for the ibm_guadalupe architecture.

- subarchitectures.rigetti_16_subarchitectures()¶
Load the precomputed rigetti subarchitectures.

- Returns:

`SubarchitectureOrder`

– The subarchitecture order for the 16-qubit Rigetti architecture.