0

I have an undirected network that I am working with in Igraph with weighted edges.

For a particular graph out, I can calculate communities in Igraph using the function edge.betweenness.community and the betweenness of each edge by using edge.betweenness.

I can tell igraph to include the weights of each edge by writing the following:

largest <- which.max(sapply(modules, vcount))
out <- modules[largest][[1]]
bt <- edge.betweenness(out, weights = E(out)$value, directed = FALSE)

Returning:

bt
 [1] 20.0 11.0 27.0 11.0  8.0 12.0  8.0  8.5  7.5  6.0  3.0  3.0  7.0  8.5  7.5  4.0 11.0

Where the weights are:

E(out)$value
 [1] 0.2829 0.2880 0.2997 0.1842 0.2963 0.2714 0.2577 0.2850 0.2850 0.2577 0.2305 0.2305 0.2577 0.1488 0.1488 0.1215 0.2997

The weights in this case have limits 0 - 1, where 1 = highest cost to traverse an edge, 0 = lowest cost. However, these limits do not get passed to igraph in any of the betweenness calculations.

My question: How does igraph evaluate the lower and upper limits of the listed weights in terms of normalisation?

Does it automatically scale the weights based on the min and max values of the specified weights? (in this case min = 0.1215, max = 0.2997)

What I want: How do I tell it to take the true limits of the full data set (min=0 - max=1) into account?


Additional Information:

If I multiply the weights E(out)$value by some constant and recalculate the betweenness, I get a similar answer (I assume there is some floating error and they are in fact the same):

new_weights <- as.numeric(E(out)$value*2.5)
new_weights
 [1] 0.70725 0.72000 0.74925 0.46050 0.74075 0.67850 0.64425 0.71250 0.71250 0.64425 0.57625 0.57625 0.64425 0.37200 0.37200 0.30375 0.74925
bt <- edge.betweenness(out, weights = new_weights, directed = FALSE)

Giving:

bt
 [1] 20 11 27 11  8 12  8  8  8  6  3  3  7  8  8  4 11

This implies there is some auto scaling going on:

With this in mind, how do I manually scale the betweenness calculation to my required limits of 0 and 1?


Research:

Edit 4 Jun2 2016 -

I have tried to review the source code for edge.betweenness on the igraph R Github page https://github.com/igraph/rigraph/tree/dev/R

The closest function I could find was cluster_edge_betweenness at https://github.com/igraph/rigraph/blob/dev/R/community.R

This function make a call to the C function C_R_igraph_community_edge_betweenness. The closest reference to this I could find in the igraph C documentation is igraph_community_edge_betweenness at https://github.com/igraph/igraph/blob/master/include/igraph_community.h

Neither of these links however makes any reference to how the limits of the weights are calculated.

Original Research:

I have looked through the igraph documentation on betweenness algorithms, and explored other questions related to normalisation, but have found nothing that deals specifically with the normalisation of the weights themselves.

Modularity calculation for weighted graphs in igraph

Calculation of betweenness in iGraph

http://igraph.org/r/doc/betweenness.html


The network data and visualisation are as follows:

plot(out)

Weighted Graph

get.data.frame(out)
   from   to  value sourceID targetID
1    74   80 0.2829   255609   262854
2    74   61 0.2880   255609   179585
3    80 1085 0.2997   262854  3055482
4  1045 1046 0.1842  2970629  2971615
5  1046 1085 0.2963  2971615  3055482
6  1046 1154 0.2714  2971615  3087803
7  1085 1154 0.2577  3055482  3087803
8  1085 1187 0.2850  3055482  3101131
9  1085 1209 0.2850  3055482  3110186
10 1154 1243 0.2577  3087803  3130848
11 1154 1187 0.2305  3087803  3101131
12 1154 1209 0.2305  3087803  3110186
13 1154 1244 0.2577  3087803  3131379
14 1243 1187 0.1488  3130848  3101131
15 1243 1209 0.1488  3130848  3110186
16 1243 1244 0.1215  3130848  3131379
17 1243 1281 0.2997  3130848  3255811

(The weights in this case are in the frame$value column with limits 0 - 1, where 1 = highest cost to traverse an edge, 0 = lowest cost)

Chuck
  • 3,664
  • 7
  • 42
  • 76
  • The weights are used to calculate weighted shortest paths between all pairs of vertices, and then the weighted shortest paths are used to define the weighted edge betweenness. There is no scaling involved. I am not sure what you want to scale and why. – Gabor Csardi Jun 05 '17 at 11:44
  • Hi @GaborCsardi - many thanks for your comment. My question regarding scaling is as follows: For some cluster/graph I may have 4 nodes with weights 0.5, 0.6, 0.7, 0.8, where the weight range is between 0 and 1 (i.e. highest / lowest cost is 1 / 0). When calculating weighted betweenness, how can I tell igraph that my limits are 0 and 1, NOT 0.5 and 0.8? Surely this information will affect how igraph interprets the relative weights of each edge? – Chuck Jun 05 '17 at 11:51
  • It does not matter what the limits are. The algorithm does not use the limits. – Gabor Csardi Jun 05 '17 at 15:54
  • @GaborCsardi Ok, let's say we have two unconnected separate clusters that have come from a larger graph. Each cluster has a set of weights associated with it (that are different, e.g. 0.1, 0.2, 0.3, 0.4 for one, and 0.5, 0.6, 0.7, 0.8 for the other (where the min and max in 0 and 1 for each) If these limits are not used when calculating betweenness, how is one to compare these two clusters ensuring normalization and standardization across both? I would have thought (perhaps naively) that the calculations are not normalised without including limits? – Chuck Jun 05 '17 at 15:59
  • Luckily, betweenness has a more or less standard definition: the CB(v) formula here: https://en.wikipedia.org/wiki/Centrality#Betweenness_centrality This is what igraph calculates IMO. – Gabor Csardi Jun 05 '17 at 18:26

0 Answers0