def _lg_undirected(G, selfloops=False, create_using=None):
 if (create_using is None):
  L = G.__class__()
 else:
  L = create_using
 get_edges = _edge_func(G)
 sorted_node = _node_func(G)
 shift = (0 if selfloops else 1)
 edges = set([])
 for u in G:
  nodes = [sorted_node(*x) for x in get_edges(u)]
  if (len(nodes) == 1):
   L.add_node(nodes[0])
  for (i, a) in enumerate(nodes):
   edges.update([_sorted_edge(a, b) for b in nodes[(i + shift):]])
 L.add_edges_from(edges)
 return L

def _lg_undirected ( G , selfloops = False , create_using = None ) : if ( create_using is None ) : L = G . __class__ ( ) else : L = create_using get_edges = _edge_func ( G ) sorted_node = _node_func ( G ) shift = ( 0 if selfloops else 1 ) edges = set ( [ ] ) for u in G : nodes = [ sorted_node ( * x ) for x in get_edges ( u ) ] if ( len ( nodes ) == 1 ) : L . add_node ( nodes [ 0 ] ) for ( i , a ) in enumerate ( nodes ) : edges . update ( [ _sorted_edge ( a , b ) for b in nodes [ ( i + shift ) : ] ] ) L . add_edges_from ( edges ) return L
return the line graph l of the graph g .