def relabel_nodes(G, mapping, copy=True):
 if (not hasattr(mapping, '__getitem__')):
  m = dict(((n, mapping(n)) for n in G))
 else:
  m = mapping
 if copy:
  return _relabel_copy(G, m)
 else:
  return _relabel_inplace(G, m)

def relabel_nodes ( G , mapping , copy = True ) : if ( not hasattr ( mapping , '__getitem__' ) ) : m = dict ( ( ( n , mapping ( n ) ) for n in G ) ) else : m = mapping if copy : return _relabel_copy ( G , m ) else : return _relabel_inplace ( G , m )
relabel the nodes of the graph g .