Imagine that I want to calculate closeness centrality for vertex i, and there are several vertices that are connected to i, but there is also an isolated vertex j in the graph. Then, according to the documentation, when calculating the summation of distances, for j the total number of vertices is used in the formula. I would expect that a zero should be used because j should be excluded in the calculation.

Does anybody know why total number of vertices is used and zero is not used in this case?

What can I do if I want to use zero in the formula? Maybe there is a workaround?

Thanks for any help!

igraph R manual pages

The justification for using the number of vertices was that this was greater than the largest possible path length in the graph. However, in my opinion this was an ad-hoc choice.

The behaviour has already been changed in C/igraph 0.9 and will eventually propagate to the R interface. See the C/igraph documentation for how this will work in the future: igraph Reference Manual

In my opinion, the real answer to your issue is that closeness centrality makes no sense for disconnected graphs. You may come with up some kind of generalization to the disconnected case, but you will need to consider very careful how that alternative “closeness” measure can be interpreted, and whether it even fits your use case.

Using a zero distance is not the same as excluding `j`

: adding a zero to a list of numbers *does* change the mean of the list.

To exclude `j`

, you can remove it from the graph.