reciprocity_cor | R Documentation |
Reciprocity correlation coefficient
reciprocity_cor(g)
g |
igraph object. should be a directed graph |
The usual definition of reciprocity has some defects. It cannot tell the relative difference of reciprocity compared with purely random network with the same number of vertices and edges. The useful information from reciprocity is not the value itself, but whether mutual links occur more or less often than expected by chance.
To overcome this issue, reciprocity can be defined as the correlation coefficient between the entries of the adjacency matrix of a directed graph:
\frac{\sum_{i\neq j} (a_{ij} - a')((a_{ji} - a')}{\sum_{i\neq j} (a_{ij} - a')^2}
where a' is the density of g.
This definition gives an absolute quantity which directly allows one to distinguish between reciprocal (>0) and antireciprocal (< 0) networks, with mutual links occurring more and less often than random respectively.
Reciprocity as a correlation
David Schoch
Diego Garlaschelli; Loffredo, Maria I. (2004). "Patterns of Link Reciprocity in Directed Networks". Physical Review Letters. American Physical Society. 93 (26): 268701
library(igraph)
g <- sample_gnp(20, p = 0.3, directed = TRUE)
reciprocity(g)
reciprocity_cor(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.