rustworkx.graph_edge_betweenness_centrality#

graph_edge_betweenness_centrality(graph, /, normalized=True, parallel_threshold=50)#

计算PyGraph中所有边的边介数中心性。

边的中介中心性 \(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\) 的这些路径的数量。

以上定义和该函数使用的算法基于:

Ulrik Brandes, 关于最短路径中介中心性的变体及其通用计算. 社交网络 30(2):136-145, 2008.

此函数是多线程的,如果图中节点数超过parallel_threshold的值(默认为50),它将并行运行。如果函数将并行运行,可使用环境变量RAYON_NUM_THREADS来调整将使用的线程数。

更多相关内容请参阅#

graph_betweenness_centrality()

param PyGraph graph:

输入图

param bool normalized:

是否通过对所有节点对之间的不同路径数量来标准化中介中心性分数。

param int parallel_threshold:

要并行计算中介中心性的节点数量,如果图中的节点数低于此值,将以单线程运行。默认值为50

returns:

一个只读字典式对象,其键为边的索引,值为每条边的中介中心性分数。

rtype:

EdgeCentralityMapping