I hope this question is well-posed.

Let (X, f) be a discrete dynamical system such that every x in X has finite period, i.e. there is some n such that f^n(x) = x. Let Div(X) be the free abelian group on the orbits of X. When X is a nonsingular algebraic curve over the algebraic closure of a finite field k and f is the Frobenius map, Div(X) is naturally isomorphic to the group of fractional ideals of k(X) (at least, I think; correct me if I'm wrong). There is a distinguished subgroup Prin(X) consisting of the preimage of the principal ideals, and Div(X)/Prin(X) is the divisor class group.

Is there a canonical definition of Prin(X) for general dynamical systems? If not, how much extra structure does X need to have for a construction like this to make sense and give some kind of useful information about X?

The case I'm interested in is that X is the set of aperiodic closed walks on a finite graph with a distinguished point and f moves the distinguished point.