communicability_exp#
- communicability_exp(G)[source]#
Returns communicability between all pairs of nodes in
G.Communicability between pair of node
(u, v)of node inGis the sum of walks of different lengths starting at nodeuand ending at nodev.- Parameters:
- Ggraph
- Returns:
- commdictionary 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
communicabilityCommunicability between pairs of nodes in
Gvia spectral decompositioncommunicability_betweenness_centralityCommunicability betweenness centrality for each node in G.
Notes
This algorithm uses matrix exponentiation 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
uandvis:\[C(u,v) = (e^A)_{uv},\]where
Ais the adjacency matrix ofG[1].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_exp(G)