networkx.algorithms.communicability_alg.communicability¶
- communicability(G)[source]¶
Returns communicability between all pairs of nodes in G.
The communicability between pairs of nodes in G is the sum of walks of different lengths starting at node u and ending at node v.
- Parameters
- G: graph
- Returns
- comm: dictionary of dictionaries
Dictionary of dictionaries keyed by nodes with communicability as the value.
- Raises
- NetworkXError
If the graph is not undirected and simple.
See also
communicability_expCommunicability between all pairs of nodes in G using spectral decomposition.
communicability_betweenness_centralityCommunicability betweeness centrality for each node in G.
Notes
This algorithm uses a spectral decomposition of the adjacency matrix. Let G=(V,E) be a simple undirected graph. Using the connection between the powers of the adjacency matrix and the number of walks in the graph, the communicability between nodes
uandvbased on the graph spectrum is [1]\[C(u,v)=\sum_{j=1}^{n}\phi_{j}(u)\phi_{j}(v)e^{\lambda_{j}},\]where
phi_{j}(u)is theurm{th}element of thejrm{th}orthonormal eigenvector of the adjacency matrix associated with the eigenvaluelambda_{j}.References
- 1
Ernesto Estrada, Naomichi Hatano, “Communicability in complex networks”, Phys. Rev. E 77, 036111 (2008). https://arxiv.org/abs/0707.0756
Examples
>>> G = nx.Graph([(0, 1), (1, 2), (1, 5), (5, 4), (2, 4), (2, 3), (4, 3), (3, 6)]) >>> c = nx.communicability(G)