subgraph_centrality_exp(G)
Subgraph centrality of a node :None:None:`n`
is the sum of weighted closed walks of all lengths starting and ending at node :None:None:`n`
. The weights decrease with path length. Each closed walk is associated with a connected subgraph ().
This version of the algorithm exponentiates the adjacency matrix.
The subgraph centrality of a node :None:None:`u`
in G can be found using the matrix exponential of the adjacency matrix of G ,
If the graph is not undirected and simple.
Dictionary of nodes with subgraph centrality as the value.
Returns the subgraph centrality for each node of G.
subgraph_centrality
Alternative algorithm of the subgraph centrality for each node of G.
(Example from ) >>> G = nx.Graph( ... [ ... (1, 2), ... (1, 5), ... (1, 8), ... (2, 3), ... (2, 8), ... (3, 4), ... (3, 6), ... (4, 5), ... (4, 7), ... (5, 6), ... (6, 7), ... (7, 8), ... ] ... ) >>> sc = nx.subgraph_centrality_exp(G) >>> print([f"{node} {sc[node]:0.2f}" for node in sorted(sc)]) ['1 3.90', '2 3.90', '3 3.64', '4 3.71', '5 3.64', '6 3.71', '7 3.64', '8 3.90']
See :The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.centrality.subgraph_alg.subgraph_centrality
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them