Graph state (source code)

= Graph state
{wiki}

A <graph state> assigns one <qubit> to each vertex of an undirected <graph>. Begin with all <qubits> in $|+\rangle$ and apply a <Controlled-Z gate> for every edge.

For an undirected graph $G=(V,E)$, the <graph state> is
$$
|G\rangle=\prod_{(i,j)\in E}CZ_{ij}|+\rangle^{\otimes|V|}.
$$

The <Controlled-Z gates> commute, so their ordering does not change the result. On a <computational-basis state> $|x\rangle$, each occupied edge contributes $(-1)^{x_ax_b}$; the amplitudes retain equal magnitude but acquire graph-dependent phases. An isolated vertex remains in the <product state> $|+\rangle$, while edges can create <entanglement>. <Qiskit quantum gate documentation by IBM>[IBM Quantum, GraphState: preparation by plus states and one controlled-Z per edge]{ref}