  In this paper, based on the nonbinary graph state, we present a systematic
way of constructing good non-binary quantum codes, both additive and
nonadditive, for systems with integer dimensions. With the help of computer
search, which results in many interesting codes including some nonadditive
codes meeting the Singleton bounds, we are able to construct explicitly four
families of optimal codes, namely, $[[6,2,3]]_p$, $[[7,3,3]]_p$, $[[8,2,4]]_p$
and $[[8,4,3]]_p$ for any odd dimension $p$ and a family of nonadditive code
$((5,p,3))_p$ for arbitrary $p>3$. In the case of composite numbers as
dimensions, we also construct a family of stabilizer codes $((6,2\cdot
p^2,3))_{2p}$ for odd $p$, whose coding subspace is {\em not} of a dimension
that is a power of the dimension of the physical subsystem.
