R: Check (and count) duplicated edges

check.dpl.edges {rgexf} | R Documentation

## Check (and count) duplicated edges

### Description

Looks for duplicated edges and reports the number of instances of them.

### Usage

    check.dpl.edges(edges, undirected=FALSE, order.edgelist=TRUE)

### Arguments

`edges` | A matrix or data frame structured as a list of edges
`undirected` | Declares if the net is directed or not (does de diference)
`order.edgelist` | Wether to sort the resulting matrix or not

### Details

`check.dpl.edges` looks for duplicated edges reporting duplicates and counting how many times each edge is duplicated.

For every group of duplicated edges only one will be accounted to report number of instances (which will be recognized with a value higher than 2 in the `reps` column), the other ones will be assigned a `-1` at the `reps` value.

Function is mainly written in C, so speed gains are important.

### Value

A three column `data.frame` with colnames “source”, “target” “reps”.

### Author(s)

George Vega Yon george.vega@nodoschile.org

### Examples

      # An edgelist with duplicated dyads
      relations <- cbind(c(1,1,3,4,2,5,6), c(2,3,1,2,4,1,1))

      # Checking duplicated edges (undirected graph)
      check.dpl.edges(edges=relations, undirected=TRUE)

[Package rgexf version 0.15.3 Index]