  Large RNA molecules often carry multiple functional domains whose spatial
arrangement is an important determinant of their function. Pre-mRNA splicing,
furthermore, relies on the spatial proximity of the splice junctions that can
be separated by very long introns. Similar effects appear in the processing of
RNA virus genomes. Albeit a crude measure, the distribution of spatial
distances in thermodynamic equilibrium therefore provides useful information on
the overall shape of the molecule can provide insights into the interplay of
its functional domains. Spatial distance can be approximated by the
graph-distance in RNA secondary structure. We show here that the equilibrium
distribution of graph-distances between arbitrary nucleotides can be computed
in polynomial time by means of dynamic programming. A naive implementation
would yield recursions with a very high time complexity of O(n^11). Although we
were able to reduce this to O(n^6) for many practical applications a further
reduction seems difficult. We conclude, therefore, that sampling approaches,
which are much easier to implement, are also theoretically favorable for most
real-life applications, in particular since these primarily concern long-range
interactions in very large RNA molecules.
