@not_implemented_for('undirected')
def number_weakly_connected_components(G):
 return len(list(weakly_connected_components(G)))

@ not_implemented_for ( 'undirected' ) def number_weakly_connected_components ( G ) : return len ( list ( weakly_connected_components ( G ) ) )
return the number of weakly connected components in g .