python - 如何使用networkx查找强连接组件的子图
问题描述
正如nx.strongly_connected_component_subgraphs()
现在在 2.4 版中删除的那样,我尝试使用(G.subgraph(c) for c in strongly_connected_components(G))
类似于我们对连接组件子图所做的操作。但这只是表明 strong_connected_component_subgraphs 已被弃用。对networkx中的强连接子图怎么办?对不起,如果这个问题被重复。
解决方案
在您的共享方法中使用nx.strongly_connected_components
as 应该没问题:
(G.subgraph(c) for c in nx.strongly_connected_components(G))
此功能包含在最新版本 2.5中,并且不依赖任何其他已弃用的方法,如您在源代码中所见。因此,请确保您没有使用实际引发弃用警告的方法,nx.strongly_connected_component_subgraphs
.
推荐阅读
- php - 高级自定义字段 | 在转发器中发布对象不起作用
- elm - 检查字典中的值
- r - 选择不包含特定模式 R 正则表达式的字符串
- ajax - 保存到数据库后如何在数据表中显示记录?
- c# - 使用 xsd.exe 工具将 http://www.loc.gov/standards/mets/mets.xsd 转换为 C# 类不起作用
- c++ - 复制构造函数未在 C++ 类上删除
- angular - 当我登录时如何设置超时并离开该路线?
- java - 与旧嵌套列表相比,如何识别新嵌套列表中是否有任何添加或删除或相同的对象
- swift - 如何在运行时更改 Safari 应用程序扩展中的工具栏图标?
- machine-learning - AutoML 文本分类的数据集导入错误