如何访问中的图表的前3个连接组件的ID igraph
?
c <- igraph::components(g, mode = 'weak')
which(c$membership == which.max(c$csize))
将给最大和
which(c$membership == which.max(c$csize-1))
与c$csize-1
从所有值中减去-1相同的结果。
您可以使用order
排序和找出前3个最大群集的成员资格,并用于%in%
检查顶点是否在其中之一内:
which(c$membership %in% order(c$csize, decreasing = TRUE)[1:3])
order(c$csize, decreasing = TRUE)
给出将按size
降序排序的索引(对应于集群ID);c$membership
包含所有顶点的聚类ID;%in%
检查群集ID是否在前三名之内;本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句