  Let $c_n$ denote the number of nodes at a distance $n$ from the root of a
rooted tree. A criterion for proving the rationality and computing the rational
generating function of the sequence $\{c_n\}$ is described. This criterion is
applied to counting the number of conjugacy classes of commuting tuples in
finite groups and the number of isomorphism classes of representations of
polynomial algebras over finite fields. The method for computing the rational
generating functions, when applied to the study of point configurations in
finite sets, gives rise to some classical combinatorial results on Bell numbers
and Stirling numbers of the second kind. When applied to the study of vector
configurations in a finite vector space, it reveals a connection between
counting such configurations and Gaussian binomial coefficients.
