This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.


eigenvector_centrality(G, max_iter=100, tol=1e-06, nstart=None, weight='weight')

Compute the eigenvector centrality for the graph G.

Uses the power method to find the eigenvector for the largest eigenvalue of the adjacency matrix of G.

Parameters :

G : graph

A networkx graph

max_iter : interger, optional

Maximum number of iterations in power method.

tol : float, optional

Error tolerance used to check convergence in power method iteration.

nstart : dictionary, optional

Starting value of eigenvector iteration for each node.

weight : None or string, optional

If None, all edge weights are considered equal. Otherwise holds the name of the edge attribute used as weight.

Returns :

nodes : dictionary

Dictionary of nodes with eigenvector centrality as the value.

See also

eigenvector_centrality_numpy, pagerank, hits


The eigenvector calculation is done by the power iteration method and has no guarantee of convergence. The iteration will stop after max_iter iterations or an error tolerance of number_of_nodes(G)*tol has been reached.

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(G)
>>> print(['%s %0.2f'%(node,centrality[node]) for node in centrality])
['0 0.37', '1 0.60', '2 0.60', '3 0.37']