Learn R Programming

igraph (version 1.3.5)

which_mutual: Find mutual edges in a directed graph

Description

This function checks the reciprocal pair of the supplied edges.

Usage

which_mutual(graph, eids = E(graph))

Value

A logical vector of the same length as the number of edges supplied.

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.

Author

Gabor Csardi csardi.gabor@gmail.com

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.

Examples

Run this code

g <- sample_gnm(10, 50, directed=TRUE)
reciprocity(g)
dyad_census(g)
which_mutual(g)
sum(which_mutual(g))/2 == dyad_census(g)$mut

Run the code above in your browser using DataLab