Last data update: 2014.03.03

R: Find and Remove Edge Loops and Duplicates
edge.duplicatesR Documentation

Find and Remove Edge Loops and Duplicates

Description

This function finds and removes loops, edge duplicates, and bi-directional edges.

Usage

edge.duplicates(network, verbose = TRUE)

Arguments

network

An edge list, which is either a data frame or a character or integer matrix with two columns.

verbose

Logical, whether to display the progress of the function on the screen. Defaults to TRUE.

Details

This function removes loops, duplicate and bi-directional edges; the edges that occur closer to the end of the edge list will be removed.

Value

A list with the following elements: edges - a character matrix of the edges in the network with any loops or duplicate edges removed; inds - an integer vector of the edge indices of any loop or duplicate edges in the original network.

Author(s)

Alex T. Kalinka alex.t.kalinka@gmail.com

References

Kalinka, A.T. and Tomancak, P. (2011). linkcomm: an R package for the generation, visualization, and analysis of link communities in networks of arbitrary size and type. Bioinformatics 27, 2011-2012.

Examples

## Generate graph and remove loops and duplicate edges.
g <- swiss[,3:4]
g.dup <- edge.duplicates(g)

Results