Leivant's ramified recurrence is one of the earliest examples of an implicit
characterization of the polytime functions as a subalgebra of the primitive
recursive functions. Leivant's result, however, is originally stated and proved
only for word algebras, i.e. free algebras whose constructors take at most one
argument. This paper presents an extension of these results to ramified
functions on any free algebras, provided the underlying terms are represented
as graphs rather than trees, so that sharing of identical subterms can be
exploited