igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Performance issue regarding when calculating induced_subgraph a


From: Roland Sztaho
Subject: [igraph] Performance issue regarding when calculating induced_subgraph and authority_score within a loop
Date: Sat, 23 Apr 2016 10:55:36 +0200

Hello Guys,

I would like to prepare some stats based on clusters made by cluster_label_prop() method. When I use authority_score() and induced_subgraph() within a loop, it shows weak performance and I am looking for a workaround to speed up the code. My network contains approx. 3.000.000 edges and 250.000 clusters. I think calculation of these measure for the clusters without the loop could be a good point, however I didn't find a way in the docs for this.

R version 3.2.5 (2016 04 14)
igraph package version 1.0.1
OS: windows 7 64bit

Here is what I have so far:

library("igraph")
library("plyr")
setwd("C:/Projects/R/igraph")

g_in = read.csv("my_network.csv", sep=" ")
g = graph.data.frame(g_in, directed=FALSE)

clust = groups(cluster_label_prop(g, weights=E(g)$weight))
clust_count <- length(clust)
clustm <- as.matrix(ldply((clust), data.matrix))
clustm1 <- clustm[clustm[, ".id"] == 1, 2]

g_sub = induced_subgraph(g, clustm1)
auth_scr = as.matrix(authority_score(g_sub)$vector)
for (i in 2:clust_count) {
g_sub = induced_subgraph(g, clustm[clustm[, ".id"] == i, 2])
auth_scr = rbind(as.matrix(auth_scr), as.matrix(authority_score(g_sub)$vector))
}

Any suggestions would be great!

Thanks,
Roland

reply via email to

[Prev in Thread] Current Thread [Next in Thread]