Open
Description
It is metric that is implemented in python, in networkx
It has also been added as an additional feature request in r-igraph here.
I have written a small function for the same purpose. Can you review it and tell if it needs further improvement.
def closenessVitality(graph):
temp = np.matrix(graph.shortest_paths_dijkstra(mode = 3))
initial = temp[temp != np.inf].sum()
closeness_vitality = []
for i in range(graph.vcount()):
tempGraph = graph.copy()
tempGraph.delete_vertices(i)
vertex_cont = np.matrix(tempGraph.shortest_paths_dijkstra(mode = 3))
closeness_vitality.append(initial - vertex_cont[vertex_cont != np.inf].sum())
return closeness_vitality