计算加权图模块化的正确方法

Correct way of calculating modularity for weighted graphs

我有大约 13000 个基因,我正尝试使用 igraph 进行聚类,如下所示:

g.communities <- edge.betweenness.community(as.undirected(g), weights = E(g)$weight)

其中 returns 97 个社区具有模块化 0.9773353:

 modularity(as.undirected(g), membership = g.communities$membership, weights = E(g)$weight)
 
 #0.9773353

当我尝试自定义社区数量时,我得到了 0.0094 的模块化:

 modularity(as.undirected(g), membership = cutat(g.communities, steps = 97), weights = 
 E(g)$weight)
 
 #0.0094

这些函数不应该 return 相似的结果吗?另外,是否可以使用上面的 找到正确数量的簇的函数? (因为只要增加步骤,模块化总是会增加)

最后 g.communities$modularity returns 每个顶点的编号。 这些数字是否可以解释为每个顶点与其对应模块的相关性?

您正在使用 cut_atsteps 参数。这不指定社区的数量,而是指定要对树状图执行的合并步骤的数量。如果您想要 97 个社区,请使用 cut_at(g.communities, no=97) 或简单地使用 cut_at(g.communities, 97).


也就是说,我不建议此时在加权图上使用 edge.betweenness.community,原因我已描述 here