您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

NetworkX最大的组件不再起作用?

NetworkX最大的组件不再起作用?

networkx-1.9文档在此处http://networkx.github.io/documentation/networkx-1.9/reference/Generated/networkx.algorithms.components.connected.connected_components.html#networkx.algorithms.components.connected.connected_components

接口已更改为返回生成器(如您所知)。文档中的示例显示了如何执行您要求的操作。

生成已连接组件的排序列表,从大到大。

>> G = nx.path_graph(4)
>>> G.add_path([10, 11, 12])
>>> sorted(nx.connected_components(G), key = len, reverse=True)
[[0, 1, 2, 3], [10, 11, 12]]

要么

>>> sorted(nx.connected_component_subgraphs(G), key = len, reverse=True)
dotnet 2022/1/1 18:52:16 有437人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶