我的功能有问题
edge_betweenness()
igraph包
该函数应计算betwenness中心度 的边缘。当我添加边缘权重时,边缘的betwenness之和(例如所有边缘betwenness的总和) 相对于在同一二元图上计算的边缘宽度的变化。 这应该是不正确的,因为最短路径的总数 节点之间应该相同。
我试图计算在相同图形上引入边缘权重但函数结果不正确的边缘宽容度。
g<-erdos.renyi.game(100,type="gnm",200)
Wmax<-1
vett<-sample(c(1,Wmax),length(E(g)),r=T,prob=c(0.5,0.5)) ##uniform distribution## 2 values uniform
E(g)$weight<-vett
##edge betwennes over the binary graph
b1<-edge_betweenness(g, e = E(g), directed = F, weights = E(g)$weight)
Wmax<-100
vett<-sample(c(1,Wmax),length(E(g)),r=T,prob=c(0.5,0.5)) ##uniform distribution## 2 values uniform
E(g)$weight<-vett
##edge betwennness over the weighted graph (weight are 1 or 100)
b100<-edge_betweenness(g, e = E(g), directed = F, weights = E(g)$weight)
##IF I sum the edge betwenness they differ
sum(b1)
# [1] 15834
sum(b100)
# [1] 25718
二进制和加权边缘的宽度不同,但是总和应该相同(在同一张图中,关于边缘权重的变化,最短路径数是一个保守值)。