Skip to content

Add closeness vitality to python- igraph #144

Open
@virajparimi

Description

@virajparimi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    wishlistFeature request that has not been chosen for implementation yet; vote or comment to prioritize it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions