> The 20 nodes were split into three communities. I wrote the numbers of > communities to the vector commajd, then compute the function > modularity() again. Btw, results are different: 0.2573302 - 0.25 = > 0.0073302, may be I made an error in vector. No, the vector is correct; you can check it by extracting the same membership vector from your "comm" object with:
> membership(comm) [1] 1 1 1 2 3 2 1 1 2 2 3 2 1 3 2 2 2 3 3 2 The problem is that "optimal.community" always treats the input graph as undirected, even when it is directed, as stated in its documentation. (Maybe it would be wise to give a warning in such cases). The results are undefined if your input graph is directed. > Could someone please say me how to plot the origin graph g and new > community detection commajd together? Maybe there's a better way (I'm not that familiar with the R interface), but you can mutate your existing "communities" object: > comm$membership <- commajd > plot(comm) T. _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
