My guess is that this a floating point rounding error bug in igraph. You
cannot represent 0.1 exactly on a computer (well, on most computers), and
this causes some problems. You also need multiple shortest paths between
some pairs for this to be a problem, which you do have I guess.

I am not sure how to fix this, though. I could probably fix this single
bug, but there are several similar bugs in igraph, I am sure.

G.


On Tue, May 28, 2013 at 6:24 PM, Guido Scarabelli <[email protected]> wrote:

> Hi everyone!
> I am using igraph version 0.6.5-2 with R (version 2.15.0) on a Linux
> machine.
>
> My question is: is it possible that the betweenness of the edges change if
> the weights of the network are scaled all by the same factor?
>
> In my case I started with a file containing the following adjacency matrix:
>
> 0  1  0  0  0
> 1  0  1  1  0
> 0  1  0  0  1
> 0  1  0  0  1
> 0  0  1  1  0
>
> and in the R session I used these commands to build the network (it has 5
> nodes and 5 edges):
>
> library(igraph)
> test.network <- data.matrix(read.table("matrix.dat"))
> test.graphic <-
> graph.adjacency(test.network,mode="undirected",weighted=TRUE,diag=FALSE)
>
> The command "edge.betweenness(test.graphic)" gives this output:
> 4.0 3.5 3.5 2.5 2.5
>
> Now, if I use the following matrix (I divided the weights all by 10):
>
> 0.0 0.1 0.0 0.0 0.0
> 0.1 0.0 0.1 0.1 0.0
> 0.0 0.1 0.0 0.0 0.1
> 0.0 0.1 0.0 0.0 0.1
> 0.0 0.0 0.1 0.1 0.0
>
> the command "edge.betweenness" gives this output:
> 4.00 2.25 3.75 2.25 3.75
>
> Also, if I divide by 100 the original matrix I get other edge betweenness
> values:
> 4 5 3 3 1
>
> I do not know what I am doing wrong, as I suppose the edge betweenness
> should not change if I scale all the weights of the edges by the same
> value...
> Does anyone have an idea?
> Thanks so much in advance for the help!
> Guido
>
> P.S. Counting by hand the betweenness values, the ones of the first matrix
> should be the correct ones.
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
>


-- 
Gabor Csardi <[email protected]>     MTA KFKI RMKI
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to