pyquil.quantum_processor.graph module

An implementation of an AbstractQuantumProcessor based on a NetworkX graph topology.

class pyquil.quantum_processor.graph.NxQuantumProcessor(topology: Graph, gates_1q: list[str] | None = None, gates_2q: list[str] | None = None)[source]

Bases: AbstractQuantumProcessor

An AbstractQuantumProcessor initialized with a user constructed NetworkX graph topology.

Notably, this class is able to serialize a CompilerISA based on the graph topology and the configured 1Q and 2Q gates.

Initialize a new NxQuantumProcessor.

Parameters:
  • topology – The graph topology of the quantum_processor.

  • gates_1q – A list of 1Q gate names supported by all qubits in the quantum_processor.

  • gates_2q – A list of 2Q gate names supported all edges in the quantum_processor.

edges() list[tuple[Any, ...]][source]

Return a sorted list of edges in the quantum_processor.

qubit_topology() Graph[source]

Return the NetworkX graph that represents the connectivity of qubits in this quantum_processor.

qubits() list[int][source]

Return a sorted list of qubits in the quantum_processor.

to_compiler_isa() CompilerISA[source]

Generate a CompilerISA object based on the NetworkX graph, gates_1q, and gates_2q.

May raise GraphGateError if the specified gates are not supported.