The robustness of food webs to species extinctions

[This article was first published on R Code – Geekcologist, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The study of food webs is very relevant, considering the role these networks have in describing the transfer of energy and matter in the ecosystem (Thompson et al. 2012). As such, the evaluation of the robustness to species extinctions is an important step in any analysis evaluating food web stability.

The attack on networks, such as food webs, can be random or targeted to hubs. Hubs are nodes – here species – with much higher number of (trophic) interactions. To do that I used the approach described in Bellingeri et al (2013). These authors define an Intentionality Index, varying from 0 to 1, according to which there is an increasing probability of removing hubs: I=0 (random extinctions), I=1 (preferentially extinguishing hubs).

The robustness of the food web is evaluated by the number of primary extinctions required to have 50% of the species in the food web as secondary extinctions (eq. 1). Robustness is computed by:

R50 = E/S (1)

Where E is the number of primary extinctions required to cause 50% of the species in the food web to get extinguished and S is the total number of nodes in the food web.

The probability of a node being extinguished, considering its degree (the number of interactions), is determined by a function from the family of exponential probability mass functions (eq. 2).

Where k is node degree, kmin and kmax are minimum and maximum number of trophic interactions in the food web nodes, Nk is the number of nodes with degree k and Ni is number of nodes with degree i (see Bellingeri et al. 2013 for details).

I will use my package FWebs, which is available on GitHub, to evaluate the robustness of food webs to species extinction (this is still a development version, suggestions, bug reports are welcome!).

First, installing and loading the package:


Then proceed to use one food web to evaluate its robustness to extinction.

#Create a food webs list, downloaded from the mangal database
mg1 <- create.fw.list(db="mg", ref=TRUE, spatial = TRUE)

#Convert to list a list of graph objects
graph_list1 <-

#Create a vector with the values for the Intentionality Index (I)
i_index <- seq(from = 0, to = 1, by =0.01)
i_index <- head(i_index,-1)

#Extract one food web to use as example
fw1 <- graph_list1[[40]]

#Compute the probability to remove each species (node) 
prob_exp <- exponent.removal(fw1, i_index)

#Simulate the extraction of species to evaluate how many primary extinctions are required to have 50% of the total species extinguished (using only 10 iterations for simplicity)
it1 <- iterate(fw_to_attack=fw1, prob_exp, alpha1=50, iter=10, i_index, plot = TRUE)
Fig 1. Robustness of the food web to species extinctions. As we move along an intentionality Index (x axis) we are removing hubs with greater probability. The R50 (y axis), the robustness, decreases as the attack on hubs is more probable.

This post demonstrates a simple approach to evaluate the robustness of food webs to species extinction. It might be used in other types of ecological networks, or even non-ecological networks. Those interested can see the paper by Bellingeri, M. et al. (2013) for additional details.


Bellingeri, M. et al. (2013). Increasing the extinction risk of highly connected species causes a sharp robust-to-fragile transition in empirical food webs. Ecological Modelling, 251, 1-8.

Thompson, R.M. et al. (2012). Food webs: reconciling the structure and function of biodiversityTrends in Ecology & Evolution27(12), 689-697.

To leave a comment for the author, please follow the link and comment on their blog: R Code – Geekcologist. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)