在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))
会报错:
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))
from networkx.algorithms.community import k_clique_communities
在上面加上这么一行代码就解决了,我也不知道为什么,问题就这样解决了。今天的快乐源泉!