k_clique_communities#

k_clique_communities(G, k, cliques=None)[源代码]#

利用渗透法在图中寻找K族群落。

K集团社区是所有K规模的集团的联盟,可以通过邻近的(共享K-1节点)K集团到达。

参数
G网络X图表
k集成

最小集团的规模

cliques: list or generator

预计算的集团(使用networkx.findcliques(G))

返回
生成节点集,每个k-团社区一个。

工具书类

1

Gergely Palla、Imre der_nyi、Ill_s Farkas1和Tam_s Vicsek,揭示了自然和社会中复杂网络的重叠社区结构,自然435814-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))
[]