calc_weighted_topological_indices: Function to calculate weighted network indices

View source: R/calcFunctionalIndices.r

calc_weighted_topological_indicesR Documentation

Function to calculate weighted network indices


The function calculates: weighted linkage density, connectance, generality and vulnerability and the SDs of the last two based on 1 and the level of omnivory, mean and maximum trophic level based on 2 using NetIndices::TrophInd() function. The igraph networks must have the weight attribute.


calc_weighted_topological_indices(ig, ncores = 0)



An igraph object with the weight attribute representing fluxes


number of cores used to compute in parallel, if 0 sequential processing is used.


a data.frame with the following fields:

  • LD: linkage density

  • Connectance: directed Connectance

  • TLmean: mean trophic level

  • TLmax: maximum trophic level

  • LOmnivory: Level of omnivory, quantifies mean of the variety in trophic levels of the preys of a consumer

  • Vulnerability: mean of number of consumers per prey

  • VulSD: the standard deviation of normalized Vulnerability

  • Generality: mean number of prey per consumer

  • GenSD: the standard deviation of normalized Generality


  1. Bersier, LF. et al. (2002). Quantitative Descriptors Of Food-web Matrices. Ecology, 83(9), 2394–2407.

  2. Kones, JK. et al. (2009). Are network indices robust indicators of food web functioning? A Monte Carlo approach. Ecological Modelling, 220, 370–382.


# Generate a test network

g <-   graph_from_literal( 1 -+ 4 -+ 7,2 -+ 5 -+7, 3-+6-+7, 7-+7, 4+-3, simplify = FALSE)

# Add weight

E(g)$weight <- sample(c(.1,.2,.8,.9),gsize(g),replace=TRUE)


lsaravia/EcoNetwork documentation built on March 20, 2024, 3:27 p.m.