考虑一个数据框
然后,为了针对
第三个 qplot 的输出与第一个没有任何区别。我做错了什么?
更新:
所以 graph.strength 是我要找的,但在我的情况下,graph.strength(g) 给出标准度数输出,然后是:
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
不同?
g$weights
查找名为“weights”的图形属性,而E(g)$weights
查找名为“weights”的边缘属性。顺便说一下,还有V(g)$weights
,它查找名为“weights”的顶点属性。 - Tamásgraph.strength
就像预期的那样工作了。为什么?它是先搜索图属性还是边属性? - mindless.pandagraph.strength
仅查找边缘属性。文档中说“如果图具有weight
边缘属性...”,所以我想这里需要一个边缘属性。 - Tamás