我正在尝试计算归一化的局部亲密度中心性。但是,为normalized = T
设置参数igraph::estimate_closeness()
只会将结果与(N-1)相乘。是否可以通过它的邻域单独定义顶点 i 的 N_i ,这是由截止参数(当然还有图形本身)决定的?
迷你示例演示了,设置参数normalized=T
不能用于此目的。对于所有顶点,它使用同一个(N-1)进行标准化。
感谢您的帮助。
set.seed(1210)
require('igraph')
g <- random.graph.game(20,3/10)
g <- set.edge.attribute(g, "weight", value= 1)
cnt <- estimate_closeness(g, cutoff = 3, normalized = T );cnt
cnf <- estimate_closeness(g, cutoff = 3, normalized = F );cnf
#print results
cbind(cnf * (length(V(g))-1), cnt)
sum(abs(cnf * (length(V(g))-1) - cnt))
#for visualization
V(g)$name <- paste("v", 1:length(V(g)), sep="")#letters[1:length(V(g))]
set.seed(2)
lay <- layout.auto(g)
## set plotting parameters
vs <- 15# vertex.size
ec <- gray(0.8)#edge.color
elx <- 2# edge.label.cex
elc <- "black"#,edge.label.color
vlc <- 2#vertex.label.cex
ew <- 2#edge.width
hd <- paste(rep(" ",0), collapse="")
cm <- 3
vc <- "orange"#gray(0.8)#palette("default")#"grey"#vertex.color
windows(width = 18, height=6)
par(mfrow=c(1,3))
plot(g, edge.label=paste(hd, round(E(g)$weight,1)), layout=lay, vertex.size=vs, edge.color=ec, edge.label.cex=elx, vertex.label.cex=vlc, edge.width=ew, edge.label.color=elc, vertex.color=vc)
title("(a) Weights", cex.main = cm)
V(g)$name <- paste(round(cnt,3))
plot(g, layout=lay, vertex.size=vs, edge.color=ec, edge.label.cex=elx, vertex.label.cex=vlc, edge.width=ew, edge.label.color=elc, vertex.color=vc)
title("(b) local closeness normalized", cex.main = cm)
V(g)$name <- paste(round(cnf,3))
plot(g, layout=lay, vertex.size=vs, edge.color=ec, edge.label.cex=elx, vertex.label.cex=vlc, edge.width=ew, edge.label.color=elc, vertex.color=vc)
title("(c) local closeness", cex.main = cm)