Computation of the cpness measure for a bipartite graph/network
cpness(web, type=c("automatic","binary","integer","float"), plot=TRUE, fastplot=FALSE)cpness returns an object of class list with the following components:
The value of the core-peripheriness measure. NA when no core-periphery partition is found.
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.
Same as rowmembership for species in columns.
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 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 the matrix reordered according to the core-periphery
partitioning. TRUE by default.
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.
Authors: Vincent Miele Maintainer: Vincent Miele <vincent.miele@univ-lyon1.fr>
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.
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>
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))
Run the code above in your browser using DataLab