cpness: Core-peripheriness measure

View source: R/cpness.R

cpnessR Documentation

Core-peripheriness measure

Description

Computation of the cpness measure for a bipartite graph/network

Usage

cpness(web, type=c("automatic","binary","integer","float"), plot=TRUE, fastplot=FALSE)

Arguments

web

A matrix with elements of a set (e.g., plants) as rows, elements of a second set (e.g., pollinators) as columns and number of interactions as entries. Species names can be indicated in the row or column names.

type

Type of matrix. This should be (an unambiguous abbreviation of) one of automatic (default), binary, integer or float. With automatic (default), the type of matrix is automatically deduced inside the function. Using binary, the matrix is binarized in any case. See the "Details" section.

plot

Plot the matrix reordered according to the core-periphery partitioning. TRUE by default.

fastplot

If TRUE, the matrix plot is performed using the fast image function instead of the visweb function from the bipartite package, without species names. Only for large matrices. FALSE by default.

Details

In a matrix displaying a core-periphery structure, there is a species ordering (i.e. an ordering in rows and columns) such that interactions are distributed in an L-shape. This L-shape is composed by four blocks of varying connectance: block C11 represents the core; blocks C12 and C21 include the interactions between core and periphery; block C22 includes the interactions that occur between peripheral species.

This fonction computes the core-peripheriness (CPness), as CPness=(E11+E12+E21)/E, where Eij is the number of interactions (edges) or the sum of weights for each block (Eij for block ij) or for the entire network (E). Here, we rely on a stochastic block model (SBM) to detect the four groups/blocks C11, C12, C21 and C22 when they actually exist. However, the SBM can fail in finding these blocks: in these cases, there is no core-periphery partition and the CPness value is set to NA.

This function can deal with binary and weighted networks with the appropriate statistical distribution (Bernouilli for binary data, Poisson for integer weights, and Gaussian for float weights). Note that it is often advisable to log-transform float data before running the cpness function.

Value

cpness returns an object of class list with the following components:

cpness

The value of the core-peripheriness measure. NA when no core-periphery partition is found.

rowmembership

An integer vector indicating the group to which species in rows are belonging. Group 1 is core and group 2 is periphery, unless there is only a single group.

colmembership

Same as rowmembership for species in columns.

Author(s)

Authors: Vincent Miele Maintainer: Vincent Miele <vincent.miele@univ-lyon1.fr>

References

Ana M. Martin Gonzalez, Diego P. Vazquez, Rodrigo Ramos-Jiliberto, Sang Hoon Lee & Vincent Miele, Core-periphery structure in mutualistic networks: an epitaph for nestedness? BiorXiv (2020) <doi:10.1101/2020.04.02.021691>

Examples

library(bipartite)
data(mosquin1967)
result <- cpness(mosquin1967, type="automatic", plot=TRUE)
print(result)

data(junker2013)
result <- cpness(junker2013, type="automatic", plot=TRUE, fastplot=TRUE)
print(result$cpness)
print(table(result$rowmembership))
print(table(result$colmembership))

econetwork documentation built on Oct. 21, 2022, 5:10 p.m.