The Lefschetz fixed point theorem is then equivalent to the statement that $\zeta_f$ is equal to the alternating product of the characteristic polynomial of the induced action of $f$ on the singular homology groups $H_k(X, \mathbb{Q})$; in particular, $\zeta_f$ is rational because there are finitely many such groups. Weil famously suggested that if one could define an analogue of singular homology for varieties over finite fields, an analogue of the Lefschetz fixed point theorem would prove the Weil conjectures. This was eventually done, and is known as the etale cohomology.
However, I'm interested in a much simpler dynamical system than a variety over a finite field. Let $G$ be a finite (directed, possibly with loops) graph, let $X(G)$ be the set of aperiodic closed walks on $G$ with a distinguished vertex, and let $f : X(G) \to X(G)$ be the function which sends the distinguished vertex of an aperiodic closed walk to the next vertex in the walk. (An aperiodic closed walk is analogous to a point together with all of its Galois conjugates, and $f$ is conjugation.) Then $\text{Fix } f^n$ is precisely the number of closed walks of length $n$ on $G$. A basic result in algebraic combinatorics then tells us that $\text{Fix } f^n = \text{tr } \mathbf{A}^n$, where $\mathbf{A}$ is the adjacency matrix of $G$, and this is equivalent to the statement that
Edit, 1/8/10: Let me give an example where I can introduce another "homology group." Let $H$ be a proper subgraph of $G$, and let $X(G, H)$ denote the set of aperiodic closed walks on $G$ with a distinguished vertex and with the property that at least one edge or vertex of the closed walk is not in $H$; $f$ is the same as above. If $\mathbf{B}$ denotes the adjacency matrix of $H$, it then follows that $\text{Fix } f^n = \text{tr } \left( \mathbf{A}^n - \mathbf{B}^n \right)$, hence
$\displaystyle \zeta_f(t) = \frac{\det(\mathbf{I} - \mathbf{B}t)}{\det(\mathbf{I} - \mathbf{A}t)}$.
What is a sensible definition of the (say, integral) homology of a discrete dynamical system without any further structure? What conditions on $X$ are necessary to ensure that there are only finitely many homology groups, and do they hold for $X(G)$ and/or $X(G, H)$?
Under what conditions does an analogue of the Lefschetz fixed point theorem hold for this homology theory, and can it be made to correctly reproduce the $X(G)$ computationand $X(G, H)$ computations above?