reciprocity | R Documentation |
Calculates the reciprocity of a directed graph.
reciprocity(graph, ignore.loops = TRUE, mode = c("default", "ratio"))
graph |
The graph object. |
ignore.loops |
Logical constant, whether to ignore loop edges. |
mode |
See below. |
The measure of reciprocity defines the proportion 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:
1 - \left(\sum_{i,j} |A_{ij} - A_{ji}|\right) / \left(2\sum_{i,j} A_{ij}\right)
.
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-reciprocally 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
.
A numeric scalar between zero and one.
Tamas Nepusz ntamas@gmail.com and Gabor Csardi csardi.gabor@gmail.com
Other structural.properties:
bfs()
,
component_distribution()
,
connect()
,
constraint()
,
coreness()
,
degree()
,
dfs()
,
distance_table()
,
edge_density()
,
feedback_arc_set()
,
girth()
,
is_acyclic()
,
is_dag()
,
is_matching()
,
k_shortest_paths()
,
knn()
,
subcomponent()
,
subgraph()
,
topo_sort()
,
transitivity()
,
unfold_tree()
,
which_multiple()
,
which_mutual()
g <- sample_gnp(20, 5 / 20, directed = TRUE)
reciprocity(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.