networksns.centrality_measures.node_directed_subgraph_centrality

networksns.centrality_measures.node_directed_subgraph_centrality(G, u, t=1, tol=1e-07, maxit=50)

Computes the hub and the authority centrality 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 \(\mathbf{0}\) and \(e_i\) the vector of all zeros and the \(i^{th}\) vector of the canonical basis , hub centrality and authority centrality of the \(i^{th}\) node of \(G\) are defined as

\(\phantom{aaaaaaa} h_i(G) = [e^\mathcal{A}]_{ii} = e_i^T\cosh{\left(\sqrt{A A^T}\right)}e_i = \begin{pmatrix} e_i^T & \mathbf{0}^T \end{pmatrix} e^{\mathcal{A}}\begin{pmatrix} e_i \\ \mathbf{0} \end{pmatrix}\), \(\phantom{aaaaa}a_i(G) = [e^\mathcal{A}]_{N+i N+i} = e_i^T\cosh{\left(\sqrt{A^T A}\right)}e_i = \begin{pmatrix} \mathbf{0}^T & e_i^T \end{pmatrix} e^{\mathcal{A}}\begin{pmatrix} \mathbf{0} \\ e_i \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 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:

  • hc_u (dict) – hub centrality of \(u\)..

  • ac_u (dict) – authority centrality 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 hub and authority centrality.

>>>    hc, ac = cm.directed_subgraph_centrality(G)

References