  We have studied the algebraic structure underlying the quantum circuits
composed by $\cZ$ and $\Swap$ gates. Our results are applied to optimize the
circuits and to understand the emergence of entanglement when a circuit acts on
a fully factorized state.
