@not_implemented_for('directed')
def connected_component_subgraphs(G, copy=True):
 for c in connected_components(G):
  if copy:
   (yield G.subgraph(c).copy())
  else:
   (yield G.subgraph(c))

@ not_implemented_for ( 'directed' ) def connected_component_subgraphs ( G , copy = True ) : for c in connected_components ( G ) : if copy : ( yield G . subgraph ( c ) . copy ( ) ) else : ( yield G . subgraph ( c ) )
generate connected components as subgraphs .