discopy2pyzx#

[1]:
import pyzx as zx
from discopy.quantum.zx import *

diagram = Z(1, 2) @ Z(1, 2) >> Id(1) @ SWAP @ Id(1) >> X(2, 1) @ X(2, 1)
diagram.draw()
../_images/notebooks_discopy2pyzx_1_0.svg
[2]:
zx.draw(diagram.to_pyzx())
[3]:
graph = zx.generate.CNOT_HAD_PHASE_circuit(qubits=4,depth=4).to_graph()
zx.draw(graph)
[4]:
Diagram.from_pyzx(graph).draw(aspect='auto', figsize=(8, 6))
../_images/notebooks_discopy2pyzx_4_0.svg
[ ]: