  We study Poincar\'e series associated to a finite collection of divisors on
i. a finite graph and ii. a certain family of metric graphs called chain of
loops. Our main results are proofs of rationality of the Poincar\'e series and
algorithms for computing it in both these cases. The main tools used in the
proof of rationality are the following. For graphs, we study a certain
homomorphism from a free Abelian group of finite rank to the direct sum of the
Jacobian of the graph and the integers. For chains of loops, our main tool is
an analogue of Lang's conjecture for Brill-Noether loci on a chain of loops and
adapts the proof of rationality of the Poincar\'e series of divisors on an
algebraic curve (over an algebraically closed field of characteristic zero).
Our algorithms are based on a closer study of the objects involved in the proof
of rationality, for instance, computing the fibres of certain homomorphisms and
lattice point enumeration in rational polyhedra.
