igraph-help
[Top][All Lists]
Advanced

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

[igraph] Can I subset a "communities" object based on communities sizes


From: capitano . nemo
Subject: [igraph] Can I subset a "communities" object based on communities sizes?
Date: Sun, 24 Nov 2013 21:34:17 +0000
User-agent: autistici.org webmail

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?



reply via email to

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