adj2el.Rd
Maps adjacency matrix to edgelist
adj2el(adj, directed = TRUE, names = NULL)
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. |
a dataframe containing the edgelist
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)