def number_connected_components(G):
 return len(list(connected_components(G)))

def number_connected_components ( G ) : return len ( list ( connected_components ( G ) ) )
return the number of connected components .