更改

跳到导航 跳到搜索
添加550字节 、 2020年4月10日 (五) 23:14
第231行: 第231行:  
</ref>
 
</ref>
    +
====代码实现====
 +
利用网络科学工具包[https://networkx.github.io/ NetworkX], 可以轻松调用Clauset-Newman-Moore 贪婪模块度最大化算法,这是一种模块度最大化的近似算法。
 +
<source>
 +
import networkx.algorithms.community as community
 +
from community import greedy_modularity_communities
 +
 +
G = nx.karate_club_graph()
 +
c = list(greedy_modularity_communities(G))
 +
prin(sorted(c[0])) #输出第一个社团中的节点
 +
</source>
 +
结果:
 +
<source>[8, 14, 15, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]</source>
    
===基于推论统计学的社团检测算法===
 
===基于推论统计学的社团检测算法===
7,129

个编辑

导航菜单