  We present an algorithm for efficiently simulating a quantum circuit in the
graph formalism. In the graph formalism, we represent states as a linear
combination of graphs with Clifford operations on their vertices. We show how a
$\mathcal{C}_3$ gate such as the Toffoli gate or $\frac\pi8$ gate acting on a
stabilizer state splits it into two stabilizer states. We also describe
conditions for merging two stabilizer states into one. We discuss applications
of our algorithm to circuit identities and finding low stabilizer rank
representations of magic states.
