networksns.centrality_measures.node_subgraph_centrality

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

Computes the subgraph centrality of node \(u\).

If node \(u\) is the \(i^{th}\) node of the graph, the subgraph centrality of node \(u\) is given by \([e^{tA}]_{ii}=e_i^T (e^{tA})e_i\), where \(e_i\) and \(A\) denote respectively the \(i^{th}\) vector of the canonical basis and the adjacency matrix of the graph [1].

Parameters:
  • G (Graph object) – a graph.

  • u (node_id) – node in G.

  • t (scalar, optional) – when exponentiating 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.

    return:

    sc_u (float) subgraph centrality of node \(u\).

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 node total communicability

>>>    sc_u = cm.node_subgraph_centrality(G, 'u')

References