NetworkX

Previous topic

networkx.algorithms.centrality.current_flow_betweenness.edge_current_flow_betweenness_centrality

Next topic

networkx.eigenvector_centrality_numpy

networkx.eigenvector_centrality

eigenvector_centrality(G, max_iter=100, tol=9.9999999999999995e-07, nstart=None)

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.

Returns:

nodes : dictionary

Dictionary of nodes with eigenvector centrality as the value.

Notes

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 “right” eigevector centrality. For “left” eigenvector centrality, first reverse the graph with G.reverse().

Examples

>>> 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']