def to_edgelist(G, nodelist=None):
 if (nodelist is None):
  return G.edges(data=True)
 else:
  return G.edges(nodelist, data=True)

def to_edgelist ( G , nodelist = None ) : if ( nodelist is None ) : return G . edges ( data = True ) else : return G . edges ( nodelist , data = True )
return a list of edges in the graph .