igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] edge.betweenness returns negative or NaN values


From: Vincent Labatut
Subject: Re: [igraph] edge.betweenness returns negative or NaN values
Date: Sun, 13 Sep 2015 09:24:20 +0200

Hello Tamas,

and thanks for your answer.
I was thinking of something like that, since the networks are lattices and this case is mentionned in the documentation. 
I also had noticed the "nobigint" parameter for the "betweenness" functions, however it does not exist for the "edge.betweenness" functions.
Best,
Vincent

> Hello,
> 
> The negative values are most likely due to integer overflows (i.e. the
> betweenness score would be too large and the underlying variable in
> which igraph computes the betweenness score overflows). You can get
> around this by passing nobigint=FALSE to the edge betweenness call -
> it will make igraph use "big integers", which can hold arbitrarily
> large numbers at the expense of being somewhat slower.
> 
> As for the NaNs, it could be a bug, but let's see first whether the
> issue persists with nobigint=FALSE. If so, let us know and try to post
> a small example on which we could reproduce the issue with NaNs.
> 
> T.
> 
> 
> 
> On Sat, Sep 12, 2015 at 3:08 PM, Vincent Labatut
> <address@hidden> wrote:
>> Hello,
>>
>> I am processing the edge-betweenness of various networks using R igraph
>> version 7.1. Those are spatial networks (each node has a (x,y) position) and
>> I am using the "weight" option of the "edge.betweenness" function to take
>> the spatial distances into account. This spatial distance is stored in an
>> edge attribute called "dist".
>>
>> Here is the command I use:
>> edge.betweenness(graph=g, weights=E(g)$dist)
>>
>> However, for some of my networks, I get negative values, or even NaN. Here
>> are two examples, under the graphml format:
>> http://dx.doi.org/10.6084/m9.figshare.1540708
>> - scale=32.graphml
>> - scale=41.graphml
>>
>> For the first one, the first values returned by "edge.betweenness" are:
>>    [1] 1904887544.08 1904887544.08 1896303182.39 1951787568.72 1203043060.76
>>    [6] 1270869072.68  622780616.09  667964773.27  279064394.68  309184936.21
>>   [11]  135403467.81  155266075.94   51600202.02   60120695.31   21113003.39
>>   [16]   24783603.89    6275147.30    6937885.52    1347425.01    1002544.99
>>   [21]     150574.42    -327097.77    -711849.38   -1430744.36    -246214.20
>>   [26]    -602827.15    -230344.97    -484630.12    -297768.08    -492364.06
>>
>> For the second one, all the returned values are NaN.
>>
>> Note that all these weights are positive by definition. They even are
>> non-zero since no two nodes hold the same position, by construction. I also
>> checked this programmatically. Moreover, there are no multiple links, also
>> by construction (and I checked with "has.multiple").
>>
>> I was wondering if the negative or NaN values I get are due to me misusing
>> the function, or if this is a bug in igraph.
>>
>> Thanks,
>> Vincent Labatut
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>>

On Sat, Sep 12, 2015 at 3:08 PM, Vincent Labatut <address@hidden> wrote:
Hello,

I am processing the edge-betweenness of various networks using R igraph version 7.1. Those are spatial networks (each node has a (x,y) position) and I am using the "weight" option of the "edge.betweenness" function to take the spatial distances into account. This spatial distance is stored in an edge attribute called "dist".

Here is the command I use:
edge.betweenness(graph=g, weights=E(g)$dist)

However, for some of my networks, I get negative values, or even NaN. Here are two examples, under the graphml format: http://dx.doi.org/10.6084/m9.figshare.1540708
- scale=32.graphml
- scale=41.graphml

For the first one, the first values returned by "edge.betweenness" are:
   [1] 1904887544.08 1904887544.08 1896303182.39 1951787568.72 1203043060.76
   [6] 1270869072.68  622780616.09  667964773.27  279064394.68  309184936.21
  [11]  135403467.81  155266075.94   51600202.02   60120695.31   21113003.39
  [16]   24783603.89    6275147.30    6937885.52    1347425.01    1002544.99
  [21]     150574.42    -327097.77    -711849.38   -1430744.36    -246214.20
  [26]    -602827.15    -230344.97    -484630.12    -297768.08    -492364.06

For the second one, all the returned values are NaN.

Note that all these weights are positive by definition. They even are non-zero since no two nodes hold the same position, by construction. I also checked this programmatically. Moreover, there are no multiple links, also by construction (and I checked with "has.multiple").

I was wondering if the negative or NaN values I get are due to me misusing the function, or if this is a bug in igraph.

Thanks,
Vincent Labatut


reply via email to

[Prev in Thread] Current Thread [Next in Thread]