Question

I am currently testing various community detection algorithms in the igraph package to compare against my implementation.

I am able to run the algorithms on different graphs but I was wondering if there was a way for me to write the clustering to a file, where all nodes in one community are written to one line and so on. I am able to obtain the membership of each node using membership(communities_object) and write that to a file using dput() but I don't know how to write it the way I want.

This is the first time I am working with R as well. I apologize if this has been asked before.

Was it helpful?

Solution

This does not have to do much with igraph, the clustering is given by a simple numeric vector. See ?write.

write(membership(communities_object), file="myfile", ncolumns=1)

OTHER TIPS

write(communities_object$membership, file="myfile", ncolumns=1) also work

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top