当前位置:   article > 正文

解决AttributeError in NetworkX, module has no k_clique_communities_module 'networkx' has no attribute 'k_clique_commu

module 'networkx' has no attribute 'k_clique_communities

Jupyter Notebook/Spyder中解决AttributeError in NetworkX, module has no k_clique_communities类似问题

import networkx as nx
Gn_karate = nx.read_edgelist("E:\\karate.txt")
Gn_karate = Gn_karate.to_undirected()
community_list = list(nx.k_clique_communities(Gn_karate,3))
  • 1
  • 2
  • 3
  • 4

会报错:
AttributeError in NetworkX, module has no k_clique_communities
解决方法来喽:

import networkx as nx
from networkx.algorithms.community import k_clique_communities
Gn_karate = nx.read_edgelist("E:\\karate.txt")
Gn_karate = Gn_karate.to_undirected()
community_list = list(k_clique_communities(Gn_karate,3))
  • 1
  • 2
  • 3
  • 4
  • 5

from networkx.algorithms.community import k_clique_communities
在上面加上这么一行代码就解决了,我也不知道为什么,问题就这样解决了。今天的快乐源泉!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/71063
推荐阅读
相关标签
  

闽ICP备14008679号