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]
Run Code Online (Sandbox Code Playgroud)
当我尝试使用 nx.connected_component_subgraphs(G) 时,我收到以下给定的错误。请帮助解决这个问题。
在数据集中有两个 couns(电影和演员),它是二部图的形式。
我想获得电影节点的连接组件。
----> 1 A = list(nx.connected_component_subgraphs(B))[0]中的AttributeError Traceback(最近一次调用)
AttributeError: 模块“networkx”没有属性“connected_component_subgraphs”