# HG changeset patch
# User Rob Beezer
# 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/sage/graphs/generic_graph.py Sat Sep 18 21:58:03 2010 +0200
+++ b/sage/graphs/generic_graph.py Mon Sep 20 11:04:29 2010 -0700
@@ -6249,13 +6249,20 @@
sage: G.vertices(key = lambda x: (x[1], x[2], x[0]))
[(0, 0, 0), (1, 0, 0), (2, 0, 0), (0, 0, 1), ... (1, 2, 2), (2, 2, 2)]
- ::
+ The discriminant of a polynomial is a function that returns an integer.
+ We build a graph whose vertices are polynomials, and use the discriminant
+ function to provide an ordering. Note that since functions are first-class
+ objects in Python, we can specify precisely the function from the Sage library
+ that we wish to use as the key. ::
sage: t = polygen(QQ, 't')
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]})
- sage: dsc = sage.rings.polynomial.polynomial_element_generic.Polynomial_rational_dense.discriminant
- sage: K.vertices(key=dsc)
+ sage: dsc = sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint.discriminant
+ sage: verts = K.vertices(key=dsc)
+ sage: verts
[t^2 + 2, t^2, 5*t, 4*t^2 - 6]
+ sage: [x.discriminant() for x in verts]
+ [-8, 0, 1, 96]
If boundary vertices are requested first, then they are sorted
separately from the remainder (which are also sorted). ::