基于cluster_edge_betweenness调整delete.edges删边的技术求助
igraph边介数聚类后的图分割问题
我想通过边介数方法实现图的聚类拆分,但遇到几个问题:
1. 原代码中mods变量未定义的问题
原参考代码里的这一行因为mods未定义无法运行,不知道该怎么调整:
g2 <- delete.edges(out, wc$removed.edges[seq(length = which.max(mods) - 1)])
2. 新版函数调用与边删除的困惑
旧的edge.betweenness.community函数已更新,我现在使用的新版调用写法是:
wc <- cluster_edge_betweenness(out, weights = E(out)$value, directed = FALSE, bridges = TRUE, membership = TRUE, modularity = TRUE)
但在调整delete.edges函数时,两种调用方式都有问题:
- 第一种调用删除的边过多:
out2 <- delete.edges(out, wc$removed.edges[seq(length = which.max(wc$modularity))]) - 第二种调用删除的边过少:
out2 <- delete.edges(out, wc$removed.edges[which.max(wc$modularity)])
用到的数据
from to value sourceID targetID 1 74 80 0.2829 255609 262854 2 74 61 0.2880 255609 179585 3 80 1085 0.2997 262854 3055482 4 1045 1046 0.1842 2970629 2971615 5 1046 1085 0.2963 2971615 3055482 6 1046 1154 0.2714 2971615 3087803 7 1085 1154 0.2577 3055482 3087803 8 1085 1187 0.2850 3055482 3101131 9 1085 1209 0.2850 3055482 3110186 10 1154 1243 0.2577 3087803 3130848 11 1154 1187 0.2305 3087803 3101131 12 1154 1209 0.2305 3087803 3110186 13 1154 1244 0.2577 3087803 3131379 14 1243 1187 0.1488 3130848 3101131 15 1243 1209 0.1488 3130848 3110186 16 1243 1244 0.1215 3130848 3131379 17 1243 1281 0.2997 3130848 3255811
内容的提问来源于stack exchange,提问作者Sulz
相关产品推荐
相关产品推荐

