[Top][All Lists]

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

Re: [igraph] getting the graph of the maximum component

From: Claudia Muller-Birn
Subject: Re: [igraph] getting the graph of the maximum component
Date: Sun, 8 Aug 2010 16:06:14 -0400

Hi Martin,

I checked my code and found this for getting the maximal subgraph:

cl <- clusters(g)
subg <- subgraph(g, which(cl$membership == which.max(cl$csize)-1)-1)

I hope it helps :)


On Aug 7, 2010, at 9:20 AM, Martin Tomko wrote:

> Hi All,
> I have a graph that consists of many disconnected components (subgraphs, or 
> clusters...).
> I am interested in working with the maximum one.
> I figured the following approach to identify it in the csize frame of the 
> clusters function :
> c<-clusters(g)
> which.max(c$csize)
> I would like to get it as a graph object. trying the following failed:
> gg<-c[which.max(c$csize)]
> seems like decompose.graph could help, but I am wondering what's the easiest 
> way to identify and get the largest component from this output.
> The documentation claims that the result of decompose.graph(g) is a list of 
> graph objects, but this fails:
> f<-decompose.graph(g)
> ff<-f[1]
> length(V(ff)) claiming that ff is not a graph object (typeof shows that it is 
> a list of graph objects).
> Thanks
> Martin
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

reply via email to

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