我不明白为什么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)处只有一个值。但是该图包含具有其他度数的节点,度数(TestG)的输出即为[1,3,2,4,2,2,0,0,0,0]。
发布于 2013-10-27 15:30:10
您必须修改degree.distribution函数。详情可以在下面的链接中找到。Can't replicate result with degree.distribution function of igraph
https://stackoverflow.com/questions/16153460
复制相似问题