def disjoint_union_all(graphs):
 graphs = iter(graphs)
 U = next(graphs)
 for H in graphs:
  U = nx.disjoint_union(U, H)
 return U

def disjoint_union_all ( graphs ) : graphs = iter ( graphs ) U = next ( graphs ) for H in graphs : U = nx . disjoint_union ( U , H ) return U
return the disjoint union of all graphs .