On Thu, Jul 15, 2010 at 6:38 PM, chakri_amateur <chakri2...@yahoo.co.in> wrote:
[...]
> I want to extract the largest connected component (alias sub-graph) of the
> network. My input network is a large network of >1000 vertices and >15000
> arcs. From this, I want to take out only the largest cluster.
>
>> If you decompose a graph to components, you get a list of graphs;
>
> Yes. But I want only the largest sub-graph. It is first in the list
> sub-graphs generated. Am I right ? I tried with 10 files, and all the time
> the largest sub-graph is shown first in the list. (i.e i=1, in compo[[i]])

No, this is not right. It is just a coincidence. The components are
not ordered. In fact, the first component in the list is the one that
has the first (well, zeroth) vertex. Check the sizes of the components
and explicitly choose the largest one:

compo[[ which.max(sapply(compo, vcount)) ]]

Best,
Gabor

>> for (i in seq_along(compo)) {
>>   write.graph(compo[[i]], file=paste(sep="", "new-", i, ".net"),
>> format="pajek")
>> }
>
> It worked. I Just had to give entire file path instead of just "new" !
>
> for (i in seq_along(compo)) {
> write.graph(compo[[i]], file=paste(sep="", "F://new-", i, ".net"), "pajek")
> }
>
> or For the first component
> write.graph(compo[[1]], "F://new.net", "pajek")
>
> Chakri
>
>
>
>
> Second,
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/send-out-put-to-file-in-R-tp2288515p2290393.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Gabor Csardi <gabor.csa...@unil.ch>     UNIL DGM

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to