python类karate_club_graph()的实例源码

test_modularity.py 文件源码 项目:Networks 作者: dencesun 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def test_modularity():
    g = nx.karate_club_graph()
    q, s = ml.modularity(g)
    print('modularity:  ', q)
    ans = list()
    for i in range(len(s)):
        if s[i] == 1:
            ans.append(i+1)

    print(ans)
    print('community size: ', len(ans))


问题


面经


文章

微信
公众号

扫码关注公众号