Search code examples
graphnetworkxnode-centrality

Networkx Information Centrality


I have a network graph which I want to calculate information centrality for. I used the networkx python package but had a problem.

My code is:

G = nx.read_edgelist('GraphEdge_2011.txt', create_using=nx.DiGraph, delimiter=",", nodetype=int) info = nx.information_centrality(G, weight=None, dtype='float', solver='lu')

I got an error message: NetworkXNotImplemented: not implemented for directed type.

My graph shouldn't have any direction. Why do I get this error message and how should I solve it?


Solution

  • You created a directed graph using nx.DiGraph. You can make it an undirected graph by changing that to nx.Graph.