图形半径和直径 [英] igraph radius and diameter
问题描述
我在使用igraph函数时遇到了一个奇怪的问题
I'm having a strange problem with igraph functions
我有一个无向图(N = 423),密度很高(0.4).为了测试我从igraph获得的值,我使用Gephi.
I have an undirected graph(N=423) with very high density (0.4). In order to test the values I'm getting from igraph I'm using Gephi.
我已经与Gephi核对过,他们都报告了度数和直径相同 但是igraph报告半径和偏心率完全错误,应该是更高的值.还有,半径总是小于直径吧?这是更大的:)
I've checked with Gep and they both report degree and diameter the same but igraph reports radius and eccentricity completely wrong, much higher values that they should be. Also, radius is always smaller than diameter right? And here it is larger :)
> sg <- simplify(graph.edgelist(edges, directed=F))
> radius(sg)
[1] 8
> diameter(sg)
[1] 3
head(eccentricity(sg))
[1] 10 11 10 12 11 14
> str(sg)
IGRAPH U--- 423 41064 --
+ edges:
1 -- 3 4 6 8 9 15 25 26 28 30 37 38 41 42 47 48 49 50 53 58 63 66 68 69 71 72 76 81 83 87 88 90 95
....etc...
....etc...
Gephies偏心率值分别为2s和3s,因为直径为3:)
Gephies eccentricity values are all 2s and 3s which is expected since diameter is 3 :)
我不明白自己在做什么.
I can not understand what I'm doing wrong.
推荐答案
似乎是eccentricity
例程中的错误(radius
只是调用eccentricity
,因此这两个问题很可能是相关的).解决方法是,可以使用shortest.paths
(似乎工作正常),然后采用逐行最大值来获取偏心率得分.半径只是最小的偏心距.
Seems to be a bug in the eccentricity
routine (radius
just calls eccentricity
so the two issues are likely to be related). As a workaround, you can use shortest.paths
(which seems to be working correctly) and then take the row-wise maximum to get the eccentricity scores. The radius is just the minimum eccentricity.
更新:您可以在此处跟踪错误报告的进度.
这篇关于图形半径和直径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!