Reputation: 3045
I have the graph G
. I want to display its largest weakly connected component as a separate graph and get the its number of edges and nodes.
I think the weakly_connected_component_subgraphs
(Doc) function can solve my problem. But deprecated in NetworkX 2.1. what is the alternative of this function in NetworkX 2.4?
Upvotes: 1
Views: 1628
Reputation: 4892
Looks like you found some missing document for weakly_connected_components
as the hint you are looking for is only present in connected_components
:
S = [G.subgraph(c).copy() for c in connected_components(G)]
# or in your case
S = [G.subgraph(c).copy() for c in weakly_connected_components(G)]
Upvotes: 2