Vitomir Kovanovic
Vitomir Kovanovic

Reputation: 421

igraph radius and diameter

I'm having a strange problem with igraph functions

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.

I've checked with Gephi, 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 eccentricity values are all 2s and 3s which is expected since diameter is 3 :)

I can not understand what I'm doing wrong.

Upvotes: 0

Views: 1313

Answers (1)

Tam&#225;s
Tam&#225;s

Reputation: 48101

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.

Update: you can follow the progress of the bug report here.

Upvotes: 3

Related Questions