當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python NetworkX k_clique_communities用法及代碼示例

本文簡要介紹 networkx.algorithms.community.kclique.k_clique_communities 的用法。

用法:

k_clique_communities(G, k, cliques=None)

使用滲透法在圖中找到k-clique 社區。

k-clique 社區是可以通過相鄰(共享 k-1 個節點)k-cliques 到達的所有大小為 k 的集團的聯合。

參數

GNetworkX 圖
kint

最小集團規模

cliques: list or generator

預先計算的集團(使用 networkx.find_cliques(G))

返回

產生節點集,每個k-clique 社區一個。

參考

1

Gergely Palla, Imre Derényi, Illés Farkas1, and Tamás Vicsek, Uncovering the overlapping community structure of complex networks in nature and society Nature 435, 814-818, 2005, doi:10.1038/nature03607

例子

>>> from networkx.algorithms.community import k_clique_communities
>>> G = nx.complete_graph(5)
>>> K5 = nx.convert_node_labels_to_integers(G, first_label=2)
>>> G.add_edges_from(K5.edges())
>>> c = list(k_clique_communities(G, 4))
>>> sorted(list(c[0]))
[0, 1, 2, 3, 4, 5, 6]
>>> list(k_clique_communities(G, 6))
[]

相關用法


注:本文由純淨天空篩選整理自networkx.org大神的英文原創作品 networkx.algorithms.community.kclique.k_clique_communities。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。