QPU#
- class iqm.qaoa.transpiler.quantum_hardware.QPU(hardware_graph, hardware_layout=None)[source]#
Bases:
objectA parent class for all QPU architectures.
The main purpose of the QPU class is to store the
hardware_graphand theshortest_path/s in there. The methoddraw()can be used independently to plot the graph (using thehardware_layout), but it’s meant to be used by thedraw()method of the classLayer.- Parameters:
Attributes
The connectivity graph of the QPU.
The layout of the hardware qubits (in the 2D plane).
The set of all
HardQubits of the QPU.The dictionary of dictionaries of shortest paths.
Methods
draw([mapping, ax, gate_lists, show])A method for drawing the QPU.
has_edge(gate)Is there an edge between the qubits involved in
gate?- property hardware_layout: dict[HardQubit, tuple[float, float]]#
The layout of the hardware qubits (in the 2D plane).
- property shortest_path: dict[HardQubit, dict[HardQubit, list[HardQubit]]]#
The dictionary of dictionaries of shortest paths.
It’s defined so that
shortest_path[source][target]is the list of nodes lying on the/a shortest path between thesourceandtargetnodes.
- draw(mapping=None, ax=None, gate_lists=None, show=True, **kwargs)[source]#
A method for drawing the QPU.
It displays the picture of the QPU in a pop-up window, with edges colored based on
gate_lists.- Parameters:
mapping (Mapping | None) – The mapping between the logical and hardware qubits, for labels of the graph nodes.
ax (Axes | None) – An instance of
matplotlib.axes.Axesobject, to define the plotting area.gate_lists (dict[str, list[tuple[HardQubit] | tuple[HardQubit, HardQubit]]] | None) – A dictionary whose keys are colors (as single-letter strings) and values are lists of edges which should be colored that color.
show (bool) – Boolean which decides if the graph will be shown in a pop-up window.
**kwargs (Any) – Arbitrary keyword arguments for
draw_networkx_edges().
- Return type:
None