Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 204742

Comparing set of graphs

$
0
0

Using the R igraph package, I am trying to compare a set of similar network partitions representing cohorts. Each network is undirected and consists of the same (n=150) nodes connected differently for each cohort. Since I have 11 cohorts that I would like to compare, it would be ideal if I could implement this procedure in a loop, but I can't quite figure out how.

If I have the network objects g1 and g2, I can manually compare them:

compare(infomap.community(g1), infomap.community(g2), method='nmi')

I've figured out that I can save the networks in a list, but then I won't be able to compare them either by

network_list <- list(g1, g2)
compare(infomap.community(network_list[1]), infomap.community(network_list[2]), method='nmi')

Which produces the error "Error in infomap.community(test[1]) : Not a graph object", or by

community_object_list <- list(infomap.community(g1), infomap.community(g2))
compare(community_object_list[1], community_object_list[2])

Producing the error "Error in i_compare(comm1, comm2, method) : (list) object cannot be coerced to type 'double'"

Does anyone know how to fix this, or can think of another way to do it?

Thanks


Viewing all articles
Browse latest Browse all 204742

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>