partition_qubits

partition_qubits(backend, distance, node_subset=None)[source]

Partition the backend’s qubits into groups with minimum distance between them.

Partitions the nodes of the backend’s coupling graph into groups such that qubits in the same group are separated by at least distance edges.

Parameters:
  • backend (Backend) – A Qiskit backend instance

  • distance (int) – Minimum distance (number of edges) between qubits in the same group

  • node_subset (list | None) – Optional subset of qubit indices to partition

Returns:

List of groups, where each group is a list of singleton lists containing qubit indices. Format: [[[q1], [q2], …], [[q3], [q4], …], …]

Return type:

list

Example

>>> groups = partition_qubits(backend, distance=3)
>>> # groups might be: [[[0], [3], [6]], [[1], [4], [7]], [[2], [5], [8]]]