So it is a verb. ;-) Looks like similar comments apply to edges().
I'm thinking that optionally passing in a comparison function would be a nice thing to add - a minor convenience, but also it would drive home the point that the sorting is somewhat the caller's responsibility in non-trivial situations (ie for not most users). I'll get a ticket started soon. Rob On Jul 24, 4:27 am, Robert Miller <r...@rlmiller.org> wrote: > I would simply add a caveat to the documentation. Most users use > either integers for vertices, or a set of certain kinds of objects. It > should be noted that "<" should implement a total ordering for this to > be consistent, e.g. not just a poset. This is related to a debate > about whether "<" should give an ordering of poset elements for > computer science reasons (like binary search in a list) or for > mathematicians... > > > > On Sat, Jul 24, 2010 at 9:20 AM, Rob Beezer <goo...@beezer.cotse.net> wrote: > > The vertices() method for graphs says the resulting list is always > > sorted. But while you can use a variety of objects as the vertices of > > a graph (very nice), they do not always compare cleanly (not so > > nice). So I got bit tonight on a doctest where one vertex was an > > integer and one was a symbolic expression. With a randomized order > > for the tests, the results would vary. > > > Do we need to be more careful about the vertices() method, either in > > action or in claims? When the documentation says the list is sorted, > > is "sorted" a verb or an adjective? > > > I presume it is expecting too much that any two objects can be > > comparable somehow? > > > Rob > > > sage: var('x') > > x > > sage: G=Graph({0:[x]}) > > sage: vert = G.vertices() > > sage: vert > > [0, x] > > sage: sorted(vert) > > [0, x] > > sage: vert.reverse() > > sage: vert > > [x, 0] > > sage: sorted(vert) > > [x, 0] > > sage: G.vertices? > > <snip> > > Note that the output of the vertices() function is always sorted. > > <snip> > > > -- > > To post to this group, send an email to sage-devel@googlegroups.com > > To unsubscribe from this group, send an email to > > sage-devel+unsubscr...@googlegroups.com > > For more options, visit this group > > athttp://groups.google.com/group/sage-devel > > URL:http://www.sagemath.org > > -- > Robert L. Millerhttp://www.rlmiller.org/ -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org