networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
edge_betweenness_centrality(G, k=None, normalized=True, weight=None, seed=None)

Betweenness centrality of an edge $e$ is the sum of the fraction of all-pairs shortest paths that pass through $e$

$$c_B(e) =\sum_{s,t \in V} \frac{\sigma(s, t|e)}{\sigma(s, t)}$$

where $V$ is the set of nodes, $\sigma(s, t)$ is the number of shortest $(s, t)$-paths, and $\sigma(s, t|e)$ is the number of those paths passing through edge $e$ .

Notes

The algorithm is from Ulrik Brandes .

For weighted graphs the edge weights must be greater than zero. Zero edge weights can produce an infinite number of equal length paths between pairs of nodes.

Parameters

G : graph

A NetworkX graph.

k : int, optional (default=None)

If k is not None use k node samples to estimate betweenness. The value of k <= n where n is the number of nodes in the graph. Higher values give better approximation.

normalized : bool, optional

If True the betweenness values are normalized by $2/(n(n-1))$ for graphs, and $1/(n(n-1))$ for directed graphs where $n$ is the number of nodes in G.

weight : None or string, optional (default=None)

If None, all edge weights are considered equal. Otherwise holds the name of the edge attribute used as weight. Weights are used to calculate weighted shortest paths, so they are interpreted as distances.

seed : integer, random_state, or None (default)

Indicator of random number generation state. See Randomness<randomness> . Note that this is only used if k is not None.

Returns

edges : dictionary

Dictionary of edges with betweenness centrality as the value.

Compute betweenness centrality for edges.

See Also

betweenness_centrality
edge_load

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.centrality.current_flow_betweenness.current_flow_betweenness_centrality networkx.algorithms.centrality.current_flow_betweenness.edge_current_flow_betweenness_centrality networkx.algorithms.centrality.betweenness.betweenness_centrality networkx.algorithms.centrality.current_flow_betweenness_subset.edge_current_flow_betweenness_centrality_subset networkx.algorithms.centrality.betweenness_subset.betweenness_centrality_subset networkx.algorithms.centrality.current_flow_betweenness_subset.current_flow_betweenness_centrality_subset

Local connectivity graph

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


GitHub : /networkx/algorithms/centrality/betweenness.py#150
type: <class 'function'>
Commit: