networkx.algorithms.connectivity.kcomponents.k_components
的用法。用法:
k_components(G, flow_func=None)
返回圖 G 的 k-component 結構。
k
- 組件是圖 G 的最大子圖,它至少具有節點連接性k
:我們需要至少刪除k
節點才能將其分解為更多組件。k
- 組件具有固有的層次結構,因為它們在連接性方麵是嵌套的:連接圖可以包含多個 2 組件,每個組件都可以包含一個或多個 3 組件,依此類推。- G:NetworkX 圖
- flow_func:函數
執行底層流計算的函數。默認值
edmonds_karp()
。此函數在具有右尾度分布的稀疏圖中表現更好。shortest_augmenting_path()
在更密集的圖中表現更好。
- k_components:dict
字典,輸入圖表中的所有連接級別
k
作為鍵,形成級別k
的 k-component 的節點集列表作為值。
- NetworkXNotImplemented
如果輸入圖是有向的。
參數:
返回:
拋出:
注意:
Moody 和 White [1](附錄 A)提供了一種識別圖中 k-components 的算法,該算法基於 Kanevsky 算法 [2],用於查找圖中的所有 minimum-size 節點 cut-sets(在
all_node_cuts()
中實現)函數):計算輸入圖 G 的節點連通性 k。
使用 Kanevsky 算法識別當前連接級別的所有k-cutsets。
基於刪除這些割集生成新的圖組件。割集中的節點屬於誘導割的兩側。
如果圖既不完整也不平凡,返回1;否則結束。
此實現還使用一些啟發式方法(有關詳細信息,請參閱[3])來加速計算。
參考:
- 1
Moody, J. and D. White (2003). Social cohesion and embeddedness: A hierarchical conception of social groups. American Sociological Review 68(1), 103-28. http://www2.asanet.org/journals/ASRFeb03MoodyWhite.pdf
- 2
Kanevsky, A. (1993). Finding all minimum-size separating vertex sets in a graph. Networks 23(6), 533-541. http://onlinelibrary.wiley.com/doi/10.1002/net.3230230604/abstract
- 3
Torrents, J. and F. Ferraro (2015). Structural Cohesion: Visualization and Heuristics for Fast Computation. https://arxiv.org/pdf/1503.04476v1
例子:
>>> # Petersen graph has 10 nodes and it is triconnected, thus all >>> # nodes are in a single component on all three connectivity levels >>> G = nx.petersen_graph() >>> k_components = nx.k_components(G)
相關用法
- Python NetworkX k_components用法及代碼示例
- Python NetworkX k_clique_communities用法及代碼示例
- Python NetworkX k_edge_components用法及代碼示例
- Python NetworkX k_edge_augmentation用法及代碼示例
- Python NetworkX k_edge_subgraphs用法及代碼示例
- Python NetworkX katz_centrality用法及代碼示例
- Python NetworkX kamada_kawai_layout用法及代碼示例
- Python NetworkX katz_centrality_numpy用法及代碼示例
- Python NetworkX kosaraju_strongly_connected_components用法及代碼示例
- Python NetworkX karate_club_graph用法及代碼示例
- Python NetworkX negative_edge_cycle用法及代碼示例
- Python NetworkX voronoi_cells用法及代碼示例
- Python NetworkX numerical_edge_match用法及代碼示例
- Python NetworkX inverse_line_graph用法及代碼示例
- Python NetworkX LFR_benchmark_graph用法及代碼示例
- Python NetworkX write_graph6用法及代碼示例
- Python NetworkX DiGraph.__contains__用法及代碼示例
- Python NetworkX average_degree_connectivity用法及代碼示例
- Python NetworkX eulerian_circuit用法及代碼示例
- Python NetworkX single_source_dijkstra_path_length用法及代碼示例
- Python NetworkX from_dict_of_dicts用法及代碼示例
- Python NetworkX weisfeiler_lehman_subgraph_hashes用法及代碼示例
- Python NetworkX transitive_closure_dag用法及代碼示例
- Python NetworkX intersection用法及代碼示例
- Python NetworkX MultiGraph.size用法及代碼示例
注:本文由純淨天空篩選整理自networkx.org大神的英文原創作品 networkx.algorithms.connectivity.kcomponents.k_components。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。