edge_current_flow_betweenness_partition#
- edge_current_flow_betweenness_partition(G, number_of_sets, *, weight=None)[source]#
通过移除具有最高边介数流量的边来创建分区。
该算法通过计算所有边的边介数流量,并移除具有最高值的边来工作。然后确定图是否已被分割成至少
number_of_sets
个连通分量。如果没有,则重复此过程。- Parameters:
- GNetworkX 图、有向图或多重图
需要分区的图
- number_of_setsint
图分区中所需集合的数量
- weight键, 可选 (默认=None)
用作边介数流量计算权重的边属性键
- Returns:
- C集合列表
G的分区
- Raises:
- NetworkXError
如果 number_of_sets <= 0 或 number_of_sets > len(G)
See also
Notes
该算法非常慢,因为重新计算边介数流量极其缓慢。
References
[1]Santo Fortunato ‘Community Detection in Graphs’ Physical Reports Volume 486, Issue 3-5 p. 75-174 http://arxiv.org/abs/0906.0612
Examples
>>> G = nx.karate_club_graph() >>> part = nx.community.edge_current_flow_betweenness_partition(G, 2) >>> {0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 16, 17, 19, 21} in part True >>> {8, 14, 15, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33} in part True