networksns.centrality_measures.node_total_directed_communicability¶
- networksns.centrality_measures.node_total_directed_communicability(G, u, t=1, tol=1e-07, maxit=50)¶
Computes the total hub and authority communicability of node \(u\).
If node \(u\) is the \(i^{th}\) node of the graph, denoting with \(A\) the adjacency matrix of \(G\), with \(\mathcal{A}=\begin{pmatrix} 0 & A \\ A^T & 0 \end{pmatrix}\) the adjacency matrix of the associated undirected bipartite graph, with \(\sinh^{\diamondsuit}\) the generalized hyperbolic sine and with \(\mathbf{0}\), \(\mathbf{1}\), \(\mathbf{e_i}\) the vectors of all zeros, of all ones and of all zeros except for a \(1\) in position \(i\) respectively, the total hub communicability of \(u\) and the total authority communicability of \(u\) are defined as
\(T_{h}C(u) = \mathbf{e_i}^T\sinh^{\diamondsuit}(A)\mathbf{1} = \begin{pmatrix} \mathbf{e_i}^T & \mathbf{0}^T \end{pmatrix} e^{\mathcal{A}}\begin{pmatrix} \mathbf{0} \\ \mathbf{1} \end{pmatrix},\) \(T_{a}C(u) = \mathbf{e_i}^T\sinh^{\diamondsuit}(A)^T\mathbf{1} = \begin{pmatrix} \mathbf{0}^T & \mathbf{e_i}^T \end{pmatrix} e^{\mathcal{A}}\begin{pmatrix} \mathbf{1} \\ \mathbf{0} \end{pmatrix}.\)
See [1] for further details.
- Parameters:
G (DiGraph object) – a directed graph.
u (node_id) – node in \(G\).
t (scalar, optional) – when computing the total hub and authority communicabilities of \(u\) 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.
- Returns:
thc – total hub communicability of \(u\).
- Return type:
float
tac: float
total authority communicability of \(u\).
Examples
>>> from networksns import centrality_measures as cm >>> import networkx as nx
Create graph \(G\)
>>> G = nx.DiGraph() >>> G.add_edge(1, 2) >>> G.add_edge(1, 3) >>> G.add_edge(2, 3) >>> G.add_edge(3, 1) OutEdgeView([(1, 2), (1, 3), (2, 3), (3, 1)])
Compute total hub and authority communicabilities of node 1
>>> thc, tac = cm.node_total_directed_communicability(G, 1)
References