edge_betweenness_centrality#
- edge_betweenness_centrality(G, k=None, normalized=True, weight=None, seed=None)[来源]#
计算边的介数中心性。
边 \(e\) 的介数中心性是所有节点对之间通过 \(e\) 的最短路径的比例之和。
\[c_B(e) =\sum_{s,t \in V} \frac{\sigma(s, t|e)}{\sigma(s, t)}\]其中 \(V\) 是节点集,\(\sigma(s, t)\) 是节点对 \((s, t)\) 之间的最短路径数量,\(\sigma(s, t|e)\) 是通过边 \(e\) 的这些路径的数量 [2]。
- 参数:
- Ggraph
一个 NetworkX 图。
- kint, optional (default=None)
如果 k 不是 None,则使用 k 个节点样本来估计介数。k 的值小于等于图中的节点数量 n。值越大,近似效果越好。
- normalizedbool, optional
如果为 True,则介数中心性值将对于图通过 \(2/(n(n-1))\) 进行归一化,对于有向图通过 \(1/(n(n-1))\) 进行归一化,其中 \(n\) 是 G 中的节点数量。
- weightNone or string, optional (default=None)
如果为 None,则所有边权重相等。否则,它是用作权重的边属性名称。权重用于计算加权最短路径,因此被解释为距离。
- seedinteger, random_state, or None (default)
随机数生成状态的指示器。请参见 随机性。注意,这仅在 k 不是 None 时使用。
- 返回:
- edgesdictionary
以边为键、介数中心性为值的字典。
另请参见
betweenness_centrality
edge_load
注意
该算法来自 Ulrik Brandes [1]。
对于加权图,边权重必须大于零。零边权重可能在节点对之间产生无限多条等长路径。
参考文献
[1]A Faster Algorithm for Betweenness Centrality. Ulrik Brandes, Journal of Mathematical Sociology 25(2):163-177, 2001. https://doi.org/10.1080/0022250X.2001.9990249
[2]Ulrik Brandes: On Variants of Shortest-Path Betweenness Centrality and their Generic Computation. Social Networks 30(2):136-145, 2008. https://doi.org/10.1016/j.socnet.2007.11.001