考虑一个数据框df
,其中前两列是节点对,连续列V1
, V2
, ...Vn
表示节点之间的流(可能为 0,表示该列的网络没有边)。我想使用流作为权重对程度、社区检测和其他网络度量进行分析。
V1
然后根据我的权重分析图表:
# create graph and explore unweighted degrees with respect to V1
g <- graph.data.frame( df[df$V1!=0,] )
qplot(degree(g))
x <- 0:max(degree(g))
qplot(x,degree.distribution(g))
# set weights and explore weighted degrees using V1
E(g)$weights <- E(g)$V1
qplot(degree(g))
第三个 qplot 的输出与第一个没有什么不同。我究竟做错了什么?
更新:
我graph.strength
正在寻找的也是如此,但graph.strength(g)
在我的情况下,给出标准学位输出,然后是:
Warning message:
In graph.strength(g) :
At structural_properties.c:4928 :No edge weights for strength calculation,
normal degree
我必须错误地设置权重,这样做还不够吗?E(g)$weights <- E(g)$V1
为什么会g$weights
有所不同E(g)$weights
?