adj2el: Maps adjacency matrix to edgelist

Description Usage Arguments Value Examples

View source: R/edgelists.R

Description

Maps adjacency matrix to edgelist

Usage

1
adj2el(adj, directed = TRUE, names = NULL)

Arguments

adj

matrix or sparse matrix object, the adjacency matrix

directed

boolean, is the graph directed?

names

optional vector with node names. When 'NULL' row- and column names of 'adj' are used.

Value

a dataframe containing the edgelist

Examples

1
2
3
4
5
el <- data.frame(from= c('a','b','b','c','d','d'),
                to  = c('b','c','d','a','b','a'),
                attr= c( 12, 6, 12 , 6 , 6 , 6 ))
adj <- el2adj(el)
el1 <- adj2el(adj, directed = TRUE)

gi0na/adjHelpR documentation built on Jan. 9, 2022, 11:38 p.m.