This function checks the reciprocal pair of the supplied edges.
Usage
which_mutual(graph, eids = E(graph), loops = TRUE)
Arguments
- graph
The input graph.
- eids
Edge sequence, the edges that will be probed. By default is includes all edges in the order of their ids.
- loops
Logical, whether to consider directed self-loops to be mutual.
Details
In a directed graph an (A,B) edge is mutual if the graph also includes a (B,A) directed edge.
Note that multi-graphs are not handled properly, i.e. if the graph contains two copies of (A,B) and one copy of (B,A), then these three edges are considered to be mutual.
Undirected graphs contain only mutual edges by definition.
See also
reciprocity()
, dyad_census()
if you just
want some statistics about mutual edges.
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()
,
laplacian_matrix()
,
reciprocity()
,
subcomponent()
,
subgraph()
,
topo_sort()
,
transitivity()
,
unfold_tree()
,
which_multiple()
Author
Gabor Csardi csardi.gabor@gmail.com
Examples
g <- sample_gnm(10, 50, directed = TRUE)
reciprocity(g)
#> [1] 0.56
dyad_census(g)
#> $mut
#> [1] 14
#>
#> $asym
#> [1] 22
#>
#> $null
#> [1] 9
#>
which_mutual(g)
#> [1] TRUE FALSE TRUE TRUE FALSE FALSE TRUE FALSE TRUE FALSE FALSE TRUE
#> [13] FALSE FALSE TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE
#> [25] FALSE TRUE FALSE TRUE FALSE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
#> [37] TRUE TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE FALSE TRUE
#> [49] TRUE FALSE
sum(which_mutual(g)) / 2 == dyad_census(g)$mut
#> [1] TRUE