Cirq support
Is your feature request related to a problem? Please describe. It would be nice to have a way to generate qviz's json from a Cirq circuit object.
Describe the solution you'd like
Something on the lines of adding a creating a convert_to_qviz() method that takes a Cirq's Circuit object and returns a dictionary/ojbect that can be serialized to the json that qviz supports. For example:
import json
import cirq
from quantum_viz import convert_to_qviz
# Create qubits
q0 = cirq.LineQubit(0)
q1 = cirq.LineQubit(1)
q2 = cirq.LineQubit(2)
# Create a circuit
circuit = cirq.Circuit(
cirq.H(q0), # H gate
cirq.CNOT(q0, q1),
cirq.CNOT(q1, q2),
cirq.measure(q0, key='q0'),
cirq.measure(q1, key='q1'),
cirq.measure(q2, key='q2'),
)
qviz = convert_to_qviz(circuit)
print(json.dumps(qviz))
@anpaz I would love to work on this. I am currently working on enhancing Cirq Circuit's SVG representations and this would be a great addition to the Visualization suite.
Thanks, @freyam! We'd be very happy to welcome your contribution. Please take a look at this feature branch for an example of Qiskit support: https://github.com/microsoft/quantum-viz.js/tree/feature/qiskit What we basically need is a function that translates a Cirq circuit into JSON that is compatible with quantum-viz.js. Let us know if you have any further questions; I'll assign this issue to you.