networksns.centrality_measures.total_network_communicability¶
- networksns.centrality_measures.total_network_communicability(G, t=1, tol=1e-07, maxit=50, normalized=False)¶
Computes the total network communicability of \(G\).
Total network communicability is defined as the sum over all elements 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 \(tnc = \mathbf{1}^T e^{tA} \mathbf{1}\).
Sometimes it could be useful to normalize the total network communicability by the number \(n\) of nodes in the graph to obtain the average total communicability of the network per node: \(\frac{\mathbf{1}^T e^{tA} \mathbf{1}}{n}\); this can be done by setting
normalized = True.- Parameters:
G (Graph object) – an undirected graph.
t (scalar, optional) – exponentiate multiply the adjacency matrix by t, default: 1.
tol (float,optional) – tolerance for convergence, relative accuracy, default: 1e-7.
maxit (integer, optional) – maximum number of Lanczos iterations, default: 50.
normalized (boolean) – If
Truedivide the total network communicability by the number of nodes of \(G\). Default:False.
- Returns:
tnc (float) total network communicability of graph \(G\).
Examples
>>> from networksns import centrality_measures as cm >>> import networkx as nx
Create graph \(G\).
>>> G = nx.Graph() >>> G.add_edge(1, 'u') >>> G.add_edge('u', 2) EdgeView([(1, 'u'), ('u', 2)])
Compute the total network communicability.
>>> tnc = cm.total_network_communicability(G)
References