- eigenvector_centrality_numpy(G, weight='weight')¶
Compute the eigenvector centrality for the graph G.
G : graph
A networkx graph
weight : None or string, optional
The name of the edge attribute used as weight. If None, all edge weights are considered equal.
nodes : dictionary
Dictionary of nodes with eigenvector centrality as the value.
eigenvector_centrality, pagerank, hits
This algorithm uses the SciPy sparse eigenvalue solver (ARPACK) to find the largest eigenvalue/eigenvector pair.
For directed graphs this is “left” eigevector centrality which corresponds to the in-edges in the graph. For out-edges eigenvector centrality first reverse the graph with G.reverse().
>>> G = nx.path_graph(4) >>> centrality = nx.eigenvector_centrality_numpy(G) >>> print(['%s %0.2f'%(node,centrality[node]) for node in centrality]) ['0 0.37', '1 0.60', '2 0.60', '3 0.37']