@not_implemented_for('undirected')
def attracting_components(G):
 scc = list(nx.strongly_connected_components(G))
 cG = nx.condensation(G, scc)
 for n in cG:
  if (cG.out_degree(n) == 0):
   (yield scc[n])

@ not_implemented_for ( 'undirected' ) def attracting_components ( G ) : scc = list ( nx . strongly_connected_components ( G ) ) cG = nx . condensation ( G , scc ) for n in cG : if ( cG . out_degree ( n ) == 0 ) : ( yield scc [ n ] )
generates a list of attracting components in g .