我有一个无向网络,我在 Igraph 与加权边缘一起工作 .

对于特定的图形 out ,我可以使用 edge.betweenness.community 函数计算 Igraph 中的社区,并使用 edge.betweenness 计算每条边的中间性 .

我可以通过编写以下内容告诉 igraph 包括每条边的权重:

largest <- which.max(sapply(modules, vcount))
out <- modules[largest][[1]]
bt <- edge.betweenness(out, weights = E(out)$value, directed = FALSE)

返回:

bt
 [1] 20.0 11.0 27.0 11.0  8.0 12.0  8.0  8.5  7.5  6.0  3.0  3.0  7.0  8.5  7.5  4.0 11.0

权重在哪里:

E(out)$value
 [1] 0.2829 0.2880 0.2997 0.1842 0.2963 0.2714 0.2577 0.2850 0.2850 0.2577 0.2305 0.2305 0.2577 0.1488 0.1488 0.1215 0.2997

在这种情况下,权重具有限制 0 - 1 ,其中1 =遍历边缘的最高成本,0 =最低成本 . 但是,在任何中介性计算中,这些限制都不会传递给 igraph .

我的问题: igraph 如何根据标准化来评估所列权重的下限和上限?

它是否根据指定重量的最小值和最大值自动调整权重? (在这种情况下 min = 0.1215, max = 0.2997

我想要的是:如何让它考虑到完整数据集( min=0 - max=1 )的真实限制?


附加信息:

如果我将权重 E(out)$value 乘以某个常数并重新计算中间性,我得到一个类似的答案(我假设有一些浮动错误,它们实际上是相同的):

new_weights <- as.numeric(E(out)$value*2.5)
new_weights
 [1] 0.70725 0.72000 0.74925 0.46050 0.74075 0.67850 0.64425 0.71250 0.71250 0.64425 0.57625 0.57625 0.64425 0.37200 0.37200 0.30375 0.74925
bt <- edge.betweenness(out, weights = new_weights, directed = FALSE)

赠送:

bt
 [1] 20 11 27 11  8 12  8  8  8  6  3  3  7  8  8  4 11

这意味着正在进行一些自动缩放:

With this in mind, how do I manually scale the betweenness calculation to my required limits of 0 and 1?


研究:

编辑2016年6月2日 -

我试图在igraph R Github页面上查看edge.betweenness的源代码https://github.com/igraph/rigraph/tree/dev/R

我能找到的最接近的功能是 cluster_edge_betweenness at https://github.com/igraph/rigraph/blob/dev/R/community.R

该函数调用C函数 C_R_igraph_community_edge_betweenness . 我可以在igraph C文档中找到的最接近的参考文献是 igraph_community_edge_betweenness at https://github.com/igraph/igraph/blob/master/include/igraph_community.h

然而,这些链接都没有提及如何计算权重的限制 .

原创研究:

我查看了关于中介算法的 igraph 文档,并探讨了与规范化相关的其他问题,但没有发现任何具体涉及权重本身的规范化的问题 .

Modularity calculation for weighted graphs in igraph

Calculation of betweenness in iGraph

http://igraph.org/r/doc/betweenness.html


网络数据和可视化如下:

plot(out)

Weighted Graph

get.data.frame(out)
   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

(在这种情况下,权重在 frame$value 列中,限制为 0 - 1 ,其中1 =遍历边的最高成本,0 =最低成本)