问题描述
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)时出现以下给定错误.请帮助解决此问题.
I am getting the below given error when am trying to use nx.connected_component_subgraphs(G).Please help with this issue.
数据集中有两个列(电影和演员),形式为二部图.
In the dataset there are two coumns(movie and actor), and it's in the form bipartite graph.
我想获得电影节点的连接组件.
I want to get connected components for the movie nodes.
AttributeError跟踪(最近一次呼叫最近)在----> 1 A =列表(nx.connected_component_subgraphs(B))[0]
AttributeError Traceback (most recent call last) in----> 1 A = list(nx.connected_component_subgraphs(B))[0]
AttributeError:模块'networkx'没有属性'connected_component_subgraphs'
AttributeError: module 'networkx' has no attribute 'connected_component_subgraphs'
推荐答案
此版本在2.1版中已弃用,最后在2.4版中被删除.
This was deprecated with version 2.1, and finally removed with version 2.4.
请参见这些说明
或(connected_components(G)中c的G.subgraph(c).copy())
这篇关于AttributeError:模块"networkx"没有属性"connected_component_subgraphs"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!