eigenvector_centrality_numpy(G, weight=None, max_iter=50, tol=0)
Eigenvector centrality computes the centrality for a node based on the centrality of its neighbors. The eigenvector centrality for node $i$ is
$$Ax = \lambda x$$where $A$ is the adjacency matrix of the graph G with eigenvalue $\lambda$. By virtue of the Perron–Frobenius theorem, there is a unique and positive solution if $\lambda$ is the largest eigenvalue associated with the eigenvector of the adjacency matrix $A$ ().
The measure was introduced by .
This algorithm uses the SciPy sparse eigenvalue solver (ARPACK) to find the largest eigenvalue/eigenvector pair.
For directed graphs this is "left" eigenvector centrality which corresponds to the in-edges in the graph. For out-edges eigenvector centrality first reverse the graph with G.reverse()
.
A networkx graph
The name of the edge attribute used as weight. If None, all edge weights are considered equal. In this measure the weight is interpreted as the connection strength.
Maximum number of iterations in power method.
Relative accuracy for eigenvalues (stopping criterion). The default value of 0 implies machine precision.
If the graph G
is the null graph.
Dictionary of nodes with eigenvector centrality as the value.
Compute the eigenvector centrality for the graph G.
>>> G = nx.path_graph(4)See :
... centrality = nx.eigenvector_centrality_numpy(G)
... print([f"{node} {centrality[node]:0.2f}" for node in centrality]) ['0 0.37', '1 0.60', '2 0.60', '3 0.37']
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.centrality.eigenvector.eigenvector_centrality
networkx.algorithms.centrality.katz.katz_centrality
networkx.algorithms.centrality.eigenvector.eigenvector_centrality_numpy
networkx.algorithms.centrality.katz.katz_centrality_numpy
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them