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 at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to