{'fraction_non_alphanumeric': 0.03490108929287041, 'fraction_numerical': 0.012641626288753689, 'mean_word_length': 4.309477756286267, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Analytical approach to network inference: Investigating degree distribution

When the network is reconstructed, two types of errors can occur: false positive and false negative errors about the presence or absence of links. In this paper, the influence of these two errors on the vertex degree distribution is analytically analysed. Moreover, an analytic formula of the density of the biased vertex degree distribution is found. In the inverse problem, we find a reliable procedure to reconstruct analytically the density of the vertex degree distribution of any network based on the inferred network and estimates for the false positive and false negative errors based on, e.g., simulation studies.


I. INTRODUCTION
Networks are one of the most frequently used modelling paradigms for dynamical systems. Investigations towards synchronization phenomena in networks of coupled oscillators have attracted considerable attention, and so has the analysis of chaotic behaviour and corresponding phenomena in networks of dynamical systems to name just a few [1][2][3][4]. Understanding and characterizing network behaviour has triggered interest in a vast number of disciplines, ranging from optimizing vaccination strategies [5] to understanding the functioning or malfunctioning of the human brain [6][7][8].
While first principle modelling is feasible in some areas, in others, networks need to be inferred, e.g. from observed data, see, e.g., [9][10][11][12]. This comes with certain challenges ranging from selecting the appropriate nodes or even defining them, to the choice of an appropriate technique to infer the interaction between the nodes. These choices have a strong impact on the resulting network. Here, we discuss another related challenge that originates from the fact that network inference in the Inverse Problem typically relies on statistical methods and selection criteria.
A typical network inference procedure, estimates the connectivity between a-priori specified nodes in a network. If the connectivity measure passes a certain threshold, a link between the corresponding nodes is assumed to be present. The choice of this threshold is arbitrary, but it is intuitively clear that there is a strong correlation between number of links and choice of threshold. Selecting the threshold, not only controls how many links are inferred correctly but also establishes the number of incorrectly determined links. There are two types of errors, (i) a link may be erroneously considered present, In this manuscript, we present an analytical framework that on the network level links the reconstructed network structure contaminated by type I and type II errors to the true underlying one. While the framework is rather general, we used the vertex degree distribution to derive the functional relationship between the reconstructed and true underlying network. This enables us to obtain superior estimates for the vertex degree distribution, a key property of a network [13]. It has been shown that including the vertex degrees into stochastic blockmodels improves their performance for statistical inference of group structure [11]. The functional relationship depends on the choice of type I error, type II error and the dimension of the network. We demonstrate the performance of our novel approach in a simulation study.
The manuscript is structured as follows. In Section II a theoretical analysis of our method is presented. Section III shows some cases where the method presented in Section II is applied.

II. MATERIALS AND METHODS
In section II A, a short introduction to networks is presented; we analyse the influence of type I and type II errors on the network structure, i.e. false positive and false negative conclusions about links. In section II B different methods to solve the Inverse Problem are presented. Section II C contains a brief description of the generalization to directed networks.

A. Networks change
A network is defined as a set of vertices (or nodes) with links (or edges) between them. To quantify the structure of networks, different characteristics have been introduced [14]. Here, we consider two key network characteristics: vertex degree distribution and number of edges. The vertex degree describes the number of links of a node; if the vertex v has k edges attached, its vertex degree is d = k. The vertex degree distribution is an important property of the entire network.
Networks can be directed or undirected [13]. In an undirected network, connection of v 1 to v 2 implies the connection of v 2 to v 1 . In a directed network, this symmetry is broken, therefore if a path from v 1 to v 2 exists, a path from v 2 to v 1 does not necessarily exist. In this section, we consider undirected networks. Later [Sec. II C] a generalization to directed networks is presented.
Consider a network G with n nodes and vertex degree distribution defined by the probability function P, i.e., P i = P(d = i) is the probability that the degree d is i, for i = 0, · · · , n − 1. Note that the degree of a vertex is between 0 and n − 1, since each vertex can be connected to at most n − 1 remaining vertices.
We analyse the influence of type I and type II errors on the vertex degree distribution of a given network G. We call G ′ the network detected when type I and type II errors occur and we assume that α is the probability of a type I error and that β is the probability of a type II error. Therefore, α expresses the probability that a link absent in G is present in G ′ and β is the probability that a link present in G is no longer present in G ′ . Hence, the set of edges of G ′ is a combination of true positive links and false positive links of G. The vertex degree distribution of G ′ is characterised by the probability function P ′ .
Consider a vertex and assume it has degree k, therefore there are k links connected to it and n−1−k absent links. We evaluate the probability that this vertex has vertex degree k ′ in G ′ . The vertex degree is given by the sum of true positive links j and false positive links i; additionally, i and j have to satisfy (2b) The condition described by Eq. (2a) guarantees that the number of false negative links is larger or equal than zero, and smaller or equal than the number of the original true positive links, i.e., 0 ≤ k−j ≤ k. Likewise, the number of false positive links must be non-negative and smaller or equal than the number of the original non-present links, Eq. (2b). The probability that a vertex has degree k ′ in G ′ , knowing it has degree k in G is The probability P(d ′ = k ′ |d = k) is a piecewise function for all combinations of i and j satisfying Eqs. (1) and (2). To obtain Eq. (3) we consider, as an example, the first case, i.e., k ′ ≤ k and k ′ ≤ n − 1 − k.
The probability of having j true positive links, over all possible k original true positive links, is which is the binomial distribution B(n − 1 − k, α).
Combining Eqs. (4) and (5), changing variable j according to Eq. (1), and considering all possible combinations of i and j, we obtain the first case of Eq. (3). All the other cases can be derived in the same way following the conditions in Eq. (2).
. . . i.e., The matrix A = A(n, α, β) depends on n, α and β and has determinant therefore it is invertible if and only if α = 1 − β, see Appendix A for a proof. Assuming G is known, Eq. (7) characterises the influenced of type I and type II errors on the vertex degree distribution, and it allows to find the vertex degree distribution of the network G ′ .

B. Inference of networks' vertex degree distribution
Section II A analyses the impact of type I and type II errors on the vertex degree distribution of a given network. Equation (7) allows to obtain P ′ from P. In this section, we are interested in the inverse problem, i.e., inverting Eq. (7), to infer the original vertex degree distribution from an observed one. When {α, β} = {0, 0}, {1, 1}, since the convergence to zero of the determinant of A scales like x n(n−1) 2 for |x| < 1 [Eq. (8)], numerical issues arise for relatively small n when inverting the matrix A to find P through P = A −1 P ′ . The cases α, β = 0 and α, β = 1 are trivial, see Appendix A.
The least squares method is a standard approach to solve problems like Eq. (7). Although the matrix A is not singular, for reasonable parameter values for n, A is typically ill-conditioned, therefore the pseudoinverse of the truncated singular value decomposition of A is used.
The singular value decomposition of a matrix A is the factorization of the matrix into the product of A = U W V T where W is a diagonal matrix and the columns of the matrices U and V are orthonormal [15]. The elements w 1 , · · · , w n on the diagonal of W are called singular values of A and they are ordered such that The singular value decomposition is a tool to compute the pseudoinverse of a matrix. If A has singular value decomposition A = U W V T , its pseudoinverse A + is defined as A + = V W + U T , where W + is obtained from W replacing all the non-zero elements with their reciprocals.
The truncated singular value decomposition is a method for regularization of ill-posed least squares problems [16]. Once the singular value decomposition A = U W V T is found, the matrix W is truncated at, e.g., rank t such that only the first t singular values are considered; this matrix is usually called W t . More precisely, W t is a diagonal matrix with elements w 1 ≥ w 2 ≥ · · · ≥ w t > w t+1 = · · · = w n = 0, with t < r. The truncated diagonal matrix W t is used to find an approximation of the matrix A using its decomposition, i.e., A t = U W t V T . The optimal value for t has been studied in [17,18]. The matrix A t is the closest approximation of A of rank t, [16]. Using W t , we calculate the pseudoinverse of A t , i.e., A + t = V W + t U T , and we solve Eq. (7) resulting in

C. Generalization for directed networks
For directed networks the vertex degree is characterised by the vertex in-degree and the vertex out-degree, [13]. Usually, in a directed network the vertex degree is the sum of the vertex in-degree and the vertex out-degree.
Both the in-degree and the out-degree of a vertex are numbers between 0 and n − 1, if n is the number of vertices of the network. Therefore, the analysis shown in Section II A and II B remains valid if either the vertex in-degree or the vertex out-degree are considered instead of the vertex degree.
An undirected network with n nodes has at most n(n− 1)/2 edges. A network with n nodes has at most n(n − 1) directed edges; a generalization for other characteristics is likely more complicated, and therefore requires a more in-depth analysis.

III. RESULTS AND DISCUSSIONS
To demonstrate the abilities as well as limitations, the analysis presented in Section II is applied to some typical simulated networks. We like to highlight that our approach is derived analytically; simulation studies are predominantly needed to demonstrate its applicability in real-world examples and to check for numerical issues, etc. There might be practical issues, e.g., due to the dimension of the network, and with the aim to show how these challenges can be overcome we present a simulation study to explore the concrete applicability of our method.
We study 5 network topologies that present different characteristics so to have a spectrum of networks as wide as possible to which we apply our analysis. Namely, we consider Erdős-Rényi (also called random), Small-World, Scale-Free networks, a three-dimensional grid, and a network of randomly connected communities, [13]. We vary the probabilities α and β of type I and type II errors in the range 1% − 10% mimicking a typical analysis method that has high sensitivity and high specificity. Nevertheless, both lower and higher values for α and β can be chosen and the results obtained are qualitatively the same as the ones presented below.
Consider a random network G with 100 nodes and a probability of a connection of 0.2. The vertex degree has binomial distribution B(100, 0.2). Adding and removing links with probabilities α = 0.05 and β = 0.03 results in a new network G ′ . The vertex degree distribution of G ′ is calculated empirically by counting the vertices' degrees. Applying the procedure explained above, the vertex degree distribution of the original network is estimated. Figure 1 shows the results using the cut-off for the truncated singular value decomposition method of 0.5, i.e., W t contains only singular values greater than 0.5. The choice of t is motivated by smoothness and regularity of the solution obtained. Figure 1 shows the histogram of the degrees of the vertices of the original network G, the density of the detected network G ′ , the reconstructed vertex degree distribution of the original network P resulting from Eq. (9), and the result when a non-negative constraint is applied to the truncated singular value decomposition to avoid that numerical issues result in negative solutions. More precisely, we use lsqnonlin Matlab function with lower bound condition lb = zeros(n); this function implements the trust region reflective algorithm [19,20]. The density of G ′ is estimated by number of nodes with vertex degree = i number of nodes its empirical distribution, and this is used to infer the original network. Figure 2 shows the result when the original network G is a Small-World network. It is built from the regular network of 100 nodes, vertex degree 4, and probability of rewiring 0.4. The network G ′ is obtained by adding and removing links at random with probabilities α = 0.03 and β = 0.05 respectively. The cut-off for the truncated singular value decomposition method is 0.33. Figure 2 shows the histogram of the degrees of the vertices of the original network G, the density of the detected network G ′ , the reconstructed vertex degree distribution, and the result when a non-negative constraint is applied to the truncated singular value decomposition. Figure 3 shows the result when the original network G is a Scale-Free network. It is built using a preferential attachment model for network growth. At each step a vertex, with a link attached to it, is added. The probability that the new vertex attaches to a given old one is proportional to its vertex degree. This procedure is repeated until the network has 100 nodes. The network G ′ is obtained by adding and removing links at random with probabilities α = 0.1 and β = 0.03 respectively. The cut-off for the truncated singular value decomposition method is 0.4. Figure 3 shows the histogram of the degrees of the vertices of the original network G, the density of the detected network G ′ , the solution of Eq. (9), and the result when a non-negative constraint is applied to the truncated singular value decomposition.
Another example we apply our method to, is when the original network G is a three-dimensional grid 4 × 5 × 5; note that G has 100 nodes. The network G ′ is obtained by adding and removing links at random with probabilities α = 0.1 and β = 0.05 respectively. The cut-off for the truncated singular value decomposition method is 0.38. Figure 4 shows the histogram of the degrees of  Finally, we investigate the case when G is a network of three randomly connected communities. It is built by constructing three Erdős-Rényi networks, with probability of connection 0.3, 0.6, and 0.9, and each with 33 nodes. Then, nodes from different communities are connected with probability 0.1. The network G ′ is obtained by adding and removing links at random with probabilities α = 0.05 and β = 0.03 respectively. The cut-off for the truncated singular value decomposition method is 0.42. Figure 5 shows the histogram of the degrees of the vertices of the original network G, the density of the detected network G ′ , the solution of Eq. (9), and the result when a non-negative constraint is applied to the truncated singular value decomposition.
Another interesting aspect is the influence of type I and type II errors and the proposed method on the reconstruction of individual nodes and not just the correct distribution. This is particularly relevant for nodes that have a degree much higher than average, so-called hubs.
In the Scale-Free example, Fig. 3, the detected distribution appears to be smoother than the original, implying that a hub might have been converted to a nonhub. Analysing this in more detail, there is convincing evidence that this is not the case -hubs are correctly identified as hubs.
Consider a node d that has degree k in G that has n nodes. Due to type I and type II errors, this node in G ′ has degree d ′ , a random variable with distribution shown in Eq. (3). Taking realisations of this random variable, and inverting the process using Eq. (9), allows us to compare individual degrees for a given node of the true network with the reconstructed one. We consider a network with n = 100 nodes, a node d with degree k = 75, probabilities of type I and type II errors of α = 0.05 and β = 0.03, respectively, and we simulate 100 realisations of the random variable described above. Figure 6 shows the reconstruction of the degree of d using these realisations. The result does not only show an improvement from the detected degrees k, but also illustrates the high accuracy of the reconstruction method. Figure 7 shows the reconstruction of various degrees, i.e., k from 10 to 90 in steps of 10, using the same parameters n = 100, α = 0.05, β = 0.03, and 100 realisations each. This again demonstrates that our method reliable reconstructs the correct degree for this individual node. Further simulations, not presented here, varying α and β between 0.01 and 0.1, show qualitatively the same results. In every case, the reconstruction is very robust, and this suggests that it is extremely unlikely that a hub is reconstructed as a non-hub. Moreover, the reconstruction works correctly not only on the general distribution, but also when it is applied to single nodes.

A. Robustness of reconstruction
As stated above, our reconstruction method assumes the probabilities of type I and type II errors to be known a priori. While the type I error is controlled by statistical methods, the type II error must be inferred or reasonable assumptions from simulations, or prior studies, about the type II error must be available. To show the impact of vi- olations of this and thereby the robustness of our method, we analyse the performance of the reconstruction when perturbations on α and β are introduced. show the robustness with respect to α. The perturbations are quantified in percentage using the parameter δ, e.g. the perturbations of β are expressed by β + δβ. Note that, since 0 ≤ β ≤ 1, the conditions for the perturbations are −1 ≤ δ ≤ 1/β −1; namely, if we call β p = β +δβ the perturbed β, then we have Negative values for δ represent underestimated values for β and positive overestimated values for β. The same argument is used for the perturbation of α. Figure 8 shows the reconstruction of a Scale-Free network with 100 nodes for the true value of β = 0.03, and also for various values of β deviating up to 1000% from the true value, i.e., β p = 0.33. The cut-off for the truncated singular value decomposition method is 0.1 and the probability of type I error is α = 0.05, assuming to control the family-wise error rate at this value, i.e., the probability of making at least one type I error ; it is beyond the scope of this manuscript to discuss cases in which the technique selected to reconstruct the network violates this assumption -we will however estimate the results for different deviations from the true α used to generate the plots to investigate its robustness. Figure 8 shows that our approach is robust to rather large perturbations of β, in both negative and positive directions. Up to δ = 500%, the bias of the reconstruction is negligible; only if δ = 1000% or more deviates the reconstruction significantly from the true one, although it still performs better than the naïve approach of trusting the identified network structure. Figure 9 shows the reconstruction of a random network with 100 nodes and probability of a connection of 0.2 for the true value of β = 0.03, and also for various values of β deviating up to δ = 400% from the true value of β. The cut-off for the truncated singular value decomposition method is 0.55 and the probability of type I error is α = 0.05. Also in this case, the method is robust to large perturbations of β, in both negative and positive directions. A deviation of more than 400% is needed for the method to fail and not to have an improvement over the naïve approach. Figure 10 shows the reconstruction of a random network with 100 nodes and probability of a connection of 0.2 for the true value of α = 0.05, and α deviating up to −85%. The cut-off for the truncated singular value decomposition method is 0.6 and the probability of type II error is β = 0.03. Figure 10 shows that the method is affected by relatively large perturbations of α. Namely, for δ < −85% and δ > 50%, the reconstructions deviate significantly from the true one. The reason is that sparse networks are susceptible to perturbation of type I error. Figure 11 shows the reconstruction of a denser network, i.e., a random network with probability of a connection of 0.8, for the same true values of α and β. In this case, a deviation of 150% or more is needed for the method to fail. Comparing Figs. 10 and 11, we can conclude that dense networks are more robust to perturbations of type I error than sparse networks. This is intuitively motivated by the fact that the type I error affects links that are not present in the network, and therefore it has a bigger influence on a sparse network.
The above results demonstrated that a rough estimate for α and β is sufficient to get an accurate reconstruction; the method is robust to relatively large perturbations of these two errors. Rough estimates of these parameters are typically available from simulation studies or prior knowledge about the system. Note again that the role of α and β are different; α is often controlled and can be obtained from known statistics of the techniques under the null hypothesis; β is more difficult as the true alternative would need to be known. Given the above simulations, our algorithm is more robust with respect to β than α, which aligns with the different role of these two errors. As mentioned at the beginning of Section III, we vary α and β in the range 1% − 10% mimicking a typical analysis method that has high sensitivity and high specificity. Choosing either lower or higher values for the true α and β does not affect the general qualitatively result of the analysis, but it changes the range of perturbation that leads to the failure of the reconstruction method.

IV. CONCLUSIONS
We explore the impact of false positive and false negative conclusions about the presence or absence of links on the vertex degree distribution of a network. Using an analytical approach, we investigate this dependence on the dimension of the network and the probabilities of type I and type II errors. Equation (7) describes the density of work, assuming the probabilities of type I and type II errors are known.
In the inverse problem, the aim is to reconstruct the original network. Equation (9) enables us to calculate analytically the vertex degree distribution of the original network if the biased one and the probabilities of type I and type II errors are given. When the dimension of the network is relatively large, numerical issues arise and consequently the truncated singular value decomposition is used to calculate the original network vertex degree distribution. Numerical simulations show that the vertex degree distribution is correctly recovered in all the cases discussed; the cases presented are designed to cover a variety of network topologies and therefore degree distributions.
The outcomes of this manuscript are general results that enable to reconstruct analytically the vertex degree distribution of any network. The analytic formula [Eq. (9)] that allows to find the original vertex degree distribution depends only on the detected vertex degree distribution and on the probabilities of type I and type II errors. This method is a powerful tool since the vertex degree distribution is a key characteristic of networks. Moreover, we have actually shown that this method can be used to reconstruct individual node degrees to a very high accuracy. This should positively impact on various measures that can be derived from the networks. Our proposed method should outperform standard approaches in terms of betweenness centrality, identification of hubs, and other network characteristics. This should be rigorously assessed in future research.
A limitation of this work is the assumption that the probabilities of type I and type II errors are known a priori. Nevertheless, we show that the method is robust to relatively large perturbations of these two errors. Therefore, wrong estimates of type I and type II errors, within certain bounds, do not cause the reconstruction of be rendered invalid. We like to emphasise again that in application the type I error is typically controlled, while an estimate for the type II error can only be obtained through prior experiments/knowledge or simulation studies. As shown in various simulations, our reconstruction method is robust to considerable deviations in β, which supports the usefulness of our technique over and above providing deeper insights into the role of these errors in network reconstruction; our approach is promising for real-world applications. Note though that it is always advisable to utilise simulation studies to characterise the advantageous and limitations in a concrete application at hand. Further analyses should study possible statistical approaches to infer these parameters employing Bayesian approaches or simulation studies. We recommend performing the latter to get an estimate of the type II error in particular.
Future studies should investigate the influence of type I and type II errors on other network characteristics, e.g. the number of edges, the global clustering coefficient, and the efficiency. As a consequence, more information about the original network can be found and, therefore, combining them all a better reconstruction of the network can be achieved.
Future calculations result easier if the transpose A T of matrix A is considered. Considering A T instead of A does not affect the calculation of the determinant since it is in general true that det A T = det A.
Theorem. The n×n matrix A, defined by Eq. (A2), has determinant Proof. For α, β = 0, 1 or β = 1 − α, Proposition 1 proves the theorem. Assume 0 < α, β < 1 and β = 1 − α. Since a matrix and its transposed have the same determinant, we proceed considering the matrix A Tn proving a proof by induction. The base of induction is n = 2; in this case the matrix is and it has determinant det A T2 = 1 − α − β. The inductive step consists in assuming that det A Tn−1 = (1 − α − β) (n−1)(n−2) 2 , i.e., the inductive hypothesis for dimension n − 1, and proving the statement for dimension n.
Since 0 < α, β < 1 and β = 1 − α, we can apply Proposition 2. The transformations defined by Eq. (A7) guarantees that the matrix A Tn has the same determinant as A Tn , and according to Eq. (A8), we can express