most efficient method to extract cluster membership from an edge list in R

37 Views Asked by At

I have a graph constructed from an edge list, and i need to extract the cluster membership for each vertex in the graph.

currently this is how i do it in R using the igraph package

edgelist=cbind(sample.int(10000,replace=T),sample.int(10000,replace=T))
graph=igraph::graph_from_data_frame(edgelist, directed = F)
igraph::components(graph)$membership

For the purpose of my custom-made function, i needed to repeat this procedure 1000000 times, I'm already using foreach() to distribute the 1000000 iterations across multiple threads. So, i'm wondering if there is a more efficient way of extracting the cluster membership from the graph or the edge list?

0

There are 0 best solutions below