pyquil.quantum_processor.transformers.graph_to_compiler_isa module¶
Transformers for converting between NetworkX graphs and CompilerISAs.
- exception pyquil.quantum_processor.transformers.graph_to_compiler_isa.GraphGateError[source]¶
Bases:
ValueError
Signals an error when creating a
CompilerISA
from annx.Graph
.This may raise as a consequence of unsupported gates.
- pyquil.quantum_processor.transformers.graph_to_compiler_isa.compiler_isa_to_graph(compiler_isa: CompilerISA) Graph [source]¶
Generate an
nx.Graph
based on the qubits and edges of anyCompilerISA
.
- pyquil.quantum_processor.transformers.graph_to_compiler_isa.graph_to_compiler_isa(graph: Graph, gates_1q: list[str] | None = None, gates_2q: list[str] | None = None) CompilerISA [source]¶
Generate an
CompilerISA
object from a NetworkX graph and list of 1Q and 2Q gates.May raise
GraphGateError
if the specified gates are not supported.- Parameters:
graph – The graph topology of the quantum_processor.
gates_1q – A list of 1Q gate names to be made available for all qubits in the quantum_processor. Defaults to
DEFAULT_1Q_GATES
.gates_2q – A list of 2Q gate names to be made available for all edges in the quantum_processor. Defaults to
DEFAULT_2Q_GATES
.