Cartan matrices and quasi-Cartan matrices play an important role in such areas as Lie theory, representation theory, and algebraic graph theory. It is known that each (connected) positive definite quasi-Cartan matrix
A
∈
M
n
(
Z
)
A\in \mathbb {M}_n(\mathbb {Z})
is
Z
\mathbb {Z}
-equivalent with the Cartan matrix of a Dynkin diagram, called the Dynkin type of
A
A
. We present a symbolic, graph-theoretic algorithm to compute the Dynkin type of
A
A
, of the pessimistic arithmetic (word) complexity
O
(
n
2
)
\mathcal {O}(n^2)
, significantly improving the existing algorithms. As an application we note that our algorithm can be used as a positive definiteness test for an arbitrary quasi-Cartan matrix, more efficient than standard tests. Moreover, we apply the algorithm to study a class of (symmetric and non-symmetric) quasi-Cartan matrices related to Nakayama algebras.