CouplingGraph.get_subgraphs_of_size

CouplingGraph.get_subgraphs_of_size(size)[source]

Find all sets of indices that form connected subgraphs on their own.

Each location describes a valid spot for a size-sized gate, so the number of qudit_indices in each location is size. A location is only included if each pair of qudits is directly connected or connected through other qudits in the location.

Parameters:

size (int) – The size of each location in the final list.

Returns:

The locations compliant with the machine.

Return type:

list[CircuitLocation]

Raises:

ValueError – If size is nonpositive or too large.

Notes

Does a breadth first search on all pairs of qudits, keeps paths that have length equal to size. Note that the coupling map is assumed to be undirected.