gpt4 book ai didi

R图度数分布不起作用

转载 作者:行者123 更新时间:2023-12-04 12:55:01 26 4
gpt4 key购买 nike

我不明白为什么 degree.distribution不适合我。我试过 R i386 3.0.0 和 R x64 3.0.0。这是生成图形并显示其分布的简单脚本:

library(igraph)

testG = graph.empty(n=10, directed=TRUE)
for(row in 1 : 5) {
src = row
dest = row + 1
testG = add.edges(testG, rbind(src, as.numeric(dest)))
if(row %% 2 == 0) {
dest = row + 2
testG = add.edges(testG, rbind(src, as.numeric(dest)))
}
}
testG

testD = degree.distribution(testG, v=V(testG), cumulative=FALSE)
testD
plot(1 : length(testD), testD, "h", main="Website Graph Degree Distribution", xlab="Degree", ylab="Probability of Degree")
degree(testG)

testG 显示: IGRAPH D--- 10 7 -- (说得通)。
testD 显示: NULL (为什么?)。
该图在 (1,1) 处只有一个值。但是该图包含具有其他度数的节点,正如 degree(testG) 的输出所证明的那样,即 [1,3,2,4,2,2,0,0,0,0] .

最佳答案

您必须修改 degree.distribution 函数。详细信息可以在以下链接中找到。
Can't replicate result with degree.distribution function of igraph

关于R图度数分布不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16153460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com