B = nx.Graph()
B.add_nodes_from(data['movie'].unique(), bipartite=0, label='movie')
B.add_nodes_from(data['actor'].unique(), bipartite=1, label='actor')
B.add_edges_from(edges, label='acted')
A = list(nx.connected_component_subgraphs(B))[0]
我在尝试使用时收到以下给出的错误nx.connected_component_subgraphs(G)。
在数据集中有两个库(电影和演员),它的形式是二分图。
我想获得电影节点的连接组件。
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-16-efff4e6fafc4> in <module>
----> 1 A = list(nx.connected_component_subgraphs(B))[0]
AttributeError: module 'networkx' has no attribute 'connected_component_subgraphs'
慕神8447489
呼唤远方
月关宝盒
Helenr
相关分类