首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >R图形degree.distribution不工作

R图形degree.distribution不工作
EN

Stack Overflow用户
提问于 2013-04-23 01:47:37
回答 1查看 1.8K关注 0票数 7

我不明白为什么degree.distribution不能为我工作。我尝试过R i386 3.0.0和R x64 3.0.0。下面是生成图形并显示其分布的简单脚本:

代码语言:javascript
复制
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]

EN

回答 1

Stack Overflow用户

发布于 2013-10-27 15:30:10

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16153460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档