R network package - is there a faster way to add edges? -
i have adjacency matrix (m) of 7000 nodes. creating network using
n <- 7000 m <- matrix(rbinom(3*n, 1, 0.2), n,n) diag(m) <- 0 g <- network(m, directed = f)
is slow. there more efficient way of creating large random networks in r? alternative methods such using igraph appreciated.
with igraph, can do:
library('igraph') g <- graph.adjacency(m, mode='undirected')
the edges can retrieved using e(g)
, vertices using v(g)
.
check out igraph docs more information.
Comments
Post a Comment