1 Introduction

Understanding patterns in the composition of ecological communities is one of the fundamental goals in ecology (May 1972; Berlow 1999; McCann 2000; Hubbell 2001; Wilson et al. 2003; Fisher and Mehta 2014). A popular modelling framework for this problem considers in detail a single community in a local habitat embedded within a wider ecosystem portrayed as a species pool from which the local community can be invaded (MacArthur and Wilson 2001). For mathematical analysis, this is then supplemented with several further elements (Wilson et al. 2003; Garcia Lorenzana et al. 2024). The first is a dynamical model of the species abundances, and here a generalised Lotka–Volterra approach is typical but other possibilities exist (Lafferty and Dunne 2010; Campbell et al. 2011). The second is a model of interspecific interactions, and in this regard a random-matrix model is often used, having a long history of shedding light on ecological questions (May 1972, 2001) as well as acting as a baseline scenario against which more detailed and ecologically-motivated studies can be compared (Allesina and Tang 2012).

Despite the complexity of the resultant community-assembly model, analytical progress has been made (Wilson et al. 2003; Gibbs et al. 2018; Serván et al. 2018; Pettersson et al. 2020; Ros et al. 2023). In particular, the cavity method (CM), a method originating in the physics of disordered systems (Mézard et al. 1987) but since adapted to a number of ecological problems (Rieger 1989; Opper and Diederich 1992; Tokita 2006; Yoshino et al. 2007; Obuchi et al. 2016; Tikhonov and Monasson 2017; Advani et al. 2018; Emary and Evans 2021), has brought significant insight into this model (Bunin 2017; Barbier and Arnoldi 2017; Galla 2018). Bunin (2017) has given a comprehensive analysis of the phase diagram of this model and show that the CM solution yields a unique-fixed-point (UFP) phase, in which there exists a unique persistent community that is resistant to invasion. The CM solution also gives the boundaries to multiple-attractor (MA), and unbounded phases.

As is typical for the CM, the model of interactions studied in the above works is statistically homogeneous, i.e. the interaction between all species in the model is described by a single random matrix. As such, there is no a priori differentiation between the species, and the result is a single abundance distribution for the entire community. However, we know from the study of ecological networks (Ings et al. 2009; Delmas et al. 2019; Guimarães Jr 2020; Windsor et al. 2023) that interspecific interactions are anything but homogeneous and that ecological networks possess significant structure, such as trophic levels (Johnson et al. 2014), nestedness (Suweis et al. 2013), modularity (Grilli et al. 2016; Olesen et al. 2007) or even time-dependence (Suweis et al. 2023). One of the most common structures encountered in the network representation of ecological communities is that of the bipartite network, which depicts the interactions between two groups or guilds of species. The interactions described in these bipartite networks are typically either mutualistic, such as in plant-pollinator networks (Kaiser-Bunbury et al. 2010; Bane et al. 2018; Sheykhali et al. 2019), or antagonistic such as in host-parasitoid (Cagnolo et al. 2010; Morris et al. 2013; Hadfield et al. 2014; Thierry et al. 2019) or trophic networks (Cagnolo et al. 2010; Thébault and Fontaine 2010; Menke et al. 2012; Gilljam et al. 2015). Bipartite networks are also found as natural components of multi-partite networks, e.g. Pocock et al. (2012), Miller et al. (2021), or multitrophic foodwebs e,g, Williams (2011).

In this paper, we apply the CM to a species pool and hence local community in which the interactions are structured as a bipartite network but are otherwise random. We show the applicability of the CM to this kind of structured scenario and derive analytic results for abundance distributions and persistence probabilities of each of the two guilds. Focusing on trophic bipartite networks, we describe the phase diagram of the consumer-resource community and show that the UFP, MA and unbounded phases of the unstructured, unipartite model still occur, but with phase boundaries that exhibit non-trivial scaling behaviour. Despite the apparent complexity of the model, what emerges from this analysis is a picture than can conceptually, if not in mathematical detail, be understood in terms of a combination of unipartite random-interactions phenomenology (bulk spectrum and transition to MA) and two-species phenomenology (outlier eigenvalues and consumers being alive or dead).

2 Bipartite community-assembly model

Our species pool consists of two guilds of species in a bipartite ecological network, i. e. with interactions only occurring between species in different guilds. Let \(S^{(1)}\) and \(S^{(2)}\) be the number of species of each guild in the species pool, \(S = S^{(1)}+S^{(2)}\) be the total species number, and \(\rho ^{(i)} = S^{(i)}/S\) be the corresponding ratios. We define \(N_\alpha ^{(i)}\) as the abundance of species \(\alpha \) in guild i in the local community, and \(r^{(i)}_\alpha \) and \(K_\alpha ^{(i)}\) as its growth rate and carrying capacity respectively. These letter two quantities we define as positive, with their sign given by coefficient \(t^{(i)}\in \{-1,+1\}\) that depends on whether the species in guild i grow or die out in absence of interaction. We then posit that dynamics of the abundances is described by the generalised Lotka–Volterra (GLV) equations

$$\begin{aligned}{} & {} \frac{dN_\alpha ^{(i)}}{dt} = \frac{r_\alpha ^{(i)}}{K_\alpha ^{(i)}}N_\alpha ^{(i)} \left( t^{(i)}K_\alpha ^{(i)}-N_\alpha ^{(i)} + c^{(i)}\sum _{\beta =1}^{S^{(i+1)}}a_{\alpha ,\beta }^{(i,i+1)}N_\beta ^{(i+1)} \right) , \end{aligned}$$
(1)

for species \(1\le \alpha \le S^{(i)}\) and guild \(i =1,2\) where we adopt a periodic labelling convention that maps \(i=3\) onto guild \(i=1\). In Eq. (1), coefficients \(a^{(i,i+1)}_{\alpha ,\beta }\) represent the strength of interaction experienced by species \(\alpha \) in guild i due to species \(\beta \) in guild \(i+1\). We arrange these interaction elements into the \(S^{(i)} \times S^{(i+1)}\) matrices \(\textbf{A}^{(i,i+1)}\). We take all interactions between guild i and \(i+1\) to be of the same the type (antagonistic, mutualistic or competitive), and correspondingly set the matrix elements as non-negative \(a^{(i,i+1)}_{\alpha ,\beta } \ge 0 \), with the signs of the interaction provided by the interguild interaction signs \(c^{(i)}\in \{ -1,+1\}\).

We then set the scaling of the matrix elements of \(\textbf{A}^{(i,i+1)}\) with pool size such that \(\mu ^{(i)}:= \sqrt{S}\cdot \langle a^{(i,i+1)}_{\alpha ,\beta }\rangle \) and \((\sigma ^{(i)})^2:=S \cdot \text {Var}(a^{(i,i+1)}_{\alpha ,\beta }) \) are fixed as \(S\rightarrow \infty \) with \(\rho ^{(i)}\) constant. We can thus rewrite matrices \(\textbf{A}^{(i,i+1)}\) in terms of the centered, normalised matrix \(\textbf{B}^{(i,i+1)}\) with elements

$$\begin{aligned} \left\langle b^{(i,i+1)}_{\alpha ,\beta }\right\rangle = 0, \qquad \qquad \left\langle \left( b^{(i,i+1)}_{\alpha ,\beta } \right) ^2\right\rangle = 1 . \end{aligned}$$
(2)

We express correlations in the different interaction directions by choosing \(\textbf{B}^{(i,i+1)}\) such that they have the property:

$$ \left\langle b^{(i,i+1)}_{\alpha ,\beta } b^{(i+1,i)}_{\beta ,\alpha }\right\rangle = \gamma . $$

with parameter \(\gamma \in [0,1]\). We restrict ourselves to positive correlations here to avoid any ambiguity in the implied sign assignments of \(a_{\alpha ,\beta }^{(i,i+1)}\), as allowing \(\gamma < 0\) can lead to a potential contradiction. This is because \(b_{\alpha ,\beta }^{(i)}\) have zero mean, therefore \(\left\langle b_{\alpha ,\beta }^{(i,i+1)} b_{\beta ,\alpha }^{(i+1,i)}\right\rangle < 0\) implies that there is no realisation of the ensemble without some of the \(b_i\) themselves being negative. The implications of this for \(\textbf{A}\) can be seen in Eq (3) below, where we see that if \(\mu \) is small but \(\sigma \) large, negative values of \(b^{(i,i+1)}_{\alpha ,\beta }\) could lead to negative values of \(a^{(i,i+1)}_{\alpha ,\beta }\). This is in contradiction with model parameterisation where \(a^{(i,i+1)}_{\alpha ,\beta }>0\) by definition. We note that this restriction to positive \(\gamma \) is stricter than necessary, and that it would be possible to find a negative lower bound for \(\gamma \) which still ensures all terms remain non-negative. However using \(\gamma \ge 0\) is a simple and secure fix for this potential issue. In these terms the interaction blocks become:

$$\begin{aligned} \textbf{A}^{(i,i+1)} = S^{-1/2} \left[ \mu ^{(i)} \textbf{J}^{(i,i+1)} + \sigma ^{(i)} \textbf{B}^{(i,i+1)} \right] , \end{aligned}$$
(3)

where \(\textbf{J}^{(i,i+1)}\) is the \(S^{(i)} \times S^{(i+1)}\) matrix of ones. The second term in the brackets above describes random fluctuations and the scaling of this term is chosen as in Bunin (2017) for the unipartite case [and indeed as in May (1972)]. There is a choice to be made in the scaling of the first term inside the brackets of Eq. (3) with respect to S. This is discussed in more depth in Sect. 5.1 of the discussion. Without loss of generality, we set the mean carrying capacity to be one, \(\langle K^{(i)}\rangle = 1\), and then further parameterise the carrying-capacities such that \( \left( \kappa ^{(i)} \right) ^2 = S^{(i)} \cdot \textrm{Var} \left( K^{(i)} \right) \) is also fixed as \(S\rightarrow \infty \). This choice is justified a posteriori as being consistent with the interaction scaling.

We note that these GLV equations include \(N_{\alpha }^{(i)}\), a self-regulation term, which alongside a May-like scaling such as this, is comparable in magnitude to the total sum of the interaction strengths between all other species. In papers such as Advani et al. (2018), Cui et al. (2020), the authors are required to consider the effects of the competitive exclusion principle and ecological niches, as discussed in Gupta et al. (2021), but due to this self-regulation property we do not.

In the following, the main quantity of interest will be the fraction of pool species in guild i that persist in equilibrium

$$\begin{aligned} \phi ^{(i)} = \lim _{t\rightarrow \infty }\frac{1}{S^{(i)}} \sum _{\alpha =1}^{S^{(i)}} \Theta \left( N_\alpha ^{(i)} \right) , \end{aligned}$$
(4)

in which \(\Theta \) is the Heaviside function.

3 Cavity method

For an overview of the CM in the ecological unipartite context, we refer the reader to the tutorial article of Barbier and Arnoldi (2017), as well as to the work of Bunin (2017).

A full account of our derivation of the bipartite case is given in Appendix A, but the essence of the method is that an equilibrium configuration is considered to which a new species from each guild is added. The action of the pre-existing community on the added species is treated exactly, but the reciprocal action of the added species on the community is small in the large-S limit and treated in linear response. Since the added species are identical with other species from the same guild, this leads to a closed system of equations that can be solved self-consistently. A discussion of our solution technique for the equations is given in Appendix B and a discussion of the validity given in Appendix C. The central result in this analysis is that the abundances of species within a guild are each distributed according to truncated Gaussians (Wilson et al. 2003; Bunin 2017; Serván et al. 2018; Galla 2018; Pettersson et al. 2020) with interdependent parameters. The key properties of the distributions are described by two quantities \(\Delta ^{(i)}; i=1,2\). In particular, the fraction of species in guild i that persist in equilibrium is given by

$$\begin{aligned} \phi ^{(i)} = w_0(\Delta ^{(i)}) , \end{aligned}$$
(5)

in which \(w_k\) are a set of functions defined via

$$\begin{aligned} w_k(\Delta ^{(i)}) := \int _{-\Delta ^{(i)}}^\infty (\Delta ^{(i)}+z)^k\frac{1}{\sqrt{2\pi }}e^{-z^2/2}dz . \end{aligned}$$
(6)

In Appendix A we give details of the equations that determine \(\Delta ^{(i)}\) in the most general case. Here we just reproduce them in the simplest \(\delta = \gamma = \kappa ^{(1)} = \kappa ^{(2)} = 0\) case:

$$\begin{aligned} \rho ^{(1)} \rho ^{(2)} \left( \sigma ^{(1)} \sigma ^{(2)} \right) ^2 w_2(\Delta ^{(1)})w_2(\Delta ^{(2)}) = 1 , \end{aligned}$$
(7)

and

$$\begin{aligned} t^{(2)}\sigma ^{(1)}\Delta ^{(1)} \sqrt{\rho ^{(2)} w_2 (\Delta ^{(2)})} - c^{(1)} t^{(2)}\sqrt{S}\rho ^{(2)}\mu ^{(1)} w_1(\Delta ^{(2)}) ~~~~~~~~~~~~~~~~ \nonumber \\~~~~~~~ = t^{(1)} \Delta ^{(2)} - t^{(1)} c^{(2)} \sigma ^{(1)} \mu ^{(2)}\rho ^{(1)} w_1(\Delta ^{(1)}) \sqrt{S\rho ^{(2)} w_2 (\Delta ^{(2)})} . \end{aligned}$$
(8)

3.1 Phase diagram

Our main focus will be on antagonistic interactions and for concreteness we will use the language of trophic interactions. In this setting, we identify guild 1 with the resource species and guild 2 with consumers. The corresponding choices of sign are \( t^{(1)} = - t^{(2)} = +1 \), such that in the absence of interactions, the resource-species abundances grow to carrying capacity and the consumers die out; and \( c^{(1)} = - c^{(2)} = - 1 \) such that the interaction is beneficial to the consumers and detrimental to the resources.

As in the unipartite case, the bipartite model is found to exhibit three phases: the UFP described by the cavity solution outlined above, plus the unbounded and MA phases. In the unbounded phase, one or more of the species abundances diverge, such that one or both of \( \lim _{t\rightarrow \infty }\left\langle N^{(i)} \right\rangle \rightarrow \infty \). For the abundances in the cavity solution to remain bounded, we require that both sides of Eq. (8) (in the \(\kappa ^{(i)}=\gamma =0\) case) are greater than zero. As shown in Appendix D, the implication of this is that the location of phase boundary is asymptotically given by

$$\begin{aligned} \frac{1}{2} \rho ^{(1)} \rho ^{(2)} \left( \sigma ^{(1)} \sigma ^{(2)} \right) ^2 w_2\left( - \frac{\sqrt{S_2} \mu ^{(1)}}{\sqrt{\pi }\sigma ^{(1)}} \right) = 1 , \end{aligned}$$
(9)

which holds for \(\gamma = 0\) but arbitrary \(\kappa ^{(i)}\). As example, let us assume that the interaction strengths are distributed according to a half-normal distribution for which mean and standard deviation are related as \(\mu ^{(i)} = \sigma ^{(i)} \sqrt{2/(\pi - 2)}\). Then, assuming that the couplings are symmetric, \(\sigma ^{(1)} = \sigma ^{(2)} = \sigma \), we find that the unbounded phase occurs when \(\sigma > \sigma _c\) with critical interaction strength

$$\begin{aligned} \sigma _c = \left\{ \frac{2}{ \rho ^{(1)} \rho ^{(2)} w_2\left[ - \sqrt{2S\rho ^{(2)}/(\pi (\pi -2))}\right] } \right\} ^{1/4} . \end{aligned}$$
(10)

The key observation is that because \( w_2(-|\Delta |) \sim \sqrt{\frac{2}{\pi }} e^{-\frac{1}{2}\Delta ^2} /|\Delta |^3 \) for large \(|\Delta |\), the critical interaction strength \(\sigma _c\) diverges exponentially with pool size S and becomes inaccessible. At finite S, the transition occurs at finite interaction strength.

Stability analysis of the cavity solution shows that, as in the unipartite case, it becomes unstable and gives way to an MA phase. Appendix E shows that the boundary to the MA phase obeys the equation (valid for \(\gamma = 0\), arbitrary \(\kappa ^{(i)}\))

$$\begin{aligned} \rho ^{(1)} \rho ^{(2)} \left( \sigma ^{(1)} \sigma ^{(2)} \right) ^2 w_0(\Delta ^{(1)})w_0(\Delta ^{(2)}) = 1. \end{aligned}$$
(11)

To find the parameters of this boundary in the \(\kappa ^{(i)} =0\) case, we look for overlap of this curve with that described by Eq. (7). Since both curves as symmetric with respect to interchange of \(\Delta ^{(i)}\), the boundary behaviour where the two curves just cease to overlap occurs when \(\Delta ^{(1)} = \Delta ^{(2)} = \Delta \). From this, we determine that the critical parameters occur when \( w_0(\Delta ) = w_2(\Delta )\). This happens at \(\Delta = 0\), at which point \(w_0(\Delta ) = \frac{1}{2}\). The result is that the critical parameters for the MA transition obey

$$\begin{aligned} \rho ^{(1)} \rho ^{(2)} \left( \sigma ^{(1)} \sigma ^{(2)} \right) ^2 = 4. \end{aligned}$$
(12)

For \(\sigma ^{(1)}=\sigma ^{(2)}\), the MA phase therefore occurs when \( \sigma > \sigma _\textrm{MA} = \left[ 4/(\rho ^{(1)}\rho ^{(2)})\right] ^{1/4} \).

4 Results

Fig. 1
figure 1

The fraction of persistent resources (\(\phi ^{(1)}\), dark blue) and consumers (\(\phi ^{(2)}\), light blue) as a function of interaction strength \(\sigma \) with parameters \(\kappa ^{(i)} = \gamma = 0\), and with interactions symmetric, \(\sigma ^{(i)} = \sigma \), and drawn from a half-normal distribution. Good agreement is seen between analytic results (lines) and numerical simulations (markers) and this increases as the size of the species pool S. The red dashed line indicates the transition from a unique fixed point (UFP) to multiple-attractor (MA) phase. For small interaction strengths, the consumer fraction drops to almost zero. The orange line shows the asymptotic \(S \rightarrow \infty \) limit, in which both \(\phi ^{(i)}\) are identical for these parameters. INSET: Relative fluctuations in equilibrium abundances of the numerical solution taken over realisations of the interaction matrix and carrying capacities. Marked increases occur around the critical interaction strength of the MA transition: \(\sigma = 2\) for \(\gamma =\kappa = 0; \sigma = 2.39\) for (\(\gamma =0, \kappa = 1\)). For (\(\gamma =1, \kappa = 0\)), the transition is outside this \(\sigma \)-range, and no increase in fluctuations is seen (colour figure online)

In visualising the results of this calculations we reduce the number of independent parameters by choosing \(\sigma ^{(1)} = \sigma ^{(2)} =\sigma \), and \(\kappa ^{(1)} =\kappa ^{(2)} = \kappa \). Furthermore, although \(\mu ^{(i)}\) and \(\sigma ^{(i)}\) are in general independent parameters, here we consider them to be derived from a half-normal distribution for which they are related as \(\mu ^{(i)} = \sigma ^{(i)} \sqrt{2/(\pi - 2)}\).

In Fig. 1 we plot the persistent fraction \(\phi ^{(i)}\) as a function of interaction strength \(\sigma \) in the simplest case of \(\kappa = \gamma =0\). We show analytic results from the CM described previously as well as results obtained from numerical simulations of the GLV equations (described in Appendix G). Overall agreement is good, and is seen to improve for larger values of the pool size S. As in the unipartite case, the CM solution still gives a good account of the simulation results in the MA phase (to the right of the red dotted line in Fig. 1), despite the loss of stability of the cavity solution in this region. Figure 1b, c show how the behaviour changes when we no longer have \(S^{(1)} = S^{(2)}\).

Fig. 2
figure 2

As Fig. 1 but with different \(\kappa ^{(i)} = \kappa \) and \(\gamma \) assignments. The dark blue lines are for \(\phi ^{(1)}\) and light blue are for \(\phi ^{(2)}\), with line and marker type indicated different values of \(\kappa \) and \(\gamma \) parameters. a shows when the ratio of species in each guild is equal, whereas b and c show when we have parameter \(\rho ^{(1)} \ne 0.5\). We once again see good agreement between analytics and simulations for all plots. Other parameters were: \(S=200\) and \(\rho \) varied as stated (colour figure online)

Figure 2 shows that this agreement between simulations and analytics also extends to non-zero values of \(\kappa \) and \(\gamma \), and thus that the CM is able to address correlations in the interaction matrix and a distribution of carrying capacities in this structured context. Figure 2b, c also show good correlation between the CM and numeric solutions when varying the ratio of species, \(\rho ^{(1)}\).

What we see from Figs. 1b, c, 2b, c is that the guild species-asymmetry, \(\rho ^{(1)}\), is primarily only responsible for stretching the graphs in the y-axis. Overall the shape and behaviour of each plot is broadly unchanged by varying the proportion of guilds. This change of parameter has a more profound affect at values to the right hand side of the \(\sigma \ge 2\) line, especially in Fig. 1, when S is smaller (the “x” markers for example). Here we see that the fluctuations in the numeric results, when compared to the analytic results, are much more pronounced than they were for \(\rho = 0.5\). This is likely due to one guild now having potentially as few as 15 species, so any changes in the system can lead to much larger knock on affect with less chance to restabilise.

The inset of Fig. 1 gives numerical evidence of the location of the MA transition. Here we plot the standard deviation of the abundance values \(N_\alpha ^{(i)}\) sampled over initial conditions, and averaged over instances of interaction matrix and carrying capacities and over all species in both guilds. For presentation, this measure of the fluctuations in population size at the final equilibrium state is normalised against the mean abundance over all runs. We see that, for an interaction strength lower than the critical value predicted by the CM, the fluctuations are extremely small, but that around the critical interaction strength they start to rise. Clearly this is indicative of the unique fixed point below the transition giving way to the MA phase above it, as the multiple attractors will have different abundance distributions and hence finite fluctuations from instance to instance.

From Figs. 1 and 2, for \(\sigma ^{(i)}=0\), we see that, even though the parameters are chosen symmetrically, there are significant differences between the two persistence fractions. In particular, at smaller interaction strengths, \(\phi ^{(1)}\) (resources) is larger than \(\phi ^{(2)}\) (consumers) and at larger interaction, this trend is reversed. This is perhaps not surprising, given the different roles of the two guilds. However, in the asymptotic limit (\(S \rightarrow \infty \); see Appendix F) for \(\kappa =\gamma =0\) and symmetric parameters we find that \(\Delta ^{(1)} = \Delta ^{(2)} = \Delta \) with \(\Delta \) determined by \( w_2(\Delta ) = 2/\sigma ^2 \) for any \(\sigma \ne 0\). In this case, then, the abundance distribution of the two guilds becomes identical and the two \(\phi ^{(i)}\) curves overlap (a result shown as an orange line in Fig. 1). We observe also that this curve resembles that of the unipartite case (Bunin 2017).

Apparent from these plots is that for a range of interaction strength from zero upwards, the persistence fraction of the consumers is suppressed to an almost zero value, such that at these values of interaction strength consumers will be effectively absent from the community. Again this highlights the similarities of our system to the antagonistic 2-species Lotka–Volterra phase plots. If the interactions between consumer and producer are too weak, the consumer species will die out (Murray 2013). Analytic insight into this region can be obtained as follows. We assume that \(\Delta ^{(1)} \gg 1\) (consistent with \(\phi ^{(1)} \approx 1\)) and correspondingly approximate \(w_k(\Delta ^{(1)}) \approx \left( \Delta ^{(1)} \right) ^k\). This together with Eq. (7) allows the elimination of \(\Delta ^{(1)}\) from Eq. (8). Since \(\Delta ^{(2)} \ll -1\) (consistent with \(\phi ^{(2)} \approx 0\)) we then can approximate \(w_k(\Delta ^{(2)})\approx 0\) in Eq. (8), which yields an equation for \(\Delta ^{(2)}\) in the suppressed region. Generalising this to the \(\kappa ^{(i)}\ne 0\) case, the result we obtain is

$$\begin{aligned} \Delta _2 \approx \frac{ \sqrt{S} \rho ^{(1)}\mu ^{(2)} -1 }{ \sqrt{ \rho ^{(1)} \left( \sigma ^{(2)} \right) ^2 + \left( \kappa ^{(2)} \right) ^2 (S^{(1)})^{-1}} }. \end{aligned}$$
(13)

To be compatible with \(\phi ^{(2)} \ll 1\) this needs to large and negative, which requires \( \sqrt{S} \rho ^{(1)}\mu ^{(2)} \ll 1\). This suggests that

$$\begin{aligned} \mu ^{(2)} = \frac{1}{\rho ^{(1)}\sqrt{S} } \end{aligned}$$
(14)

(at which point \(\Delta _2 \approx 0 \) and hence \(\phi ^{(2)} = w_0(0) = \frac{1}{2}\)) gives an indicator of when the consumer population rises to a significant value. Below this point, the suppression of the consumers is exponential because for \(\Delta _2\) is large and negative, we can approximate \( \phi ^{(2)} = w_0 \left( -|\Delta ^{(2)}| \right) \sim e^{- (\Delta ^{(2)})^2/2}/(|\Delta ^{(2)}|\sqrt{2\pi }) \). From Eq. (14), we see that the width of region without consumers reduces as the size of the species pool S increases.

Figure 3 show different aspects of the phase diagram of the antagonistic bipartite model. We plot results for a pool size of \(S=50\), such that the consumer-suppression regions are easily visible on the same scale as the MA transition. Note that we do not show that unbounded transitions as, according to the arguments presented in the previous section, these occur as large values of interaction strength.

Figure 3a shows the persistent fractions \(\phi ^{(i)}\) as a function of interaction strength \(\sigma \) and carrying capacity width \(\kappa \). Increasing \(\kappa \) results in the persistent fractions dropping more quickly as \(\sigma \) increases, and also a noticeable drop in the peak number of consumers. This is a result of the wider distribution of \(K_\alpha ^{(i)}\) values giving resource species a carrying capacity closer to zero and therefore more likely to becomes locally extinct and consumers (unsigned) carrying capacities further from zero, and therefore more likely to die out rapidly. The red dashed line shows the point of the MA transition, which is seen to move to higher interaction strength with increasing \(\kappa \). Finally, the green dashed line shows the boundary Eq. (14) of the suppressed-consumer region. This is a constant as a function of \(\kappa \) here, but as \(\kappa \) increases, the transition out of the suppression region becomes less sharp.

Fig. 3
figure 3

Phase diagrams for the antagonistic bipartite networks. The colour scale represents the persistent fraction of resource species (\(\phi ^{(1)}\), left) and consumers (\(\phi _2\), right). a \(\phi ^{(i)}\) as a function of \(\sigma \) and \(\kappa \) with fixed \(\gamma =0\) and \(\rho ^{(1)}=1/2\); b \(\phi ^{(i)}\) as a function of \(\rho ^{(1)}\) and \(\sigma \) with \(\kappa = \gamma = 0\); c \(\phi ^{(i)}\) as a function of \(\gamma \) and \(\sigma \) with \(\kappa = 0\) and \(\rho ^{(1)}=1/2\). The red dashed lines show the transition from unique fixed point (UFP) to multiple-attractors (MA) phase. The green dashed lines show the boundary of the consumer suppression region, Eq. (14). Parameters were \(S=50\), \(\sigma ^{(1)}=\sigma ^{(2)}=\sigma , \mu ^{(1)} = \mu ^{(2)} = \sigma \sqrt{2/(\pi -2)}\) and \(\kappa ^{(1)}=\kappa ^{(2)}=\kappa \), for all plots (colour figure online)

Figure 3b shows how the persistent fractions change as a function of \(\sigma \) and \(\rho ^{(1)}\), the fraction of resource species in the species pool. In this case we see how the consumer-suppression region depends on the composition of the species pool with the suppression becomes more extensive for smaller \(\rho ^{(1)}\), i.e. fewer resource species in the pool. The opposite effect is also observed—for large values of the resource fraction \(\rho ^{(1)}\), the consumer shows an extensive range of interaction strength for which \(\phi ^{(2)} \approx 1 \) and thus all consumers in the pool are supported in the local community. The MA transition line is symmetric about \(\rho ^{(1)} = 1/2\), given the dependence on \(\rho ^{(1)}\rho ^{(2)} = \rho ^{(1)}(1-\rho ^{(1)})\).

Finally, Fig. 3c looks at the role of the correlation parameter \(\gamma \) in determining community persistence. Increasing correlations (\(\gamma >0\)) universally serves to increase both persistent fractions, with extensive regions where \(\phi ^{(i)} > 0.5\) for both consumers and resources. Transition to the MA phase is moved to higher \(\sigma \) for increasing \(\gamma \) and being in the MA phase is correlated with a drop in both persistent fraction values.

5 Discussion

We have shown here that the CM generalises to structured ecological models, and specifically to a bipartite structure with consumer-resource Lotka–Volterra dynamics. We have seen that this model exhibits phases analogous to those of the unipartite model, and that the CM allows us to map the boundaries between them. The key feature of the bipartite model is the existence of two guilds, and we have seen that the composition of the persistent community in terms of these two guilds depends both on the strength of the interaction between them, the guild size in the species pool, as well as parameters such as \(\gamma \) and \(\kappa ^{(i)}\). Interestingly, in the \(S \rightarrow \infty \) limit the ratio of the mean equilibrium abundances becomes

$$\begin{aligned} \mathcal {R} := \frac{\sum _{\alpha =1}^{S^{(2)}} N ^{(2)}_\alpha }{\sum _{\alpha =1}^{S^{(2)}} N ^{(1)}_\alpha } = \frac{ \mu ^{(2)} }{ \mu ^{(1)} } , \end{aligned}$$
(15)

which depends only on the ratio of mean interaction strengths. The ratio of the persistent fractions is not as simple.

One novel feature of our results is that, for weak interactions, the fraction of persistent consumers, \(\phi ^{(2)}\), is suppressed. This is ecologically reasonable, as it means that if trophic interactions are too weak, consumers can not be sustained in the community. This is analogous to what we would expect within a 2 species L-V model, where the consumer species dies out if the interaction with the producer species is too weak. What is perhaps surprising is that the transition to a sustained consumer presence is reasonably abrupt in this parameter space. Furthermore, we have shown that the width of this suppressed region depends on the size of the species-pool, becoming narrower as S increases. For interaction strengths above the consumer onset, properties of the two guilds become similar with both \(\phi ^{(i)}\) falling off with interaction strength.

The most obvious baseline for comparison is the unipartite model, from Bunin (2017), with \(\gamma = -1\), as this has interactions arranged in consumer-resource pairs.Footnote 1 The persistent fraction in that model shows a monotonic decrease with interaction strength, similar to the asymptotic behaviour of the bipartite model in Fig. 1. The unipartite model shows no suppression for small couplings because, although the interactions are all trophic, their orientations are random. In contrast, the bipartite structure enforces a consistent direction to the interactions and this paves the way for guild-level effects.

Whilst we have focused on trophic interactions, different choices of the sign factors \(t^{(i)}\) and \(c^{(i)}\) allow different interguild interactions to be studied. With \(c^{(i)} = +1\) we have a mutualistic bipartite network, either obligate (\(t^{(i)}=-1\)) or facultative (\(t^{(i)}=+1\)). Adapting the reasoning from the trophic case, we find that, irrespective of \(t^{(i)}\), the transition to the unbounded phase in this mutualistic model occurs for large \(\Delta ^{(i)}\), and this allows to obtain the transition point as \( \mu ^{(1)}\mu ^{(2)} = \left( \rho ^{(1)}\rho ^{(2)}S \right) ^{-1} \). Taking the case of symmetric coupling drawn from the half-normal distribution, the critical coupling is given by

$$\begin{aligned} \left( \sigma ^\textrm{MUT}_c \right) ^2 = \frac{\pi (\pi -2)}{2\rho ^{(1)}\rho ^{(2)}S}, \end{aligned}$$
(16)

such that bounded phase is obtained when \(\sigma < \sigma _c \sim S^{-1/2}\). The extent of this bounded phase therefore decreases with pool size and vanishes in the limit. And thus the characteristic behaviour of mutualistic bipartite interactions is towards non-persistence of the community. This might be reconciled with the manifold observation of bipartite mutualistic networks in nature in a number of ways. It might imply that mutualistic interactions are very weak, but this seems unlikely given the important role these interactions typically play in the lifecycles of the participants. It could also indicate limitations in the dynamical model—inclusion of saturating interactions is an obvious improvement that could be made. But perhaps the most interesting possibility is that the model suffers from studying mutualism in isolation, and in nature these mutualistic networks modules exist as modules in larger networks with interactions of various types. Finding the networks conditions which allows mutualisms to persist therefore becomes an important future question.

The sign allocation \(t^{i)} = +1\) and \(c^{(i)} = -1\) gives a model in which the two guilds compete with one another. In this case the transition to unboundedness occurs when

$$\begin{aligned} \frac{\mu ^{(1)}\mu ^{(2)}}{\left( \sigma ^{(1)}\sigma ^{(2)} \right) ^2} =\frac{4}{S}. \end{aligned}$$
(17)

With symmetric couplings and matrix elements from the half-normal distribution again, this translates into a critical coupling

$$\begin{aligned} \left( \sigma ^\textrm{COMP}_c \right) ^2 = \frac{S}{2(\pi -2)}, \end{aligned}$$
(18)

such that the bounded phase occurs for \(\sigma < \sigma _c \sim S^{1/2}\). The two guilds therefore both always persist in the large-pool limit. Although we were unable to find reports of bipartite competition networks in the literature (presumably due to the difficulty of observing such interactions), “negative non-trophic” interactions have been reported as part of larger multi-interaction networks (Kéfi et al. 2015, 2016) and often with a particular association with facilitation (Losapio et al. 2021). In both mutualistic and competitive cases, the symmetry in interaction sign, \(c^{(1)}=c^{(2)}\), ensures that neither guild is significantly suppressed relative to the other.

It is interesting to compare these results for the persistence of communities with different interaction types with the conclusions derived from a linear stability analysis of the relevant interaction matrices

$$\begin{aligned} \textbf{A} = \begin{bmatrix} -\mathbbm {1} &{}\textbf{A}^{(1,2)}\\ \textbf{A}^{(2,1)}&{}-\mathbbm {1} \end{bmatrix} , \end{aligned}$$
(19)

in which \(\mathbbm {1}\) is a unit matrix, and where we set \(\gamma = 0\) for simplicity such that \(\textbf{A}^{(1,2)}\) and \(\textbf{A}^{(2,1)}\) are independent. From e.g. Emary and Malchow (2022) and references therein, we know that the asymptotic spectrum of \(\textbf{A}\) will consist of two parts: a bulk, and a pair of isolated “macroscopic” eigenvalues, with the pair being as would be expected in the 2 species L-V model. In the uncorrelated case, the bulk spectrum will be a circle in the complex plane (Tikhomirov 2011) with centre at (-1,0) and radius of \( \sqrt{\sigma ^{(1)} \sigma ^{(2)}} \left( \rho ^{(1)}\rho ^{(2)} \right) ^{1/4} \). The macroscopic eigenvalues are given by

$$\begin{aligned} \lambda _\mathrm {macro,\pm } = -1 \pm \left\{ c^{(1)} c^{(2)} \mu ^{(1)} \mu ^{(2)} \rho ^{(1)} \rho ^{(2)} S \right\} ^{1/2} , \end{aligned}$$
(20)

with the scaling \(\sim \sqrt{S}\) justifying the “macroscopic” moniker.

In the consumer-resource case, \( c^{(1)} c^{(2)} = -1\), and the macroscopic contribution to the spectrum is purely imaginary. Thus it is the bulk that determines the stability. In contrast, for both competitive and mutualistic interactions, we have \( c^{(1)} c^{(2)} = 1\) and the stability properties of these two interaction types will be the same. In these cases we have \(\lambda _\mathrm {macro,+}\) real and positive and therefore this eigenvalue dominates stability considerations. The trend, then, from local stability analysis is that both competitive and mutualistic bipartite interactions are unstable, whereas antagonistic interactions are stable. This stands in contrast with the CM results which identifies the antagonistic and competitive structures as persisting, whilst the mutualistic one is not.

5.1 Scaling of interaction strengths

We argue that the mean must scale like:

$$\begin{aligned} \mu ^{(i)} = \sqrt{S^{(1+\delta )}}\cdot \left\langle a_{\alpha ,\beta }^{(i,i+1)}\right\rangle . \end{aligned}$$
(21)

There are then two obvious choices for our scaling parameter \(\delta \). The first is \(\delta = 0\), for which we recall from Eq. (3) that the interaction blocks become:

$$\begin{aligned} \textbf{A}^{(i,i+1)} = S^{-1/2} \left[ \mu ^{(i)} \textbf{J}^{(i,i+1)} + \sigma ^{(i)} \textbf{B}^{(i,i+1)} \right] . \end{aligned}$$

This is a natural choice when \(a^{(i,i+1)}_{\alpha ,\beta }\) are chosen from a non-negative distribution such as the half-normal distribution for which the standard deviation is proportional to the mean [a similar scaling was adopted in Emary and Malchow (2022)].

The most obvious alternative to Eq. (3) is to set

$$\begin{aligned} \textbf{A}^{(i,i+1)} = \frac{\mu ^{(i)}}{S} \textbf{J}^{(i,i+1)} + \frac{\sigma ^{(i)}}{\sqrt{S}} \textbf{B}^{(i,i+1)} , \end{aligned}$$
(22)

so that the mean scales like the variance (rather than the standard deviation). This scaling is like that in the unipartite model (Bunin 2017). The difference between these two choices is perhaps best appreciated from the spectrum of \(\textbf{A}\) of Eq. (19). In the alternative scaling, \(\textbf{A}\) has the same bulk spectrum as before but now the S-dependence of macroscopic eigenvalues removed. Thus, eigenvalues \(\lambda _\mathrm {macro,\pm }\) cease to be macroscopic, and the entire spectrum scales as \(S^0\). The CM equations for this alternative scaling can be obtained from those presented here by scaling \(\mu ^{(i)}\rightarrow \mu ^{(i)}S^{-1/2}\) and \(\kappa ^{(i)} \rightarrow \kappa ^{(i)}\sqrt{S^{(i)}}\). This results in a modification of the phase diagram.

Confining ourselves to the trophic case, the transition to the unbounded phase now occurs at coupling strength \(\sim S^0\), rather than \(\sim S^{1/2}\), and the width of the suppressed zone becomes \(\sim S^0\) rather than \(\sim S^{-1/2}\). On the other hand, the MA transition remains in the same place, being determined by \(\sigma ^{(i)}\) and not \(\mu ^{(i)}\). Distributions that scale like Eq. (3) are straightforward to realise—the half-normal-distribution used here is a simple example. Not so for Eq. (22) as this requires a distribution defined on non-negative support \(a>0\) in which the ratio of mean to standard deviation scales like \(S^{-1/2}\), this inevitably results in a heavily skewed distribution.Footnote 2 Other than this seemingly extreme properties required of the distribution, the second problem with this scaling is that it limits the parameter values for which the CM solution is accurate, since the skewness of the distribution compromises the Normality assumption (see Appendix C) unless we have \(\mu ^{(i)}/\sigma ^{(i)} \gg 1\).

Another variation of the model is to drop the restriction that the interaction elements be non-negative. This obviously changes the intent of the model as, from a starting point in which all interactions are e. g. trophic interactions, negative values of \(a_{\alpha ,\beta }^{(i,j)}\) mix in some interactions that are mutualistic, some competitive, and some that remain antagonistic but opposite in direction. Nevertheless, if the majority of the interactions remain of the original type, it still makes sense to differentiate the two guilds along the original lines. Such a model might be appropriate for bipartite plant-microbe networks (Bennett et al. 2018) where interactions are complicated and of different signs (Trivedi et al. 2020; He et al. 2021). Dropping this restriction does not change the derivation of the CM equations, but it does affect the validity argument presented in Appendix C. If we choice the scaled matrix elements \(b_{\alpha ,\beta }^{(i,j)}\) from a normal distribution (which necessarily permits negative values), then we remove any concerns about the Normality of the final fluctuations, and there are no limits on the validity of the CM equations from a skewness point of view. This means that the scaling of Eq. (22) works just as well as the scaling of Eq. (3). However, preservation of guild interaction identity still requires \(\mu ^{(i)}/\sigma ^{(i)} \gg 1\), and so the useful parameter regime of the model stays the same.

Looking to the future, this work opens up the study of community assembly within other block-structured ecological networks. Here we think of two particular geometries: “hub and spokes” in which a central guild interacts with a number of further guild, as in Pocock et al. (2012), and a “ladder” such as a food web with perfect trophic coherence, i.e. where basal species are consumed exclusively by primary consumers, primary consumers are consumed exclusively by secondary consumers, and so forth (Johnson et al. 2014). Tripartite ecological networks (Fontaine et al. 2011; Sauve et al. 2014, 2016; Domínguez-García and Kéfi 2021; Emary and Malchow 2022) span both categories, and could either describe a single interaction type e.g. antagonism in a plant-pest-parasitoid network, or mixed interactions such as in plant-mutualist-parasitoid or herbivore-plant-mutualist networks. Following the approach set out here, the CM should allow us to map the persistence and coexistence conditions across these diverse network structures which, although certainly just caricatures, represent important aspects of the organisation of interactions central to natural ecosystems.