在iGraph中计算中间度 [英] Calculation of betweenness in iGraph

查看:286
本文介绍了在iGraph中计算中间度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到一些信息暗示了这种亲密关系在iGraph中,加权图是使用权重而非成本来计算的.

I've seen some info suggesting that closeness in iGraph weighted graphs is calculated using the weights as costs, rather than strengths.

我想知道两者之间是否同样如此.也就是说,如果我在两个顶点之间有两条路径,其中一个(a)的边权重总和为100,而另一个(b)的边权重总和为200,则中间性会将路径a解释为成本最低的路径,并将该边权重值包括在分子之间的计算.

I'm wondering if this is also true for betweenness. i.e, if I have two paths between vertices, one of them (a) with edge weights summing to 100 and the other (b) to 200, betweenness will interpret path a as the least costly path and include this edge weight value in the numerator of the betweenness calculation.

如果是这样,为了获得基于强度的中间性,我假设有人会将权重转换为等于1/权重吗?

If so, to obtain betweenness based on strength, I assume one would transform the weights to equal 1/weight?

我尝试使用以下三个节点的边缘文件对此进行测试:

I've tried to test this with a three node edge file as follows:

V1  V2 weight
1    2      1
1    3      4
2    3      1

使用上面提供的权重,节点2的中间度为1,其他节点= 0.这似乎表明中间度计算正在避开2-> 1-> 3的路径,因为它将高权重视为成本.

Using the weights as supplied above, node 2 has a betweenness of 1, and others=0. This seems to indicate that the betweenness calculation is avoiding the path from 2->1->3 because it's viewing the high weights as a cost.

但是,如果我创建一个新的加权变量: E(g)$weightI <- 1/E(g)$weight

However, if I create a new weighting variable: E(g)$weightI <- 1/E(g)$weight

并运行介于两者之间: b<-data.frame(betweenness(g, V(g), directed=FALSE, weights=E(g)$weightI))

And run betweenness: b<-data.frame(betweenness(g, V(g), directed=FALSE, weights=E(g)$weightI)),

所有中间值均为0,这是意外的,对解决我的初始问题没有特别的帮助

all the betweenness values are 0, which is unexpected and not especially helpful in sorting out my initial question

推荐答案

实际上,igraph假设中间度计算中边缘的权重是成本,而不是强度.这是因为(据我所知)中间性是根据最短路径定义的,并且图论中路径的长度"是所涉及的边的长度(权重)的总和. 基于优势的中间性"尚无明确定义.您可以尝试将优势"转换为成本,但是您会根据选择的转换而获得不同的结果,因为某些转换可能表明转换后的图中较短的一条特定路径,而另一些转换可能表明其他路径已转换较短.

Indeed, igraph assumes that the weights of the edges in betweenness calculation are costs, not strengths. This is because (as far as I know) betweenness is defined in terms of shortest paths, and the "length" of a path in graph theory is the sum of the lengths (weights) of the edges involved. There is no clear definition of "betweenness based on strengths". You can try to transform your "strengths" to costs, but you can get different results depending on the transformation you choose as some transformation may indicate that one particular path is shorter in the transformed graph and some other transformation may indicate that some other path is shorter.

这篇关于在iGraph中计算中间度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆