qml.qcut.tape_to_graph¶
- tape_to_graph(tape)[source]¶
Converts a quantum tape to a directed multigraph.
Note
This operation is designed for use as part of the circuit cutting workflow. Check out the
qml.cut_circuit()
transform for more details.- Parameters
tape (QuantumTape) – tape to be converted into a directed multigraph
- Returns
a directed multigraph that captures the circuit structure of the input tape. The nodes of the graph are formatted as
WrappedObj(op)
, whereWrappedObj.obj
is the operator.- Return type
nx.MultiDiGraph
Example
Consider the following tape:
ops = [ qml.RX(0.4, wires=0), qml.RY(0.9, wires=0), qml.CNOT(wires=[0, 1]), ] measurements = [qml.expval(qml.Z(1))] tape = qml.tape.QuantumTape(ops,)
Its corresponding circuit graph can be found using
>>> qml.qcut.tape_to_graph(tape) <networkx.classes.multidigraph.MultiDiGraph at 0x7fe41cbd7210>
code/api/pennylane.qcut.tape_to_graph
Download Python script
Download Notebook
View on GitHub