# HG changeset patch
# User Rob Beezer <beezer@ups.edu>
# Date 1285005869 25200
# Node ID 61afad281c23e67ff51f44cfb61847f82dc076ce
# Parent 1962186f947b604c3da6e157b522466c6c42809f
4000: Adjust graphvertex sorting doctest to new module names
diff r 1962186f947b r 61afad281c23 sage/graphs/generic_graph.py
a

b


6249  6249  sage: G.vertices(key = lambda x: (x[1], x[2], x[0])) 
6250  6250  [(0, 0, 0), (1, 0, 0), (2, 0, 0), (0, 0, 1), ... (1, 2, 2), (2, 2, 2)] 
6251  6251  
6252   :: 
 6252  The discriminant of a polynomial is a function that returns an integer. 
 6253  We build a graph whose vertices are polynomials, and use the discriminant 
 6254  function to provide an ordering. Note that since functions are firstclass 
 6255  objects in Python, we can specify precisely the function from the Sage library 
 6256  that we wish to use as the key. :: 
6253  6257  
6254  6258  sage: t = polygen(QQ, 't') 
6255  6259  sage: K = Graph({5*t:[t^2], t^2:[t^2+2], t^2+2:[4*t^26], 4*t^26:[5*t]}) 
6256   sage: dsc = sage.rings.polynomial.polynomial_element_generic.Polynomial_rational_dense.discriminant 
6257   sage: K.vertices(key=dsc) 
 6260  sage: dsc = sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint.discriminant 
 6261  sage: verts = K.vertices(key=dsc) 
 6262  sage: verts 
6258  6263  [t^2 + 2, t^2, 5*t, 4*t^2  6] 
 6264  sage: [x.discriminant() for x in verts] 
 6265  [8, 0, 1, 96] 
6259  6266  
6260  6267  If boundary vertices are requested first, then they are sorted 
6261  6268  separately from the remainder (which are also sorted). :: 