reciprocity: Reciprocity of graphs

Description Usage Arguments Details Value Author(s) Examples

View source: R/structural.properties.R

Description

Calculates the reciprocity of a directed graph.

Usage

1
reciprocity(graph, ignore.loops = TRUE, mode = c("default", "ratio"))

Arguments

graph

The graph object.

ignore.loops

Logical constant, whether to ignore loop edges.

mode

See below.

Details

The measure of reciprocity defines the proporsion of mutual connections, in a directed graph. It is most commonly defined as the probability that the opposite counterpart of a directed edge is also included in the graph. Or in adjacency matrix notation: sum(i, j, (A.*A')ij) / sum(i, j, Aij), where A.*A' is the element-wise product of matrix A and its transpose. This measure is calculated if the mode argument is default.

Prior to igraph version 0.6, another measure was implemented, defined as the probability of mutual connection between a vertex pair, if we know that there is a (possibly non-mutual) connection between them. In other words, (unordered) vertex pairs are classified into three groups: (1) not-connected, (2) non-reciprocaly connected, (3) reciprocally connected. The result is the size of group (3), divided by the sum of group sizes (2)+(3). This measure is calculated if mode is ratio.

Value

A numeric scalar between zero and one.

Author(s)

Tamas Nepusz ntamas@gmail.com and Gabor Csardi csardi.gabor@gmail.com

Examples

1
2
g <- sample_gnp(20, 5/20, directed=TRUE)
reciprocity(g)

igraph documentation built on July 21, 2017, 7:18 p.m.

Search within the igraph package
Search all R packages, documentation and source code