I'm writing a JavaScript library for calculating graph measurements such as degree centrality, eccentrality, closeness and betweenness.
In order to validate my library I use two exist applications Gephi and NodeXL to run calculation with them. The problem is I got what looks like different results.
I build simple graph:
(A) ----- (B)
| |
| |
(C) ----- (D)
Gephi gave those results:
A ecc=2 close=1.333 bet=0.5
B ecc=2 close=1.333 bet=0.5
C ecc=2 close=1.333 bet=0.5
D ecc=2 close=1.333 bet=0.5
NodeXL gave those results:
A close=0.25 bet=0.5
B close=0.25 bet=0.5
C close=0.25 bet=0.5
D close=0.25 bet=0.5
Note that NodeXL does not calculate eccentrality.
Which one is right?
Are the results really different?
I didn't normalize (or at least not intend to normalize) any results.
It seems that Gephi returns the average sum of all shortest paths between a node and all other nodes in the network (also stated in the doc)
for A this gives: (1 + 1 + 2)/3=1.333333
while NodeXL gives you the inverse sum of all shortest paths:
for A 1/(1+1+2)=0.25
So, I'd say the later is correct, as this is following the definition of closeness centrality. E.g. igraph also uses the second version.