pyquil.quantum_processor.graph module

class pyquil.quantum_processor.graph.NxQuantumProcessor(topology: networkx.classes.graph.Graph, gates_1q: Optional[List[str]] = None, gates_2q: Optional[List[str]] = None)[source]

Bases: pyquil.quantum_processor._base.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.

  • 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]
qubit_topology() networkx.classes.graph.Graph[source]

The connectivity of qubits in this quantum_processor given as a NetworkX graph.

qubits() List[int][source]

A sorted list of qubits in the quantum_processor topology.

to_compiler_isa() pyquil.external.rpcq.CompilerISA[source]

Generate a CompilerISA object based on a NetworkX graph and the gates_1q and gates_2q with which the quantum_processor was initialized.

May raise GraphGateError if the specified gates are not supported.