  The measurement of the similarity of RNA secondary structures, and in general
of contact structures, of a fixed length has several specific applications. For
instance, it is used in the analysis of the ensemble of suboptimal secondary
structures generated by a given algorithm on a given RNA sequence, and in the
comparison of the secondary structures predicted by different algorithms on a
given RNA molecule. It is also a useful tool in the quantitative study of
sequence-structure maps. A way to measure this similarity is by means of
metrics. In this paper we introduce a new class of metrics $d_{m}$, $m\geq 3$,
on the set of all contact structures of a fixed length, based on their
representation by means of edge ideals in a polynomial ring. These metrics can
be expressed in terms of Hilbert functions of monomial ideals, which allows the
use of several public domain computer algebra systems to compute them. We study
some abstract properties of these metrics, and we obtain explicit descriptions
of them for $m=3,4$ on arbitrary contact structures and for $m=5,6$ on RNA
secondary structures.
