I need to perform tensor network contraction on a maxcut circuit, are there any resources or code available which converts maxcut circuit into a tensor network (preferably the adjacency list or any graph based representation)?


2 Answers 2


Quantum circuits are effectively already a special type of tensor networks. We just need to interpret them appropriately to see this. Normally, we think of lines as representing qubits and boxes as quantum gates i.e. $2^k\times 2^k$ matrices in the projective unitary group $PU(2^k)$ where $k$ is the number of qubits on which the gate acts. Instead, we can interpret lines as contractions and boxes as tensors with $2k$ indices with each index ranging over $\{0,1\}$. See Example $3$ on page $7$ in this paper for more details.

Note that some gates admit an alternative interpretion as small subnetworks. For example, CNOT may be interpreted as a tensor $$ \text{CNOT}_{i_1j_1i_2j_2}=\begin{cases}\delta^{i_1}_{i_2}\delta^{j_1}_{j_2}\quad&\text{when}\,i_1=0\\ \delta^{i_1}_{i_2}(1-\delta^{j_1}_{j_2})\quad&\text{when}\,i_1=1\\ \end{cases} $$ or it may be interpreted as a contraction of a $\text{COPY}_{ijk}$ tensor with a $\text{XOR}_{ijk}$ tensor. See Example $4$ on page $7$ in the above paper.

This interpretation allows us to compute the unitary (or indeed any isometry obtained by fixing a subset of the input or output qubits including the input or output state) of any quantum circuit. This is the basis of tensor network simulation of quantum circuits.

  • $\begingroup$ Thanks for the answer. I need to convert a maxcut circuit into a graph (or a hypergraph) in order to perform tensor network contraction. Are there any frameworks available to convert a circuit into a tensor network? $\endgroup$ Feb 28 at 16:20

You may find TensorCircuit package helpful.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.