Skip to content

Commit f8352b4

Browse files
committed
stop sorting graph vertices by default
1 parent 6b1ffe3 commit f8352b4

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

src/sage/geometry/polyhedron/base4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def vertex_facet_graph(self, labels=True):
9595
sage: P = polytopes.cube()
9696
sage: G = P.vertex_facet_graph(); G
9797
Digraph on 14 vertices
98-
sage: G.vertices(key = lambda v: str(v))
98+
sage: G.vertices(sort=True, key=lambda v: str(v))
9999
[A vertex at (-1, -1, -1),
100100
A vertex at (-1, -1, 1),
101101
A vertex at (-1, 1, -1),

src/sage/graphs/generic_graph.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11332,19 +11332,15 @@ def neighbor_iterator(self, vertex, closed=False):
1133211332
for u in self._backend.iterator_nbrs(vertex):
1133311333
yield u
1133411334

11335-
def vertices(self, sort=None, key=None, degree=None, vertex_property=None):
11335+
def vertices(self, sort=False, key=None, degree=None, vertex_property=None):
1133611336
r"""
1133711337
Return a list of the vertices.
1133811338

1133911339
INPUT:
1134011340

11341-
- ``sort`` -- boolean (default: ``None``); if ``True``, vertices are
11342-
sorted according to the default ordering
11343-
11344-
As of :trac:`22349`, this argument must be explicitly
11345-
specified (unless a ``key`` is given); otherwise a warning
11346-
is printed and ``sort=True`` is used. The default will
11347-
eventually be changed to ``False``.
11341+
- ``sort`` -- boolean (default: ``False``); whether to sort vertices
11342+
according the ordering specified with parameter ``key``. If ``False``
11343+
(default), vertices are not sorted.
1134811344

1134911345
- ``key`` -- a function (default: ``None``); a function that takes a
1135011346
vertex as its one argument and returns a value that can be used for
@@ -11432,20 +11428,7 @@ def vertices(self, sort=None, key=None, degree=None, vertex_property=None):
1143211428
Traceback (most recent call last):
1143311429
...
1143411430
ValueError: sort keyword is False, yet a key function is given
11435-
11436-
Deprecation warning for ``sort=None`` (:trac:`22349`)::
11437-
11438-
sage: G = graphs.HouseGraph()
11439-
sage: G.vertices()
11440-
doctest:...: DeprecationWarning: parameter 'sort' will be set to False by default in the future
11441-
See https://github.com/sagemath/sage/issues/22349 for details.
11442-
[0, 1, 2, 3, 4]
1144311431
"""
11444-
if sort is None:
11445-
if key is None:
11446-
deprecation(22349, "parameter 'sort' will be set to False by default in the future")
11447-
sort = True
11448-
1144911432
if (not sort) and key:
1145011433
raise ValueError('sort keyword is False, yet a key function is given')
1145111434

0 commit comments

Comments
 (0)