igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Can I subset a "communities" object based on communities si


From: Gábor Csárdi
Subject: Re: [igraph] Can I subset a "communities" object based on communities sizes?
Date: Sun, 24 Nov 2013 16:42:18 -0500

How about contracting the graph first, and then removing the vertices
that belong to the small communities after?

G.

On Sun, Nov 24, 2013 at 4:34 PM,  <address@hidden> wrote:
> 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
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

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