[R] send out put to file in R
chakri_amateur
chakri2sai at yahoo.co.in
Thu Jul 15 18:38:13 CEST 2010
Dear Gabor Csardi,
Thanks. The problem is now resolved.
> No wonder, writing computer programs is not just typing in random words
> and let the computer figure
> out what you are trying to do. At least not yet.
Apart from typo errors like "wri" before "write..." and "lecompose" instead
of "decompose", My command "write.graph.. <- decompose...." was itself a
blunder.
>> write.graph (compo, "F://new", "pajek")
>
>>
>
>> The error message shown up was -- "Not a Graph Object"
I did not figure out how to access the graph object in compo. It turns out
that "compo[[i]]" is the graph object. That must be the reason for Error
message "Not a graph object"
> It would help if you could tell us what you are trying to do.
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]])
> 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.
More information about the R-help
mailing list