I have an object "communities" with few large communities and many communities with just few members. I would like to create a community graph to plot (with one node for each community) but excluding communities with less than 20 members.

I was able to subset the graph based on membership to largest communities with

    ids <- which(sizes(communities)>20)
subgraph <- induced.subgraph(graph, which(membership(communities) %in% id))

Now I wanted to apply this (from http://stackoverflow.com/a/12699979/1707938) to my case

   contractgraph <- contract.vertices(subgraph, membership(communities))
   E(contractgraph)$weight <- 1
   contractgraph2 <- simplify(contractgraph, remove.loops=FALSE)

But of course I have a problem because "subgraph" and "communities" have different length. How could I proceed? Should I try to subset "communities" based on sizes(communities)>20?

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to