  Arithmetical structures on graphs were first mentioned in \cite{Lorenzini89}
by D. Lorenzini. Later in \cite{arithmetical} they were further studied on
square non-negative integer matrices. In both cases, necessary and sufficient
conditions for the finiteness of the set of arithmetical structures were given.
Therefore, it is natural to ask for an algorithm that compute them.
  This article is divided in two parts. In the first part we present an
algorithm that computes arithmetical structures on a square integer
non-negative matrix $L$ with zero diagonal. In order to do this we introduce a
new class of Z-matrices, which we call quasi $M$-matrices. We recall that
arithmetical structures on a matrix $L$ are solutions of the polynomial
Diophantine equation \[ f_L(X):=\det(\text{Diag}(X)-L)=0. \] In the second
part, the ideas developed to solve the problem over matrices are generalized to
a wider class of polynomials, which we call dominated. In particular the
concept of arithmetical structure is generalized on this new setting. All this
leads to an algorithm that computes arithmetical structures of dominated
polynomials. Moreover, we show that any other integer solution of a dominated
polynomial is bounded by a finite set and we explore further methods to obtain
them.
