Are RNA networks scale-free?

A network is scale-free if its connectivity density function is proportional to a power-law distribution. It has been suggested that scale-free networks may provide an explanation for the robustness observed in certain physical and biological phenomena, since the presence of a few highly connected hub nodes and a large number of small-degree nodes may provide alternate paths between any two nodes on average—such robustness has been suggested in studies of metabolic networks, gene interaction networks and protein folding. A theoretical justification for why many networks appear to be scale-free has been provided by Barabási and Albert, who argue that expanding networks, in which new nodes are preferentially attached to highly connected nodes, tend to be scale-free. In this paper, we provide the first efficient algorithm to compute the connectivity density function for the ensemble of all homopolymer secondary structures of a user-specified length—a highly nontrivial result, since the exponential size of such networks precludes their enumeration. Since existent power-law fitting software, such as powerlaw, cannot be used to determine a power-law fit for our exponentially large RNA connectivity data, we also implement efficient code to compute the maximum likelihood estimate for the power-law scaling factor and associated Kolmogorov–Smirnov p value. Hypothesis tests strongly indicate that homopolymer RNA secondary structure networks are not scale-free; moreover, this appears to be the case for real (non-homopolymer) RNA networks.


Introduction
The connectivity (or degree) of a node v in a network (or undirected graph) is the number of nodes (or neighbors) of s, connected to v by an edge. A network is said to be scale-free if its connectivity function N (k), which represents the number of nodes having degree k, satisfies the property that N (a · k) = b · N (x), the unique solution of which is a power-law distribution, which by definition satisfies N (k) ∝ k −α for some scaling factor α > 1 (Newman 2006). Scale-free networks contain a few nodes of high degree and a large number of nodes of small degree, hence may provide a reasonable model to explain the robustness 1 often manifested in biological networkssuch robustness or resilience must, of course, be present for life to exist. Barabasi and Albert (1999) analyzed the emergence of scaling in random networks, and showed that two properties, previously not considered in graph theory, were responsible for the power-law scaling observed in real networks: (1) networks are not static, but grow over time, (2) during network growth, a highly connected node tends to acquire even more connections-the latter concept is known as preferential attachment. In Barabasi and Albert (1999), it was argued that preferential attachment of new nodes implies that the degree N (k) with which a node in the network interacts with k other nodes decays as a power-law, following N (k) ∝ k −α , for α > 1. This argument provides a plausible explanation for why diverse biological and physical networks appear to be scale-free. Indeed, various publications have suggested that the the following biological networks are scale-free: protein-protein interaction networks (Ito et al. 2000;Schwikowski et al. 2000), metabolic networks (Ma and Zeng 2003), gene interaction networks (Tong et al. 2004), yeast co-expression networks (Van Noort et al. 2004), and protein folding networks (Bowman and Pande 2010).

How scale-free are biological networks?
The validity of a power-law fit for previously studied biological networks was first called into question in Khanin and Wit (2006), where 10 published data sets of biological interaction networks were shown not to be fit by a power-law distribution, despite published claims to the contrary. Estimating an optimal power-law scaling factor by maximum likelihood and using χ 2 goodness-of-fit tests, it was shown in Khanin and Wit (2006) that not a single one of the 10 interaction networks had a nonzero probability of being drawn from a power-law distribution; nevertheless, some of the interaction networks could be fit by a truncated power-law distribution. The data analyzed by the authors included data from protein-protein interaction networks (Ito et al. 2000;Schwikowski et al. 2000), gene interaction networks determined by synthetic lethal interactions (Tong et al. 2004), metabolic interaction networks (Ma and Zeng 2003), etc.
In Clauset et al. (2009), 24 real-world data sets were analyzed from a variety of disciplines, each of which had been conjectured to follow a power-law distribution. Estimating an optimal power-law scaling factor by maximum likelihood and using goodness-of-fit tests based on likelihood ratios and on the Kolmogorov-Smirnov statistic for non-normal data, it was shown in Clauset et al. (2009) that some of the conjectured power-law distributions were consistent with claims in the literature, while others were not. For instance, Clauset et al. (2009) found sufficient statistical evidence to reject claims of scale-free behavior for earthquake intensity and metabolic degree networks, while there was insufficient evidence to reject such claims for networks of protein interaction, Internet, and species per genus.
It is possible to come to opposite conclusions, depending on whether χ 2 or Kolmogorov-Smirnov (KS) statistics are used to test the hypothesis whether a network is scale-free, i.e. follows a (possibly truncated) power-law distribution. Indeed, Khanin and Wit (2006) obtained a p value of < 10 −4 for χ 2 goodness-of-fit for a truncated power-law distribution for the protein-protein interaction data from Ito et al. (2000), while Clauset et al. (2009) obtained a p value of 0.31 for KS goodness-of-fit for a truncated power-law for the same data.
In this paper, we introduce the first efficient algorithm to compute the exact number of homopolymer RNA secondary structures having k neighboring structures, for each value of k, that can be reached by adding or deleting one base pair. Since there are exponentially many secondary structures, our O(n 5 ) time and O(n 3 ) space algorithm uses dynamic programming. By applying the Kolmogorov-Smirnov test, we then show that homopolymer RNA secondary structure networks are not scale-free. We also provide evidence that the same is true for real RNA networks. Prior to this paper, only fragmentary results were possible by exhaustively enumerating all secondary structures having free energy within a certain range obove the minimum free energy (Wuchty 2003).
Our work investigates properties of the ensemble of RNA secondary structures, considered as a network, and so extends results of Clote (2015), which described a cubic time dynamic programming algorithm to compute the expected network degree. The RNA connectivity algorithm described in Sect. 2.3 is completely unrelated to that of Clote (2015), and allows one to compute all finite moments, including mean, variance, skew, etc.
The plan of the remaining paper is as follows. Section 2 presents a brief summary of basic definitions, followed by a description of an efficient dynamic programming algorithm to determine the absolute [resp. relative] frequencies N (k) [resp. p(k)] for secondary structure connectivity of a given homopolymer, which allows non-canonical base pairs. Section 3 presents the statistical methods used to both fit RNA connnectivity data to a power-law distribution and to perform a goodness-of-fit test using Kolmogorov-Smirnov distance. Section 4 shows that RNA networks are not scalefree, by performing (computationally efficient) Kolmogorov-Smirnov bootstrapping tests. Section 5 presents concluding remarks, while the Appendix presents data that suggests that RNA networks satisfy a type of preferential attachment. The rigorous proof that RNA networks satisfy modified form of preferential attachment is suppressed for reasons of space, but is available in the preprint (Clote 2018).

Computing degree frequency
Section 2.1 presents basic definitions and notation used; Sect. 2.2 presents an algorithm to compute the frequency of each degree less than K in the ensemble of all secondary structures with run time O(K 2 n 4 ) and memory requirements O(K n 3 ). Section 2.3 presents a more efficient algorithm, with run time O(K 2 n 3 ) and memory requirements O(K n 2 ), for the special case of a homopolymer, in which all possible non-canonical base pairs are permitted. We implemented both algorithms in Python, cross-checked for identical results, and call the resulting code RNAdensity. Since this paper is a theoretical contribution on network properties, we focus only on homopolymers and do not present the details necessary to extend the algorithm of Sect. 2.2 to nonhomopolymer RNA, where base pairs are required to be Watson-Crick or GU wobble pairs-such an algorithm is possible to develop, using ideas of Sect. 2.2; however, since the resulting complexity is formidible, with O(n 9 ) time and O(n 7 ) space requirements, and since there are no obvious applications, we do not pursue such an extension.

Preliminaries
A secondary structure for a length n homopolymer is a set s of base pairs (i, j), such that (1) there exist at least θ unpaired bases in every hairpin, where θ is usually taken to be 3, though sometimes 1 in the literature, (2) there are no basd triples, so for i.e. a secondary structure is a type of outerplanar graph, where each base pair (i, j) ∈ s satisfies j − i > θ. The free energy of a homopolymer secondary structure s is defined to be −1 times the number |s| of base pairs in s [Nussinov-Jacobson energy model (Nussinov and Jacobson 1980)]. Since entropic effects are ignored, this is not a real free energy; however it allows us to use the standard notation "MFE" for 'minimum free energy'. Note that the MFE structure for a length n homopolymer has n−θ 2 many base pairs. For a given RNA sequence, consider the exponentially large network of all its secondary structures, where an undirected edge exists between any two structures s and t, whose base-pair distance equals one-in other words, for which t is obtained from s by either removing or adding one base pair. The connectivity (or degree) of a node, or structure, s is defined to be the number of secondary structures obtained by deleting or adding one base pair to s-this corresponds to the so-called M S 1 move set (Flamm et al. 2000). At the end of the paper, we briefly consider the M S 2 move set, where the degree of a structure s is defined to be the number of secondary structures obtained by adding, deleting or shifting one base pair . The M S 1 [resp. M S 2 ] connectivity of the MFE structure for a homopolymer of length n is n−θ 2 [resp. n−θ 2 ]. Connectivity N (k) is defined to be the absolute frequency of degree k, i.e. the number of secondary structures having exactly k neighbors, that can be obtained by either adding or removing a single base pair. The degree density p(k) is defined to be the probability density function (PDF) or relative frequency of k, i.e. the proportion p(k) = N (k) Z of all secondary structures having k neighbors, where Z denotes the total number of secondary structures for a given homopolymer. A network is defined to be scale-free, provided its degree frequency N (k) is proportional to a power-law, i.e. N (k) ∝ k −α where α > 1 is the scaling factor.

Computing the degree density
In this section, we describe a novel dynamic programming algorithm to compute the M S 1 degree density p(k) for the network of secondary structures for a homopolymer of length n. Note first that the empty structure s ∅ of length n has many neighbors, each obtained by adding a base pair. Indeed, Using a simple induction argument, Eq. (1) implies that for all values of n, the maximum possible degree, maxDegree(n), of a secondary structure for the length n homopolymer is (n−θ)(n−θ−1) 2 Let N (i, j) denote the number of secondary structures on interval [i, j], computed the following simple recurrence relation from Stein and Waterman (1978): Although Eq.
(2) requires O(n 3 ) time and O(n 2 ) space, it can trivially be extended to compute the number of secondary structures for an arbitary RNA sequence a 1 , . . . , a n , where base pairs are either Watson-Crick or wobble pairs. If no such extension is necessary, then the recurrence relation Eq. (3), first given in Stein and Waterman (1978), requires O(n 2 ) time and O(n) space, hence is more efficient by a factor of n. In a similar fashion, the recurrence relations (5-12) and pseudocode in Sect. 2.2 are given in a form that allows an extension (not given here) to the general case of computing the degree density for the ensemble of secondary structures of a given RNA sequence a 1 , . . . , a n . The top-level pseudocode given in Algorithm 1 requires O(n 6 ) time and O(n 4 ) storage; however, in the next section, we improve this by a factor of n, both in time and space requirements. Suppose that every hairpin loop is required to have at least θ ≥ 1 unpaired positions; i.e. if (i, j) is a base pair, then i + θ + 1 ≤ j. As described in the Eqs. (5-12) for Base Cases A-D, let Z (i, j, k, h, v) denote the number of secondary structures on the interval [i, j], for 1 ≤ i ≤ j ≤ n for the homopolymer model, that have exactly k neighbors, and for which there are exactly h unpaired positions (or holes) in [i, j − θ − 1], and for which there are exactly v ∈ [0, θ + 1] visible positions among j − θ, j − θ + 1, . . . , j. Concretely, this means that either (i) v = θ + 1 and the rightmost θ + 1 positions in the interval [i, j] are all unpaired, or (ii) that 0 ≤ v < θ + 1, and that position j − v is paired to some r ∈ [i, j − v − θ − 1]. In base case D and inductive case D below, we will treat the two possible subcases of (i), in which the rightmost θ + 1 positions are unpaired -namely, the subcase (i) a in which j − θ is unpaired (hence the rightmost j − θ + 1 positions are unpaired), and the subcase Let Z * (i, j, k) denote the number of secondary structures on the interval [i, j] that have exactly k neighbors with respect to the M S 1 move set (i.e. have degree k), so that Recalling from Eq. (1) that maxDegree(n) = (n−θ)(n−θ−1) 2 , for any 1 ≤ i ≤ j ≤ n, we clearly have that Z (i, j, k, h, v) In the sequel, we describe Base Cases A-D, which initialize the arrays Z (i, j, k, h, v) and Z * (i, j, k), followed by Inductive Cases A-D, which treat the corresponding updates within the for-loops of the following pseudocode. Since arrays Z , Z * are initially set to zero, all updates to the arrays will be performed by adding a value val to the current value held in the array, so we will write Z (i, j, k, h, v) += val and Z * (i, j, k) += val, which is a standard abbreviation for the assignments Z (i, j, k, h, v) = Z (i, j, k, h, v) + val and Z * (i, j, k) = Z * (i, j, k) + val. Expla-tory comments in the pseudocode are indicated by a double-slash. In Algorithm 1, assume a positive integer input of n to indicate a length n homopolymer.
for i = 1 to n 4.
for k = 0 to maxDegree( j − i + 1) // degree k 7. for for In line 1, arrays Z , Z * are initialized to zero, then Base Cases A-D are applied; lines 2-9 then treat the Inductive Cases A-D. In this dynamic programming (DP) algorithm, the idea is to define Z , Z * for all intervals [i, j] where d = j −i, after having computed and stored the values for Z , Z * for all intervals [i, j] where j −i = d−1. All secondary structures of the interval [i, j] can be partitioned into structures having exactly degree k (i.e. k M S 1 neighbors, in which k structures that can be obtained by either adding or removing a single base pair). To support an inductive argument, in proceeding from interval [i, j] to [i, j + 1], we need additionally to determine the number of structures having degree k, which have a certain number h of positions that are visible (external to every base pair), which can be paired with the last position j + 1. Note that the position j − θ can not be base-paired with j in [i, j]; however, j − θ can be basepaired with j in [i, j + 1]. Thus in addition to keeping track of the number h of holes (positions in i, . . . , j − θ − 1 that are external to all base pairs, hence can be paired with j), we introduce the variable v to keep track of the number of visible positions in j − θ, . . . , j. This explains our need for the function Z (i, j, k, h, v) as defined in the Eqs. (5-12) for Base Cases A-D. We now proceed to the details, where for ease of the reader, some definitions are repeated.
Let θ = 3 denote the minimum number of unpaired positions required to be present in a hairpin loop. For a length n homopolymer, let 1 Recall that Z (i, j, k, h, v) denotes the number of secondary structures on the interval [i, j], for 1 ≤ i ≤ j ≤ n for the homopolymer model, that have exactly k neighbors, and for which there are exactly h unpaired positions (or holes) in [i, j − θ − 1], and for which there are exactly v ∈ [0, θ + 1] visible positions among j −θ, j −θ +1, . . . , j. For 0 ≤ v ≤ θ , this means that position j −v is base-paired to some r ∈ [i, j −v−θ −1] while positions j −v, j −v+1, . . . , j are not base-paired to any position in [i, j]. When v = θ + 1, this means simply that the rightmost θ + 1 positions in the interval [i, j] are all unpaired. Recall as well our definition that Z * (i, j, k) = h v Z (i, j, k, h, v). We begin by initializing Z (i, j, k, h, v) = 0 for all values in corresponding ranges. Letting N (i, j) denote the number of secondary structures on [i, j] for the homopolymer model, as computed by Eq. (2), the following recurrences describe an algorithm that requires O(K · n 3 ) storage and O(K 2 · n 4 ) time to compute the probability 1,n,k) N (1,n) that a (uniformly chosen) random secondary structure has degree k for 0 ≤ k ≤ K , where K is a user-defined constant bounded above by maxDegree(n) = (n−θ)(n−θ−1) 2 .
Base Case A considers all structures on [i, j], as depicted in Fig. 1, that are too small to have any base pairs, hence which have degree zero.

Base Case
Base Case B considers all structures on [i, j], as depicted in Fig. 2, that have only base pair (i, j), since other potential base pairs would contain fewer than θ unpaired bases. The degree of such structures is 1, since only one base pair can be removed, and no base pairs can be added. Moreover, no position in [i, j] is external to the base pair (i, j), so visibility parameters h = 0, v = 0. The arrow in Fig. 2 indicates that the sole neighbor is the empty structure, obtained by removing the base pair (i, j).

Base Case B: For j
Base Case C considers the converse situation, consisting of the empty structure on [i, j] where j − i = θ + 1, whose sole neighbor is the structure consisting of base pair (i, j). The arrow is meant to indicate that the structure on the right is the only neighbor of that on the left, as depicted in Fig. 3. Since the size of the empty structure on [i, j] is θ + 2 and every position in [i, j] is visible (external to every base pair), h = 1 and v = θ + 1. the dotted rectangle in Fig. 3 indicates the θ + 1 unpaired positions at the right extremity as counted by v = θ + 1.

Base Case C:
since maxDegree(i, j) many base pairs can be added to the empty structure. In Fig. 4, the dotted rectangle indicates the θ + 1 rightmost unpaired positions, corresponding to visibility parameter v = θ + 1, while dotted circles indicate the h = j − i − θ holes, i.e. unpaired positions that could be paired with the rightmost position j.

Base Case D:
For all ( j − i + 1) > θ + 2, the empty structure, as indicated by Inductive Case A considers the case where left and right extremities i, j form the base pair from Eq. 4, we have the following.

Inductive Case
From this point on, we use the operator +=, so that the previous equation would be written as Inductive Case B considers the case where last position j base-pairs with the r , where i < r < j − θ . The value r = i has already been considered in Inductive Case A, and values r = j − θ + 1, . . . , j − 1 cannot base-pair to j, since the corresponding hairpin loop would constain less than θ unpaired positions. This situation is depicted The value v = 0 is not considered here, since it was already considered in Inductive Cases A,B. Note that a structure s of the format has k neighbors, provided the restriction of s to [i, r − 1] has k 1 neighbors, and the restriction of s to [r + 1, j − 1] has k 2 neighbors, where k 1 + k 2 + vh + 1 = k. The term vh is due to the fact that since base pair (r , j − v) ensures that all holes are located in [i, r − 1], hence located at more than θ + 1 distance from all visible positions in [ j − v + 1, j], a neighbor of s can be obtained by adding a base pair from any hole to any visible suffix position-there are vh many such possible base pairs that can be added. Finally, the last term +1 is present, since one neighbor of s can obtained by removing base pair (r , j − v). This explains the summation indices and summation terms in Eq. (11). Figure 7 depicts a typical structure considered in case C (v).
is a base pair, while the second term handles the subcase where r > 1. Note that when implemented, this requires a test that h − w ≥ 0.
Case D considers the case where there are h holes, and positions j − θ − 1, . . . , j are unpaired, so that v = θ + 1. Note that v = θ + 1 implies only that j − θ, . . . , j are unpaired, so Case D includes the addition requirement that position j − θ − 1 is unpaired. Structures s satisfying Case D can be partitioned into subcases where the , and that it is essential that w ≥ 1, since the case w = 0 was considered in Case C(θ + 1).
The term w(w+1) 2 is due to the fact that the rightmost position j − θ − 1 in the restriction of s to [i, j − θ − 1] can base-pair with position j, but not with j − 1, etc. since this would violate the requirement of at least θ unpaired bases in a hairpin loop. Similarly, the second rightmost position j −θ −2 in the restriction of s to [i, j −θ −1] can base-pair with positions j and j − 1, but not with j − 2, etc.; as well, the third rightmost position j − θ − 3 can base-pair with positions j, j − 1 and j − 2, but not with j − 3, etc. The number of neighbors of s produced in this fashion is thus The argument just given shows the following. Let s be a structure that satisfies conditions of Case D with h holes and v = θ + 1 visible positions, and suppose that the restriction of s to [i, j − θ − 1] has h − w holes and w visible positions. Then s has k neighbors provided that the restriction of s to As in Case C(v), when implemented, this requires a test that h − w ≥ 0 (see Fig. 8).
Our implementation of Eqs. (5-12) has been cross-checked with exhaustive enumeration; moreover, we always have that k Z * (i, j, k) = N (i, j), so the degree density is correctly computed.

Faster algorithm in the homopolymer case
The algorithm described in Sect. 2.2 requires O(K 2 n 4 ) time and O(K n 3 ) space, where K is a user-specified degree bound K ≤ (n−θ)(n−θ−1) 2 . By minor changes, that algorithm can be modified to compute the degree density function p(k) = Z * (1,n,k) N (1,n) for any given RNA sequence a 1 , . . . , a n . In the case of a homopolymer, any two positions are allowed to base-pair (regardless of whether the base pair is a Watson-Crick or wobble pair), provided only that every hairpin loop contains at least θ unpaired positions. For homopolymers, we have a faster algorithm that requires When implemented, this requires a check that h − w ≥ 0.
Note that h is strictly less than m − θ − 1, since the case h = m − θ − 1 occurs only when additionally v = θ + 1, which only arises in the empty structure. The general case for the empty structure was handled in Base Case D. When implemented, this requires a check that h − w ≥ 0.

Statistical methods
Current software for probability distribution fitting of connectivity data, such as Matlab™, Mathematica™, R and powerlaw (Alstott et al. 2014), appear to require an input file containing the connectivity of each node in the network. In the case of RNA secondary structures, this is only possible for very small sequence length.
To analyze connectivity data computed by the algorithm of Sect. 2.3, we had to implement code to compute the maximum likelihood estimation for scaling factor α in a power-law fit, the optimal degree k min beyond which connectivity data is fit by a power-law, and the associated p value for Kolmogorov-Smirnov goodness-of-fit, as described in Clauset et al. (2009). We call the resulting code RNApowerlaw. This section explains those details.
Recall the definition of the zeta function We use both the generalized zeta function (22), as well as the truncated generalized zeta function (23), defined respectively by Given a data set D = {x 1 , . . . , x n } of positive integers in the range [k 0 , k 1 ], the likelihood L(D|α) that the data fits a truncated power-law with scaling factor α and range [k 0 , k 1 ] is defined by Rather than sampling individual RNA secondary structures to estimate the connectivity of the secondary structure network for a given homopolymer, the algorithms from Sects. 2.2 and 2.3 directly compute the exact number N (k) of secondary structures having degree k, for all k within a certain range. It follows that the likelihood L(D|α) that secondary structure connectivity fits a power-law with scaling factor α is given by hence the log likelihood is is given by The parameter α which maximizes the log likelihood is determined by applying SciPy function minimize (with Nelder-Mead method) to the negative log likelihood, starting from initial estimate α 0 , taken from equation (3.7) of Clauset et al. (2009) which in our notation yields In results and tables of this paper, we often write the maximum likelihood estimate (MLE) α simply as α.
We compute the Kolmogorov-Smirnov (KS) p value, following (Clauset et al. 2009), as follows. Given observed relative frequency distribution D and a power-law fit P with scaling factor α, the KS distance is defined to be the maximum, taken over all k ∈ [k 0 , k 1 ] of the absolute difference between the cumulative distribution function (CDF) for the data evaluated at k, and the CDF for the power-law, evaluated at k where C a and C f are the actual and fitted cumulative density functions, respectively. The KS p value for the fit of data D by power-law P with scaling factor α, is determined by (1) sampling a large number (N = 1000) of synthetic data sets D i from a true powerlaw distribution with scaling factor α, (2) computing the KS distance between each synthetic data set D i and its power law fit with MLE scaling factor α i , (3) reporting the proportion of KS distances that exceed the KS distance between the original observed data set and its power-law fit with scaling factor α.
Following (Clauset et al. 2009), k min is chosen to be that degree k 0 , such that the KS distance for the optimal power-law fit is smallest. In contrast, k max is always taken to be the maximum degree in the input data. Our computation of p value for goodness-of-fit follows Sect. 4.1 of Clauset et al. (2009), with the exception that we not generate any synthetic data for values k < k max , since the MLE scaling factor α is determined for the (normalized) distribution of data values in the interval [k min , k max ], a convention followed in Alstott et al. (2014). We have implemented Python code to compute α 0 , α, k min , KS distance, p value, etc. as described above. In Sect. 4, we compare results of our code with that from powerlaw (Alstott et al. 2014) for very small homopolymers. Though our code does not do lognormal fits, this is performed by powerlaw, where the density function for the lognormal distribution with parameters μ, σ is defined by In computing the p value for power-law goodness-of-fit using Kolmogorov-Smirnov statistics, it is necessary to sample synthetic data from a (discrete) power-law distribution with scaling factor α, a particular type of multinomial distribution. Given an arbitrary multinomial distribution with probability p i for each 1 ≤ i ≤ m, it is straightforward to create M synthetic data sets, each containing N sampled values, in time O(m N M); however, since M = 1000 and N is the (exponentially large) number of all secondary structures having degrees in [k min , k max ], the usual sequential method would require prohibitive run time. Instead, we implemented the much faster conditional method (Malefaki and Iliopoulos 2007). Our goal is to sample from a multinomial distribution given by where m = k max − k min + 1 is the number of degrees in the synthetic data, and in the sample set of size N there are x i many occurrences of degree k min + i. To do this, we sample X 1 from the binomial distribution of N coin tosses with heads probability p 1 , then X 2 from the binomial distribution of N − x 1 coin tosses with heads probability p 2 1− p 1 , then X 3 from the binomial distribution of N − x 1 − x 2 coin tosses with heads probability where each x i is determined with the function binom from Python Scipy.stats.

Results
Below, we use the algorithms described in previous sections to compute RNA secondary structure connectivity, determine optimal scaling factor α and minimum degree k min for a power-law fit, then perform Kolmogorov-Smirnov bootstrapping to determine the goodness-of-fit for parameters α, k min . In Appendix A, we show that preferential attachment appears to hold for the network of RNA structures, at least for our definition of preferential attachment.

Analysis of RNA networks using RNAdensity and RNApowerlaw
The algorithm RNAdensity described in Sect. 2.3 was used to compute absolute and relative degree frequencies for the following cases: (1) Table 1 summarizes these results, which show the agreement between powerlaw and RNApowerlaw. Moreover, both both programs indicate that formal hypothesis testing rejects the null hypothesis that a power-law distribution fits connectivity data; indeed, powerlaw determines a negative log odds ratio R for the logarithm of power-law likelihood over lognormal likelihood, indicating a better fit for the lognormal distribution, and RNApowerlaw determines small p values for Kolmogorov-Smirnov goodness-of-fit of a power-law distribution. Figure 9a shows connectivity density function for a 100-mer, with overlaid Poisson and lognormal   Table headers as follows: n is homopolymer length, S n is the number of all secondary structures, α is the maximum likelihood value for the scaling factor of the optimal power-law fit, as computed by powerlaw (PL) and RNApowerlaw (RNAPL), KSdist is the Kolmogorov-Smirnov (KS) distance using Eq. (29), KSdist is the mean KS-distance obtained by replacing 'max' by 'mean' in Eq. (29), R is the log-odds ratio with associated p value as computed by powerlaw, and the p value in the last column is computed by RNApowerlaw as described in Sect. 3. Since powerlaw required more than 24 h for the computation when n = 28, we did not attempt a computation for n = 30; in contrast, RNApowerlaw requires a few seconds computation time. Since the log-odds ratio R is the logarithm of the power-law likelihood divided by lognormal likelihood, a negative value R < 0 indicates that the lognormal distribution is a better fit for the tail of RNA secondary structure connectivity data. A small p value computed by RNApowerlaw indicates that RNA connectivity data is not well-approximated by a power-law distribution. While our code RNApowerlaw computes the p value for the power-law fit, Alstott's code powerlaw only computes the p value for the log-odds ratio test Fig. 9 a Connectivity degree distribution for homopolymer of length 100 where θ = 3, computed with the algorithm described in Sect. 2.3 for all degrees bounded by K = 200. There are 6.32 · 10 32 secondary structures for the 100-mer (exact number 6.31986335936396855341222902079183), and 99.9978706904% of the structures have degree bounded by K . Using the output degree densities, the degree mean [standard deviation] is μ = 46.2543801196 [resp. σ = 12.2262985078]; note that the mean computed from the algorithm in Sect. 2.3 is very close to the exact degree mean of μ = 46.2591895818, computed over all structures using the different dynamic programming algorithm in Clote (2015). The Poisson distribution (blue curve) with same mean μ is shown, as well as the lognormal distribution (red) with parameters μ 0 = 3.80467214577 and σ 0 = 0.235563374146; i.e. μ 0 [resp. σ 0 ] is the mean [resp. standard deviation] for logarithms of the connectivity degree-see Eq. (30). b Power-law fit of tail with scaling factor α = 7.8762287746 and k min = 83, determined by maximum likelihood. Kolmogorov-Smirnov (KS) distance for the fit is 0.01213-see Eq. (29), while average KS distance for the alpha power-law fit 0.00400. Nevertheless, since the p value 0 (to 10 decimal places), hypothesis testing would reject the null hypothesis that the power-law distribution is a good fit for the tail (color figure online) distributions-since Erdös-Rényi random graphs have a Poisson degree distribution (Albert and Barabási 2002), it follows that RNA secondary structure networks are strikingly different than random graphs. Figure 9b shows a portion of the powerlaw fit for degrees in [k min , k max ], where scaling factor α ≈ 7.876 and k min = 83. Although maximum degree probability at k peak is less than 0.05 for the raw data, the connectivity density for [k min , k max ] is normalized, which explains why the degree probability for k min is ≈ 0.08. Visual inspection might suggest an excellent fit for the power-law distribution; however, a Kolmogorov-Smirnov p value of ≈ 0 indicates that the distribution is not power-law. The seemingly good power-law fit for RNA connectivity data, suggested by visual inspection, however motivated our initial investigation of preferential attachment.
Since powerlaw requires input files of (individually observed) connectivity degrees, when creating Table 1, we could not run powerlaw for homopolymer length greater than 28, for which latter the input file contained 50, 642, 017 values. A potentially attractive alternative is to generate input files consisting of N · p(k) many occurrences of the value k, where N = 10 2 , 10 3 , . . . , 10 7 denotes the total number of samples, and where relative frequency p(k) is the proportion of structures having degree k. However, Table 2 shows that neither scaling factor α nor k min are correct with this alternative approach, even for small homopolymers of length 20, 30 and 40. This table justifies the need for our implementation of RNApowerlaw as described in Sect. 3. Table 3 shows maximum likelihood scaling factors α and Kolmogorov-Smirnov p values for optimal power-law fis of connectivity data for homopolymers of lengths from 30 to 150.  Since powerlaw requires input files of (individually observed) connectivity degrees, rather than a histogram of (absolute) frequencies F(k) of connectivity degrees, we generated a file consisting of N · p(k) many occurrences of the value k, where N = 10 2 , 10 3 , . . . , 10 7 denotes the total number of samples, and where relative frequency  The distribution tail appears to satisfy a powerlaw with exponent ≈ −5.6247, i.e. p(x) ∝ x −5.6247 , where x is degree and p(x) is the relative frequency of the number of nodes having degree x (regression equation log-log plot is ln( p(x)) = 14.7589−5.6247·x). b It is well-known that linear regression of the log-log plot is less reliable than using maximum likelihood when establishing whether the tail of empirical data is fit by a power-law distribution. For the M S 2 connectivity data of a 20-nt homopolymer, the maximum likelihood estimation (MLE) of optimal power-law scaling factor is α = 6.8257 with p value is 0.219 when k min = 36 and k max = 136. Since the p value is not less than 0.05, we can not reject the null hypothesis that M S 2 connectivity is well-fit by a power-law distribution (color figure online) Figure 10a shows a scatter plot with regression line for the cut-off values x c , defined to be the least value such that the probability that a secondary structure for length n homopolymer has degree greater that x c is at most 0.01. From this figure, we determined that for homopolymer length n > 100, it more than suffices to take degree upper bound K = n + 30. Figure 10b shows the connectivity degree distribution for a homopolymer of length 20, where degree dg(s) is redefined to be the number of structures t that can be obtained from s by adding, removing, or shifting a base pair in s. The so-called M S 2 move set, consisting of an addition, removal or shift of a base pair is the default move set used in RNA kinetics software kinfold (Lorenz et al. 2011). Although a dynamic programming algorithm was described in Clote and Bayegan (2015) to compute the average M S 2 network degree, the methods of this paper do not easily generalize to M S 2 connectivity densities. Figure 11 shows a leastsquares regression line for the log-log density plot for M S 2 connectivity (computed by brute-force) for a homopolymer of length 20, together with an optimal power-law fit computed by RNApowerlaw. Since there are only 106.633 secondary structures for the 20-mer with θ = 3, we ran powerlaw on M S 2 connectivity data, which determined α = 6.84, k xmin = 36, and a log odds ratio R = −2.06 with p value of 0.248. Since RNApowerlaw determined α = 6.84, k xmin = 36, and a Kolmogorov-Smirnov p value of 0.219, we can not reject the null hypothesis that a power-law distribution fits the tail of M S 2 connectivity data for a 20-mer.

Conclusion
Since the pioneering work of Zipf on the scale-free nature of natural languages (Zipf 1949), various groups have found scale-free networks in diverse domains ranging from communication patterns of dolphins (McCowan et al. 2002), metabolic networks (Jeong et al. 2000), protein-protein interaction networks (Ito et al. 2000;Schwikowski et al. 2000), protein folding networks (Bowman and Pande 2010), genetic interaction networks (Tong et al. 2004;Van Noort et al. 2004) to multifractal time series (Budroni et al. 2017). These discoveries have galvanized efforts to understand biological networks from a mathematical and topological standpoint. Using mathematical analysis, Barabasi and Albert (1999) established that scale-free networks naturally emerge when networks are dynamic, whereby newly accrued nodes are preferentially connected to nodes already having high degree. On such grounds, one might argue that protein folding networks and protein-protein interaction (PPI) networks should exhibit scalefree properties, since nature is likely to reuse and amplify fast-folding domains-cf. Gilbert's exon shuffling hypothesis (Gilbert 1978). Indeed, Cancherini et al. (2010) have established that in 4 metazoan species analyzed (H. sapiens, M. musculus, D. melanogaster, C. elegans) those genes, which are enriched in exon shuffling events, displayed a higher connectivity degree on average in protein-protein interaction (PPI) networks; i.e. such genes had a larger number of interacting partners. On similar grounds that nature should reuse and amplify successful metabolic networks, one might argue that metabolic networks should exhibit scale-free properties. However, rigorous statistical analysis has shown that metabolic networks fail a goodness-of-fit test for scale-free distribution, while PPI satisfy a goodness-of-fit test for scale-free distributions over a certain range of connectivity (Khanin and Wit 2006;Clauset et al. 2009).
There appears to be a current polemic whether certain naturally occurring networks are scale-free. Broido and Clauset (2019) provide statistical arguments that less than 45 of the 927 real-world network data sets (i.e. 4%) found in the Index of Complex Networks exhibit the "strongest level of direct evidence for scale-free structure". In a response to a preprint of Broido and Clauset (2019) dated March 6, 2018 and posted on the Barabási Lab web site https://www.barabasilab.com/post/love-is-all-you-need, A.L. Barabási argued against the conclusions of Broido and Clauset (2019). Here, it should be noted that this is not the first time a polemic has arisen about the power-law distribution-indeed, there was a heated exchange between Mandelbrot and Simon almost 60 years ago in the journal Information and Control. For details, references, and a history of the power-law distribution, see Mitzenmacher (2004).
Given the current interest in whether certain naturally occurring networks are scale-free, we have introduced a novel algorithm to compute the connectivity density function for a given RNA homopolymer. Our algorithm requires O(K 2 n 4 ) run time and O(K n 3 ) storage, where K is a user-specified degree bound K ≤ (n−θ)(n−θ−1) 2 . Short of exhaustively listing secondary structures by brute-force, no such algorithm existed prior to our work. Since existent software appears unable to perform powerlaw fitting for exponentially large RNA connectivity data, we have also implemented code to compute and statistically evaluate the maximum likelihood power-law fit for an input histogram, using a very fast method to the density function of a sampled power-law distribution with given scaling parameter. Using the resulting code, called RNAdensity and RNApowerlaw, we have computed the connectivity density function for RNA secondary structure networks for homopolymers of length up to 150. Statistical analysis categorically shows that there is no statistically significant powerlaw fit for homopolymer RNA secondary structure network connectivity, despite the seemingly good visual fit shown in Fig. 9. Figure 12 shows that secondary structure network connectivity is not scale-free for the (real) 32 nt selenocysteine insertion sequence fruA. Figure 13 shows that the M S 1 and M S 2 degree distributions for other Average M S 1 -degree 13.10; average M S 2 -degree 33.25. Using notation from Table 9, the MLE powerlaw fit for M S 1 -degree data has values of k min = 35, α(35, 123) = 6.329, K S(35, 123) = 0.0221, K S = 0.0075, p value of 0.0000. In contrast, the MLE power-law fit for M S 2 -degree data has values of k min = 93, α(93, 123) = 14.441, K S(93, 123) = 0.0219, K S = 0.0081, p value of 0.729. Summarizing, Kolmogorov-Smirnov statistics indicate that the M S 1 data is not scale-free, while it cannot be refuted that the M S 2 data is scale-free. However, the range of degrees for which the M S 2 data might be scale-free is from 93 to 123, which accounts for only 5.77 · 10 −4 of the density. As shown in (b), even log-log regression suggests that the M S 2 data is not scale-free. b Log-log plot of M S 2 -density of fruA with regression equation ln density = 24.37 + 7.56 · ln degree, determined from the relative frequency of structures having M S 2degree in the range of 29 to 4123, corresponding to the portion of the M S 2 density starting after the peak of 0.04987 in previous panel at degree k peak = 29 (color figure online) FourU RNA is a class of thermometers found in bacteria such as E. coli, Salmonella, V. cholerae, etc. that regulate protein expression by undergoing a conformation change triggered by temperature-for instance, the conformational change of the V. cholerae fourU thermometer at 37 • C permits the transcription of a virulence factor. All 1,079,102 secondary structures having free energy within 13 kcal/mol of the minimum free energy (MFE) of this RNA were generated using RNAsubopt from the Vienna RNA Package (Lorenz et al. 2011). The M S 1 and M S 2 degree of each secondary structure were determined in order to produce the degree relative frequency histogram. Although the collection of structures having free energy within 13 • C of the MFE contains over one million structures (computation required 1-2 days), there are 1995457849526533 (≈ 1.99546 × 10 15 ) many secondary structures altogether. The average M S 1 degree is 38.0, while the average M S 2 degree is 64.2. FourU M S 1 analysis: Using RNApowerlaw, x min = 93, α = 6.02, and p value is 0 (to 10 decimal places). Using powerlaw, x min = 96, α = 6.02, and the log ratio of power-law fit to log-normal fit is R = −23.6283 with corresponding p value of 1.77 × 10 −4 -in other words, a log-normal distribution provides a significantly better fit than a power-law distribution for the M S 1 degree data of this fourU RNA. FourU M S 2 analysis: Using RNApowerlaw, x min = 85, α = 6.159, and p value is 0 (to 10 decimal places). Using powerlaw, x min = 85, α = 6.159, and the log ratio of power-law fit to log-normal fit is R = −122.1518 with corresponding p value of 5.9389 × 10 −20 -in other words, a log-normal distribution provides a significantly better fit than a power-law distribution for the M S 2 degree data of this fourU RNA. b M S 1 -and M S 2 -degree distribution for the 76 nt alanine transfer RNA from Mycoplasma mycoides with accession code tdbR00000006 from tRNAdb (Juhling et al. 2009) (accession code RA1180 from the Sprinzl tRNA database) with sequence GGGCCCUUAG CUCAGCUGGG AGAGCACCUG CCUUGCACGC AGGGGGUCGA CGGUUCGAUC CCGUUAGGGU CCACCA. All 408414 secondary structures having free energy within 13 kcal/mol of the minimum free energy of this RNA were generated using RNAsubopt from the Vienna RNA Package (Lorenz et al. 2011). The MS1 and MS2 degree of each secondary structure were determined in order to produce the degree relative frequency histogram. Although the collection of secondary structures having free energy within 13 • C of the MFE contains about one-half million structures (computation required 1-2 days), there are 877346780605139050 (≈ 8.77347 × 10 17 ) many secondary structures altogether. The average M S 1 degree is 38.1, while the average M S 2 degree is 68.3. tRNA M S 1 analysis: Using RNApowerlaw, x min = 36, α = 5.1419, and p value is 0 (to 10 decimal places). Using powerlaw, x min = 36, α = 5.1419, and the log ratio of power-law fit to log-normal fit is R = −95.3556, with corresponding p value of 1.6193 × 10 −16 -in other words, a log-normal distribution provides a significantly better fit than a power-law distribution for the M S 1 degree data of this fourU RNA. tRNA M S 2 analysis: Using RNApowerlaw, x min = 114, α = 7.0845 and p value is 0 (to 10 decimal places). Using powerlaw, x min = 122, α = 7.1352, and the log ratio of power-law fit to log-normal fit is R = −41.1935 with corresponding p value of 5.0374 × 10 −6 -in other words, a log-normal distribution provides a better fit than power-law for the M S 2 2 degree data of this tRNA (color figure online)  Fig. 12 was produced by exhaustively enumerating all 971,299 secondary structures of the 32 nt fruA, Figure 13 was produced by enumerating all secondary structures having free energy within 13 kcal/mol of the minimum free energy, as computed by RNAsubopt from the Vienna RNA Package (Lorenz et al. 2011); this procedure generated 1,079,102 secondary structures (out of a total of ≈ 1.99546 × 10 15 structures) for the 65 nt fourU RNA, and 408,414 secondary structures (out of a total of ≈ 8.77347 × 10 17 structures) for the 76 nt tRNA.
Since (Day et al. 2003;Kihara and Skolnick 2003) have presented data that suggests that existent protein structures can be explained using only a small number of protein folds, we presented data in Table 4 that suggests that RNA secondary structures may satisfy a type of preferential attachment-a rigorous combinatorial argument establishes this fact for a modified notion of preferential attachment [data not shown, but available in the Appendix of Clote (2018)]. Finally, Python implementations of the algorithms from this paper are publicly available at http://bioinformatics.bc.edu/ clotelab/RNAnetworks.
As an afternote, our personal opinion is that it doesn't much matter whether a naturally occurring network arising from physical phenomena is precisely scale-free or not. If network connectivity appears to follow a power-law distribution, even approximately, then by results of Barabasi and Albert (1999), this suggests that preferential attachment could play a role in how the network may have been constructed by nature. Preferential attachment might well have been a factor in how protein and RNA structures have been formed by evolutionary forces-even in the emergence of stable folds in prebiotic times (Abkevich et al. 1997). It is noteworthy that only a small number of protein folds suffice to explain the diversity of all protein folds found in the Protein Data Bank (PDB) (Kihara and Skolnick 2003): "The number of proteins required to cover a target protein is very small, e.g. the top ten hit proteins can give 90% coverage below a RMSD of 3.5 Å for proteins up to 320 residues long." As well, the 30 most populated metafolds represent "about half of a nonredundant subset of the PDB" (Day et al. 2003). However, other evolutionary factors seem to be present in the evolution of protein folds, such as kinetic accessibility (Cossio et al. 2010), as well as the ability to switch between alternate conformations (Porter and Looger 2018).

P. Clote
material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

A Preferential attachment of RNA secondary structures
In this section, we provide preliminary data that suggest that preferential attachment holds in the homopolymer RNA secondary structure model. A rigorous argument can be found in the preprint (Clote 2018) for all homopolymer RNA networks, albeit with respect to a slight relaxation of our definitions. Before proceeding we recall basic definitions and notation. The notion of homopolymer secondary structure was defined at the beginning of Sect. 2.1; throughout this section, we denote the set of all secondary structures for a length n homopolymer by S n . If s ∈ S n and s ∈ S n+1 , then we say that s extends s, and write s ≺ s , if s is obtained by either (1) appending unpaired nucleotide n + 1 to the right of s, so that the dot-bracket notation of s is s•, or (2) adding a base pair (k, n + 1) to s, where k ∈ [1, n − θ ] is external to every base pair of s, i.e. it is not the case that i ≤ k ≤ j for any base pair (i, j) of s. Since the seminal papers of Stein and Waterman (1978), Nussinov and Jacobson (1980), this notion of extension has been used as the basis of recursive and/or dynamic programming algorithms to count/enumerate all secondary structures and to compute minimal free energy structures.
A reasonable approach to establish preferential attachment in the context of RNA secondary structures is to show that if the degree of s is greater than or equal to the degree of t in the network S n , then for most extensions s of s, and t of t, the degree of s is greater than or equal to the degree of t in the network S n+1 . We show that this is indeed the case for homopolymers of modest length, using by brute-force, exhaustive computations in this section, and we rigorously establish this result for a relaxation S * n of the secondary structure model in Appendix A. For fixed homopolymer length n, define the set A n of 4-tuples (s, t, s , t ) by A 4-tuple (s, t, s , t ) ∈ A n succeeds in demonstrating preferential attachment if dg(s ) ≥ dg(t ); otherwise the 4-tuple fails to demonstrate preferential attachment. Let Succ n [resp. Fail n ] denote the set of 4-tuples that succeed [resp. fail] to demonstrate preferential attachment, so that A n = Succ n ∪ Fail n (when n is clear, we drop the subscripts, and we ambiguously also use Succ and Fail to denote the sizes of these sets). Our first quantification of preferential attachment is given by the proportion Succ/(Succ+Fail): P(Succ n ) = |{(s, t, s , t ) ∈ A n : dg(s ) ≥ dg(t )}| |A n | Since secondary structures have possibly quite different degrees and numbers of extensions, a more accurate measure (in our opinion) of preferential attachment is given by p(s , t |s, t) , defined as follows. For distinct, fixed structures s, t ∈ S n , define p(s , t |s, t) = P dg ( p(s , t |s, t) = s,t∈S n ,s =t p(s , t |s, t) |{(s, t) : s, t ∈ S n , s = t, dg(s) ≥ dg(t)}| To clarify these definitions, we consider a small example. If n = 5, then S n consists of the two structures : dg(s ) ≥ dg(t ), s ≺ s , t ≺ t , s, t ∈ S n+1 }| |{(s , t ) : s ≺ s , t ≺ t , s, t ∈ S n+1 }| so p(s , t |s, t) = 1. The (arithmetical) average of 1 and 2/3 is 2+3 3 = 5/6 = 0.8333, which is the value p(s , t |s, t) found in the first row and last column of Table 4. In contrast to this value, averaged over all pairs s, t ∈ S n for which dg(s) ≥ dg(t), the total number of successes [resp. failures] is 5 [resp. 1], where a success [resp. failure] is defined as a 4-tuple (s, t, s , t ) for which s, t ∈ S n , s , t ∈ S n+1 , s ≺ s , t ≺ t , dg(s) ≥ dg(t) and dg(s ) ≥ dg(t ) [resp. dg(s ) < dg(t )]. Thus we find the value 5/6 = 0.8333 in the first row and 7th column; however, it is not generally true that Succ n / (Succ n + Fail n ) agrees with p(s , t |s, t) , since s, t may have different degrees in S n , and each may have a different number of extensions s ≺ s , t ≺ t , and each s , t may each have different degrees in S n+1 .
For homopolymers of length 5 to 18, Table 4 shows the proportion of successes, P(Succ), defined in Eq. (33), as well as the average preferential attachment probabil-ities p(s , t |s, t) , defined in Eq. (35). Values in this table, produced by brute-force, exhaustive computation, were obtained for each homopolymer length n ∈ [5,19], by first generating the collections S n , then computing the degrees dg(s) for s ∈ S n by brute force, then considering all n 2 unordered pairs s, t of distinct structures in S n . So far, the number of instances to consider is large-for instance, when n = 18, there are n 2 = 274, 564, 461 unordered pairs of distinct structures from S n . For each pair of distinct structures s, t from S n that satisfy dg(s) ≥ dg(t), a list L s [resp. L t ] of extensions s ≺ s [resp. t ≺ t ] were computed, where the size of each list is one plus the number of positions in [1, n − θ ] that are external to every base pair of s [resp. t]. Subsequently, the proportion of extension pairs s , t that satisfy dg(s ) ≥ dg(t ) is determined, thus yielding p(s , t |s, t). Finally, the mean and standard deviation of the latter yields p(s , t |s, t) , shown in the last column of the table. For n = 18, more than one trillion (1.36 · 10 9 ) 4-tuples (s, t, s , t ) where considered for which dg(s) ≥ dg(t)-this value is used in the denominator of Eq. (35)! From the values in Table 4, it appears that the RNA homopolymer secondary structure model does demonstrate preferential attachment. This, in our opinion, may provide theoretical justification for the close approximation of the tail of degree distributions by a power-law distribution, even though a rigorous statistical test by bootstrapping Kolmogorov-Smirnov values solidly rejects this hypothesis.