networksns.centrality_measures.total_communicability¶
- networksns.centrality_measures.total_communicability(G, t=1)¶
Computes the total communicability of all the nodes of a graph \(G\).
Total communicability is defined as the row sums of the exponential of the adjacency matrix [1], so denoting with \(A\) the adjacency matrix of graph \(G\) and with \(\mathbf{1}\) the vector of all ones, we have \(tc= e^{tA} \mathbf{1}\).
- Parameters:
G (Graph or DiGraph object) – a graph.
t (scalar, optional) – when exponentiating multiply the adjacency matrix by \(t\), default 1.
- Returns:
tc (dict) total communicability of all the nodes of \(G\).
Examples
>>> from networksns import centrality_measures as cm >>> import networkx as nx
Create graph \(G\).
>>> G = nx.Graph() >>> G.add_edge(1, 2) >>> G.add_edge(2, 3) EdgeView([(1, 2), (2, 3)])
Compute \(tc= e^A \mathbf{1}\).
>>> tc = cm.total_communicability(G)
References