@not_implemented_for('undirected')
def number_attracting_components(G):
 n = len(list(attracting_components(G)))
 return n

@ not_implemented_for ( 'undirected' ) def number_attracting_components ( G ) : n = len ( list ( attracting_components ( G ) ) ) return n
returns the number of attracting components in g .