Ticket #4000: trac_4000-graph-vertex-sort-fix.patch

File trac_4000-graph-vertex-sort-fix.patch, 1.7 KB (added by rbeezer, 8 years ago)

Fixes doctest for graph vertex sorting, see #9741

  • sage/graphs/generic_graph.py

    # HG changeset patch
    # User Rob Beezer <beezer@ups.edu>
    # Date 1285005869 25200
    # Node ID 61afad281c23e67ff51f44cfb61847f82dc076ce
    # Parent  1962186f947b604c3da6e157b522466c6c42809f
    4000: Adjust graph-vertex sorting doctest to new module names
    
    diff -r 1962186f947b -r 61afad281c23 sage/graphs/generic_graph.py
    a b  
    62496249            sage: G.vertices(key = lambda x: (x[1], x[2], x[0]))
    62506250            [(0, 0, 0), (1, 0, 0), (2, 0, 0), (0, 0, 1), ... (1, 2, 2), (2, 2, 2)]
    62516251
    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 first-class
     6255        objects in Python, we can specify precisely the function from the Sage library
     6256        that we wish to use as the key. ::
    62536257
    62546258            sage: t = polygen(QQ, 't')
    62556259            sage: K = Graph({5*t:[t^2], t^2:[t^2+2], t^2+2:[4*t^2-6], 4*t^2-6:[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
    62586263            [t^2 + 2, t^2, 5*t, 4*t^2 - 6]
     6264            sage: [x.discriminant() for x in verts]
     6265            [-8, 0, 1, 96]
    62596266
    62606267        If boundary vertices are requested first, then they are sorted
    62616268        separately from the remainder (which are also sorted). ::