Telling ecological networks apart by their structure: An environment-dependent approach

The network architecture of an ecological community describes the structure of species interactions established in a given place and time. It has been suggested that this architecture presents unique features for each type of ecological interaction: e.g., nested and modular architectures would correspond to mutualistic and antagonistic interactions, respectively. Recently, Michalska-Smith and Allesina (2019) proposed a computational challenge to test whether it is indeed possible to differentiate ecological interactions based on network architecture. Contrary to the expectation, they found that this differentiation is practically impossible, moving the question to why it is not possible to differentiate ecological interactions based on their network architecture alone. Here, we show that this differentiation becomes possible by adding the local environmental information where the networks were sampled. We show that this can be explained by the fact that environmental conditions are a confounder of ecological interactions and network architecture. That is, the lack of association between network architecture and type of ecological interactions changes by conditioning on the local environmental conditions. Additionally, we find that environmental conditions are linked to the stability of ecological networks, but the direction of this effect depends on the type of interaction network. This suggests that the association between ecological interactions and network architectures exists, but cannot be fully understood without attention to the environmental conditions acting upon them.


S1 Information of empirical networks
We have extracted the empirical networks from the public repository web-of-life.es. Because this repository is actively updated, here we list the identities of the networks we used. Note that we only used the networks of which we could find their associated environmental information.

S2 Computation of network metrics
We have used three network metrics in the main text: the largest eigenvalue ⁄ 1 , the second largest eigenvalue ⁄ 2 , and the structural stability of the intra-guild competition. Note that we only need the binary network to compute these metrics.
To compute the eigenvalues associated with the bipartite networks B, we follow the methods detailed in Supplementary Information S3 in Michalska-Smith and Allesina [12]. Here we briefly Specifically, a bipartite network A can be represented in its matrix form, and then compute the eigenvalues from its associated Laplacian matrix L := D ≠ A, where D is the diagonal matrix.
To compute the structural stability of intra-guild competition, we translate the bipartite network into the intra-guild competition matrix. Here the intra-guild competition refers how species in the same guild compete for resources. For example, competition among consumers in antagonistic communities, or competition among pollinators in mutualistic communities. The competition strength is computed, following a niche framework [75], as the relative number of shared resources between two species [55,56]. Then the structural stability is estimated from the intra-guild competition matrix [76,77].

S3 Correlations among environmental variables
WorldClim provides 19 environmental variables [33]. These variables are labelled from bio1 to bio19 (see http://www.worldclim.org/bioclim). In particular, temperature variability is labelled as bio4. Here we compute the correlations among these variables for the empirical ecological networks. Figures A and B show that many environmental variables are strongly correlated. Figure C shows the correlations among the four environmental variables and the latitude. The color of the upper-diagonal element and the numerical value of the lower-diagonal element show the correlation between two environmental variables. The symbol ◊ corresponds to correlations that are not statistically significant at the 5% confidence level.   Figure C suggests that the poor correlation between precipitation variability and the other environmental variables (temperature average, temperature variability, and precipitation average) may be the reason why. Focusing on scalability, Panel (C) shows the scalability of the environment-independent approach, Panel (D) shows the scalability of the environment-dependent approach. Focusing on scalability, Panel (C) shows the scalability of the environment-independent approach, Panel (D) shows the scalability of the environment-dependent approach.

S5 Additional analysis on specificity
Here we are split the networks into a training set (75%) and a test set (25%). We used the Support Vector Machine with a Gaussian kernel. We avoided the data imbalance by keeping the same number of data input from the each community type. To further validate the criterion specificity, we compare four possible cases: (1) randomize the network structure and randomize the temperature variability, (2) randomize the network structure and keep the observed temperature variability, (3) keep the observed network structure and randomize the temperature variability, and (4) keep the observed network structure and keep the observed temperature variability. Figure H shows how the correct classification percentage changes compare to the baseline. We found that, not surprisingly, "Observed network structure + Observed temperature variability" improves the classification the best and 'Randomized network structure + Randomized temperature variability" improves the classification the worst. We also found that "Randomized network structure + observed temperature variability" improves the classification more than "Observed network structure + Randomized temperature variability"

Figure H
We have also tested specificity using the t-Distributed Stochastic Neighbor Embedding (t-SNE) instead of PCA to test the speciality. Qualitative results remain the same.

S6 Scaling in PCA
Here we expand the discussion on the specificity criterion in the environment-dependent approach.
To test for specificity, we first randomized the network metrics (by randomizing the network architecture) and kept the environmental information. Then, we used the PCA to di erentiate interaction networks. Importantly, the variables should be scaled before performing a PCA [36]. We scaled the variables by their own scaling (linear transformation into mean = 0 and variance = 1). Michalska-Smith and Allesina [12] proposed to scale these variables using the same scaling of the original data. This other scaling is motivated by treating the empirical data as the training set, and randomized networks as the test set [12]. Figure J illustrates the two scaling procedures.
However, these two scaling procedures should not give the same results under the environmentdependent approach. To see why, we need to understand the confounder e ects of temperature variability (environmental information) on network class and network metrics (confirmed by the multiple regression). Controlling for this confounder gives us the separability in the environmentdependent approach. Thus, if we randomize the networks and use their own scaling to plot the PCA (the method we used in the manuscript), it is equivalent to making the e ect between network metrics and network class weak, while erasing the link between network metrics and temperature variability. This modification makes temperature variability and network metrics independent, limiting the capacity of network metrics to di erentiate network class (see Figure  JA). But if we use the scaling from the empirical data (the scaling used in Michalska-Smith and Allesina [12]), then we are adding the expectation of network class (i.e., we are conditioning on network class since we have not lost this information). This new scaling (or conditioning) makes temperature variability and network metrics potentially dependent conditional on network class (see Figure JB).   Figure KA reproduced Figure 3B in the main text. Figure KB shows the results when scaled with scheme (i). Figure  KC shows the results when scaled with scheme (ii). As discussed above, the circles in KA are considered as the trained models and the randomized networks in KC as treated as the test dataset. Thus, the circles in Figure KC are exactly the same as the ones in KA. The randomized networks in KC that are inside each circles are classified according. Note that while the randomized networks cannot be separated in the two circles in KC, they are well-separated along the second axis (a.k.a Dim2). The reason, as discussed above, is because the scaling in Scheme (ii) causes the potential dependency between temperature variability and network metrics when conditioned on the network classes.