简体   繁体   English

如何使用.networkx 查找强连通分量的子图

[英]How to find subgraphs of strongly connected components using networkx

as nx.strongly_connected_component_subgraphs() is now removed in version 2.4, I have tried using (G.subgraph(c) for c in strongly_connected_components(G)) similar to what we do for connected component subgraphs.由于nx.strongly_connected_component_subgraphs()现在已在 2.4 版中删除,我尝试使用(G.subgraph(c) for c in strongly_connected_components(G))类似于我们对连通分量子图所做的。 but this just shows strongly_connected_component_subgraphs is deprecated.但这只是表明 strongly_connected_component_subgraphs 已被弃用。 What to do for strongly connected subgraphs in.networkx? .networkx中的强连通子图怎么办? sorry if this question is repeated.抱歉,如果重复此问题。

Using nx.strongly_connected_components as in your shared approach, should be fine:在您的共享方法中使用nx.strongly_connected_components应该没问题:

(G.subgraph(c) for c in nx.strongly_connected_components(G))

This function is included in the latest version, 2.5 , and does not rely on any other deprecated methods, as you can see in the source code .这个 function 包含在最新版本 2.5中,并且不依赖于任何其他不推荐使用的方法,如您在源代码中所见。 So make sure you aren't using the method that is actually raising the deprecation warning, nx.strongly_connected_component_subgraphs .因此,请确保您没有使用实际引发弃用警告的方法nx.strongly_connected_component_subgraphs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM