# Graph States¶

Graph states are a type of quantum state that can be represented by a graph \(G\). The state defined by \(G\) is

\[|\psi\rangle = \prod_{i,j \in E(G)} CZ_{ij} |+\rangle^{\otimes n},\]

where \(n\) is the number of nodes, \(E(G)\) is the set of edges, and \(CZ_{ij}\) is the controlled-Z gate on qubits \(i\) and \(j\).

## GraphState¶

In `mentpy`

we can create a graph state using the `GraphState`

class:

```
In [1]: gr = mp.GraphState()
In [2]: gr.add_edges_from([(0, 1), (1, 2), (2, 0)])
In [3]: print(gr)
GraphState with 3 nodes and 3 edges
```

## Stabilizers¶

Graph states are a particular type of stabilizer state. We can get the stabilizer operators of such state using the `stabilizers()`

method:

```
In [4]: stabs = gr.stabilizers()
In [5]: print(stabs)
XZZ
ZXZ
ZZX
```

To learn how to use graph states as resources for computation, see the Creating MBQC Circuits tutorial.