Coexistence of nestedness and modularity in host–pathogen infection networks


The long-term coevolution of hosts and pathogens in their environment forms a complex web of multi-scale interactions. Understanding how environmental heterogeneity affects the structure of host–pathogen networks is a prerequisite for predicting disease dynamics and emergence. Although nestedness is common in ecological networks, and theory suggests that nested ecosystems are less prone to dynamic instability, why nestedness varies in time and space is not fully understood. Many studies have been limited by a focus on single habitats and the absence of a link between spatial variation and structural heterogeneity such as nestedness and modularity. Here we propose a neutral model for the evolution of host–pathogen networks in multiple habitats. In contrast to previous studies, our study proposes that local modularity can coexist with global nestedness, and shows that real ecosystems are found in a continuum between nested-modular and nested networks driven by intraspecific competition. Nestedness depends on neutral mechanisms of community assembly, whereas modularity is contingent on local adaptation and competition. The structural pattern may change spatially and temporally but remains stable over evolutionary timescales. We validate our theoretical predictions with a longitudinal study of plant–virus interactions in a heterogeneous agricultural landscape.

Access options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Fig. 1: Hypergraph representation of environmentally mediated host–pathogen infections.
Fig. 2: Neutral evolution of infection networks.
Fig. 3: Emergence of host ecotypes depends on habitat diversity.
Fig. 4: Theoretical predictions for the coexistence of nestedness and modularity.
Fig. 5: Modularity of plant–virus infections from 2000 to 2002 in an agricultural landscape in central Spain.
Fig. 6: Seasonal variation of bridgeness and modularity in empirical EPNs.

Data availability

The network data are available via Dryad at

Code availability

For the analysis of nestedness and modularity we used the open-source software packages FALCON ( and BiMat ( Network simulation codes will be provided by the authors upon reasonable request.


  1. 1.

    Handel, A., Lebarbenchon, C., Stallknecht, D. & Rohani, P. Trade-offs between and within scales: environmental persistence and within-host fitness of avian influenza viruses. Proc. R. Soc. B 281, 20133051 (2014).

  2. 2.

    Laine, A.-L. Evolution of host resistance: looking for coevolutionary hotspots at small spatial scales. Proc. R. Soc. B 273, 267–273 (2006).

  3. 3.

    Hamer, G. L. et al. Fine-scale variation in vector host use and force of infection drive localized patterns of West Nile virus transmission. PLoS ONE 6, e23767 (2011).

  4. 4.

    Viana, M. et al. Dynamics of a morbillivirus at the domestic-wildlife interface: canine distemper virus in domestic dogs and lions. Proc. Natl Acad. Sci. USA 112, 1464–1469 (2015).

  5. 5.

    Blumenthal, D., Mitchell, C. E., Pysek, P. & Jarosík, V. Synergy between pathogen release and resource availability in plant invasion. Proc. Natl Acad. Sci. USA 106, 7899–7904 (2009).

  6. 6.

    McLeish, M., Sacristán, S., Fraile, A. & García-Arenal, F. Scale dependencies and generalism in host use shape virus prevalence. Proc. R. Soc. B 284, 20172066 (2017).

  7. 7.

    Carlsson-Granér, U. & Thrall, P. H. Host resistance and pathogen infectivity in host populations with varying connectivity. Ecol. Lett. 69, 926–938 (2015).

  8. 8.

    Martinez, M. E. The calendar of epidemics: seasonal cycles of infectious diseases. PLoS Pathog. 14, e1007327 (2018).

  9. 9.

    McLeish, M., Fraile, A. & García-Arenal, F. Ecological complexity in plant virus host range evolution. Adv. Virus Res. 101, 293–339 (2018).

  10. 10.

    Ostfeld, R. S. & Keesing, F. The function of biodiversity in the ecology of vector-borne zoonotic diseases. Can. J. Zool. 78, 2061–2078 (2000).

  11. 11.

    Gurarie, D. & Seto, E. Y. W. Connectivity sustains disease transmission in environments with low potential for endemicity: modelling schistosomiasis with hydrologic and social connectivities. J. R. Soc. Interface 6, 495–508 (2009).

  12. 12.

    Yang, H., Tang, M. & Gross, T. Large epidemic thresholds emerge in heterogeneous networks of heterogeneous nodes. Sci. Rep. 5, 13122 (2015).

  13. 13.

    Webster, J. P., Borlase, A. & Rudge, J. W. Who acquires infection from whom and how? Disentangling multi-host and multi-mode transmission dynamics in the ‘elimination’ era. Phil. Trans. R. Soc. B. 372, 20160091 (2017).

  14. 14.

    Bascompte, J. & Jordano, P. Plant–animal mutualistic networks: the architecture of biodiversity. Annu. Rev. Ecol. Evol. Syst. 38, 567–593 (2007).

  15. 15.

    Lewinsohn, T. M., Prado, P. I., Jordano, P., Bascompte, J. & Olesen, J. M. Structure in plant–animal interaction assemblages. Oikos 113, 174–184 (2006).

  16. 16.

    Ings, T. C. et al. Ecological networks—beyond food webs. J. Animal Ecol. 78, 253–269 (2009).

  17. 17.

    Blüthgen, N., Fründ, J., Vázquez, D. P. & Menzel, F. What do interaction network metrics tell us about specialization and biological traits? Ecology 89, 3387–3399 (2008).

  18. 18.

    Blüthgen, N. Why network analysis is often disconnected from community ecology: a critique and an ecologist’s guide. Basic Appl. Ecol. 11, 185–195 (2010).

  19. 19.

    Dormann, C. F., Fründ, J. & Schaefer, H. M. Identifying causes of patterns in ecological networks: opportunities and limitations. Annu. Rev. Ecol. Evol. Syst. 48, 559–584 (2017).

  20. 20.

    Pawar, S. Why are plant–pollinator networks nested? Science 345, 383 (2014).

  21. 21.

    Krause, A. E., Frank, K. A., Mason, D. M., Ulanowicz, R. E. & Taylor, W. W. Compartments revealed in food-web structure. Nature 426, 282–285 (2003).

  22. 22.

    Fortuna, M. A. et al. Nestedness versus modularity in ecological networks: two sides of the same coin? J. Anim. Ecol. 79, 811–817 (2010).

  23. 23.

    Weitz, J. S. et al. Phage–bacteria infection networks. Trends Microbiol. 21, 82–91 (2013).

  24. 24.

    Guimarães, P. R. et al. Interaction intimacy affects structure and coevolutionary dynamics in mutualistic networks. Curr. Biol. 17, 1797–1803 (2007).

  25. 25.

    Pires, M. M. & Guimarães, P. R. Interaction intimacy organizes networks of antagonistic interactions in different ways. J. R. Soc. Interface 10, 20120649 (2013).

  26. 26.

    Thebault, E. & Fontaine, C. Stability of ecological communities and the architecture of mutualistic and trophic networks. Science 329, 853–856 (2010).

  27. 27.

    Poulin, R. Network analysis shining light on parasite ecology and diversity. Trends Parasitol. 26, 492–498 (2010).

  28. 28.

    Bellay, S. et al. The patterns of organisation and structure of interactions in a fish–parasite network of a neoropical river. Int. J. Parasitol. 45, 549–557 (2015).

  29. 29.

    Vazquez, D. P., Poulin, R., Krasnov, B. R. & Shenbrot, G. I. Species abundance and the distribution of specialization in host–parasite interaction networks. J. Anim. Ecol. 74, 946–955 (2005).

  30. 30.

    Krasnov, B., Mouillot, D., Khokhlova, I., Shenbrot, G. I. & Poulin, R. Compositional and phylogenetic dissimilarity of host communities drives dissimilarity of ectoparasite assemblages: geographical variation and scale-dependence. Parasitology 139, 338–347 (2012).

  31. 31.

    Morris, R. J., Gripenberg, S., Lweis, O. T. & Roslin, T. Antagonistic interaction networks are structured independently of latitude and host guild. Ecol. Lett. 17, 340–349 (2014).

  32. 32.

    Maunsell, S. C., Kitching, R. L., Burwell, C. J. & Morris, R. J. Changes in host–parasitoid food web structure with elevation. J. Animal Ecol. 84, 353–363 (2015).

  33. 33.

    Fortuna, M. A. et al. Coevolutionary dynamics shape the structure of bacteria–phage infection networks. Evolution 73, 1001–1011 (2019).

  34. 34.

    Janzen, D. H. On ecological fitting. Oikos 45, 308–310 (1985).

  35. 35.

    Agosta, S. J. & Klemens, J. A. Ecological fitting by phenotypically flexible genotypes: implications for species associations, community assembly and evolution. Ecol. Lett. 11, 1123–1134 (2008).

  36. 36.

    Agosta, S. J. & Klemens, J. A. Resource specialization in a phytophagous insect: no evidence for genetically based performance trade-offs across hosts in the field or laboratory. J. Evol. Biol. 22, 907–912 (2009).

  37. 37.

    Wells, K. & Clark, N. J. Host specificity in variable environments. Trends Parsitol. 35, 452–465 (2019).

  38. 38.

    Golubski, A. J., Westlund, E. E., Vandermeer, J. & Pascual, M. Ecological networks over the edge: hypergraph trait-mediated indirect interaction (TMII) structure. Trends Ecol. Evol. 31, 344–354 (2016).

  39. 39.

    Gould, S. J. & Lewontin, R. C. The spandrels of San Marco and the Panglossian paradigm: a critique of the adaptionist programme. Proc. R. Soc. B 205, 581–598 (1979).

  40. 40.

    Barrett, R. D. & Hoekstra, H. E. Molecular spandrels: tests of adaptation at the genetic level. Nat. Rev. Genet. 12, 767–780 (2011).

  41. 41.

    Valverde, S. et al. The architecture of mutualistic networks as an evolutionary spandrel. Nat. Ecol. Evol. 2, 94–99 (2018).

  42. 42.

    Maynard, D. S., Serván, C. A. & Allesina, S. Network spandrels reflect ecological assembly. Ecol. Lett. 21, 324–334 (2018).

  43. 43.

    Acevedo, M. A., Dillemuth, F. P., Flick, A., Faldyn, M. J. & Elderd, B. D. Virulence-driven trade-offs in disease transmission: a meta-analysis. Evolution 73, 636–647 (2019).

  44. 44.

    Ashby, B., Gupta, S. & Buckling, A. Spatial structure mitigates fitness costs in host–parasite coevolution. Am. Nat. 183, E64–E74 (2014).

  45. 45.

    Woolhouse, M. E. J. & Gowtage-Sequeria, S. Host range and emerging and reemerging pathogens. Emerg. Infect. Dis. 11, 1842–1847 (2005).

  46. 46.

    Weiher, E. & Keddy, P. A. Assembly rules, null models, and trait dispersion: new questions from old patterns. Oikos 74, 159–164 (1995).

  47. 47.

    Ulrich, W. & Gotelli, N. J. Null model analysis of species nestedness patterns. Ecology 88, 1824–1831 (2007).

  48. 48.

    Bello, Fde The quest for trait convergence and divergence in community assembly: are null-models the magic wand? Glob. Ecol. Biogeogr. 21, 312–317 (2012).

  49. 49.

    Feng, W. & Takemoto, K. Heterogeneity in ecological mutualistic networks dominantly determines community stability. Sci. Rep. 4, 5912 (2014).

  50. 50.

    Jonhson, S., Domínguez-García, V. & Muñoz, M. A. Factors determining nestedness in complex networks. PLoS ONE 8, e74025 (2013).

  51. 51.

    Pellissier, L. Stability and the competition-dispersal trade-off as drivers of speciation and biodiversity gradients. Front. Ecol. 3, 00052 (2015).

  52. 52.

    Levins, R. & Culver, D. Regional coexistence of species and competition between rare species. Proc. Natl Acad. Sci. USA 68, 1246–1248 (1971).

  53. 53.

    Fitzpatrick, B. M., Fordyce, J. A. & Gavrilets, S. What, if anything, is sympatric speciation? J. Evol. Biol. 21, 1452–1459 (2008).

  54. 54.

    Flores, C. O., Valverde, S. & Weitz, J. S. Multi-scale structure and geographic drivers of cross-infection within marine bacteria and phages. ISME J. 7, 520–532 (2013).

  55. 55.

    Beckett, S. J. & Williams, H. T. P. Coevolutionary diversification creates nested-modular structure in phage-bacteria interaction networks. Interface Focus 3, 20130033 (2013).

  56. 56.

    May, R. M. Will a large complex system be stable? Nature 238, 413–414 (1972).

  57. 57.

    Keyser, C. A., De Fine Licht, H. H., Steinwender, B. M. & Meyling, N. V. Diversity within the entomopathogenic fungal species Metarhizium flavoviride associated with agricultural crops in Denmark. BMC Microbiol. 15, 249 (2015).

  58. 58.

    Büchi, L. & Vuilleumier, S. Ecological strategies in stable and disturbed environments depend on species specialization. Oikos 125, 1408–1420 (2016).

  59. 59.

    Poisot, T. & Gravel, D. When is an ecological network complex? Connectance drives degree distribution and emerging network properties. PeerJ 2, e251 (2014).

  60. 60.

    Nebreda, M. et al. Activity of aphids associated with lettuce and broccoli in Spain and their efficiency as vectors of lettuce mosaic virus. Virus Res. 100, 83–88 (2004).

  61. 61.

    Nebreda, M., Michelena, J. M. & Fereres, A. Seasonal abundance of aphid species on lettuce crops in central Spain and identification of their main parasitoids. J. Plant Dis. Prot. 112, 405–415 (2005).

  62. 62.

    Hubbell, S. P. The Unified Neutral Theory of Biodiversity and Biogeography (Princeton Univ. Press, 2001).

  63. 63.

    Fournier-Level, A. et al. A map of local adaptation in Arabidopsis thaliana. Science 334, 86–89 (2011).

  64. 64.

    Hendrick, M. F. et al. The genetics of extreme microgeographic adaptation: an integrated approach identifies a major gene underlying leaf trichome divergence in Yellowstone Mimulus guttatus. Mol. Ecol. 25, 5647–5662 (2016).

  65. 65.

    Kawecki, T. J. & Ebert, D. Conceptual issues in local adaptation. Ecol. Lett. 7, 1225–1241 (2004).

  66. 66.

    Sacristán, S., Fraile, A. & García-Arenal, F. Population dynamics of cucumber mosaic virus in melon crops and in weeds in central Spain. Phytopathology 94, 992–998 (2004).

  67. 67.

    MacArthur, R. H., & Wilson, E. O. The Theory of Island Biogeography (Princeton Univ. Press, 1967).

  68. 68.

    Newman, M. E. J. Networks: An Introduction (Oxford Univ. Press, 2010).

  69. 69.

    Susi, H., Vale, P. F. & Laine, A.-L. Host genotype and coinfection modify the relationship of within and between host transmission. Am. Nat. 186, 252–263 (2015).

  70. 70.

    Atmar, W. & Patterson, B. D. The measure of order and disorder in the distribution of species in fragmented habitat. Oecologia 96, 373–382 (1993).

  71. 71.

    Staniczenko, P. P. A., Kopp, J. C. & Allesina, S. The ghost of nestedness in ecological networks. Nat. Commun. 4, 1391 (2013).

  72. 72.

    Wigner, E. P. Characteristic vectors of bordered matrices with infinite dimensions. Ann. Math. 62, 548–564 (1955).

  73. 73.

    Nepusz, T., Petróczi, A., Négyessy, L. & Bazsó, F. Fuzzy communities and the concept of bridgeness in complex networks. Phys. Rev. E 77, 016107 (2008).

  74. 74.

    Newman, M. E. J. & Girvan, M. Finding and evaluating community structure in networks. Phys. Rev. E 69, 026113 (2004).

  75. 75.

    Trajanovski, H., Wang, H. & Van Mieghem, P. Maximum modular graphs. Eur. Phys. J. B 85, 244 (2012).

Download references


The authors thank L. Alsedà, J. Sardanyés, T. Lázaro, S. Duran-Nebreda, N. Conde and R. Solé for useful comments and discussions. This work was supported by the Spanish Ministry of Economy and Competitiveness, grant FIS2016-77447-R MINEICO/AEI/ FEDER and the European Union (to S.V.), and by grant RTI2018-094302-B-I00, Plan Estatal de I+D+i, Spanish Ministry of Economy and Competitiveness (to F.G.-A.). B.V. and R.M. were funded by the PR01018-EC-H2020-FET-Open MADONNA project.

Author information

S.V. and F.G.-A. designed and coordinated the study, S.V. conceived the theoretical framework and led its development. B.V. and S.V. contributed to the mean-field model. S.V., R.M. and B.V. developed the network analysis, S.S., A.F. and F.G.-A. collected field samples and the plant–virus network data. S.V. generated all the final illustrations and plots. S.V. and F.G.-A. wrote the manuscript. All authors made revisions and approved the final draft.

Correspondence to Sergi Valverde or Fernando García-Arenal.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Extended data

Extended Data Fig. 1 Summary of statistics for full and seasonal subnetworks.

From left to right: pathogen richness Np, host richness Nh, ecotype richness Nt, number of habitats C, host habitat specificity Nt/Nh, average species degree k, habitat modularity Qc, average bridgeness B, spectral radius ρ(A) (a quantitative measure of nestedness), and statistical significance of nestedness.

Extended Data Fig. 2 Summary of statistics for habitat subnetworks.

From left to right, relative fraction of species richness Nk/N, local ecotype richness \(N_p^k\), local pathogen species richness \(N_t^k\), and local habitat modularity \(Q_c^k\). For reference, the first row gives the corresponding values in the full network (N0 = N, \(N_p^0 = N_p\), \(N_t^0 = N_t\) and \(Q_c^0 = Q_c = Q_c^1 + Q_c^2 + Q_c^3 + Q_c^4\)).

Extended Data Fig. 3 Exploration of the theoretical morphospace of ecotype-pathogen networks.

Nestedness is an invariant feature of this morphospace, while modularity is not and depends on speciation rates. This can be appreciated in the structure of networks generated for different combinations of pathogen and host speciation rates. The model predicts habitat modularity increases with habitat specificity. For example, (D) is a highly modular network, while (A) is not because only a few host species (blue nodes) in the former network share multiple habitats (green balls). The black line depicts the intersection of average bridgeness and habitat modularity, which separates low and intermediate modular networks (dark green region) from highly modular networks (light green) (see Supplementary Section 5 for details).

Supplementary information

Supplementary Information

Supplementary Figs. 1–20, discussion and Table 1.

Reporting Summary

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Valverde, S., Vidiella, B., Montañez, R. et al. Coexistence of nestedness and modularity in host–pathogen infection networks. Nat Ecol Evol 4, 568–577 (2020).

Download citation