calc_topological_roles: Calc topological roles among network communities/modules

View source: R/calcTopologicalIndices.r

calc_topological_rolesR Documentation

Calc topological roles among network communities/modules


Topological roles characterize species as its roles between communities or modules, we calculate the modules using igraph::cluster_spinglass() function. Alternatively you can pass a community object obtained with other method using the parameter community. Topological roles are described by two parameters: the standardized within-module degree dz and the among-module connectivity participation coefficient PC. The within-module degree is a z-score that measures how well a species is connected to other species within its own module compared with a random graph. The participation coefficient PC estimates the distribution of the links of species among modules. As the community algorithm is stochastic we run it several times and return the repeated runs for both parameters.


calc_topological_roles(g, nsim = 1000, ncores = 0, community = NULL)



an Igraph object with the network


number of simulations for igraph::cluster_spinglass() method


number of cores to use paralell computation, if 0 sequential processing is used.


a community object obtained with other method, if NULL the community is calculated with igraph::cluster_spinglass()


a data frame with two numeric fields: within_module_degree, among_module_conn


  1. Guimerà, R. & Nunes Amaral, L.A. (2005). Functional cartography of complex metabolic networks. Nature, 433, 895–900

  2. Kortsch, S. et al. 2015. Climate change alters the structure of arctic marine food webs due to poleward shifts of boreal generalists. - Proceedings of the Royal Society B: Biological Sciences 282: 20151546.


#' \dontrun{

g <- netData[[2]]

tp <- calc_topological_roles(g,nsim=10)

# using a community object

m <- cluster_walktrap(g)

tp <- calc_topological_roles(g,community=m)

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