# HG changeset patch
# User Birk Eisermann <eisermbi@fastmail.fm>
# Date 1341211294 28800
# Node ID e9cb4282e2539be6c6b98586f063c2452f3fe824
# Parent 5f2b67ffd844b6437e6f407bc6e4af2fa8c44982
trac 13192 code clean up in graph.py
diff git a/sage/graphs/graph.py b/sage/graphs/graph.py
a

b


1573  1573  edges = self.edges(labels=False) 
1574  1574  for i in range(len(edges)): # replace edge labels with natural numbers (by index in vertices) 
1575  1575  edges[i] = (vertices.index(edges[i][0]),vertices.index(edges[i][1])) 
1576   # order edges 
1577   edges.sort(compare_edges) 
 1576  # order edges 'reverse lexicographically', that is, for 
 1577  # edge (a,b) and edge (c,d) first compare b and d, then a and c; 
 1578  edges.sort(key=lambda e: (e[1],e[0])) 
1578  1579  
1579  1580  # encode bit vector 
1580  1581  from math import ceil 
… 
… 

5070  5071  
5071  5072  def compare_edges(x, y): 
5072  5073  """ 
 5074  This function has been deprecated. 
 5075  
5073  5076  Compare edge x to edge y, return 1 if x y, 1 if x y, else 0. 
5074  5077  
5075   EXAMPLES:: 
 5078  TEST:: 
5076  5079  
5077  5080  sage: G = graphs.PetersenGraph() 
5078  5081  sage: E = G.edges() 
5079  5082  sage: from sage.graphs.graph import compare_edges 
5080  5083  sage: compare_edges(E[0], E[2]) 
 5084  doctest:...: DeprecationWarning: compare_edges(x,y) is deprecated. Use statement 'cmp(x[1],y[1]) or cmp(x[0],y[0])' instead. 
 5085  See http://trac.sagemath.org/13192 for details. 
5081  5086  1 
5082   sage: compare_edges(E[0], E[1]) 
5083   1 
5084   sage: compare_edges(E[0], E[0]) 
5085   0 
5086   sage: compare_edges(E[1], E[0]) 
5087   1 
5088  5087  """ 
 5088  from sage.misc.superseded import deprecation 
 5089  deprecation(13192, "compare_edges(x,y) is deprecated. Use statement 'cmp(x[1],y[1]) or cmp(x[0],y[0])' instead.") 
5089  5090  if x[1] < y[1]: 
5090  5091  return 1 
5091  5092  elif x[1] > y[1]: 