439
439
from sage.misc.decorators import options
440
440
from sage.misc.cachefunc import cached_method
441
441
from sage.misc.prandom import random
442
- from sage.misc.superseded import deprecation
443
442
from sage.misc.lazy_import import lazy_import, LazyImport
444
443
445
444
from sage.rings.integer_ring import ZZ
@@ -11364,19 +11363,15 @@ def neighbor_iterator(self, vertex, closed=False):
11364
11363
for u in self._backend.iterator_nbrs(vertex):
11365
11364
yield u
11366
11365
11367
- def vertices(self, sort=None , key=None, degree=None, vertex_property=None):
11366
+ def vertices(self, sort=False , key=None, degree=None, vertex_property=None):
11368
11367
r"""
11369
11368
Return a list of the vertices.
11370
11369
11371
11370
INPUT:
11372
11371
11373
- - ``sort`` -- boolean (default: ``None``); if ``True``, vertices are
11374
- sorted according to the default ordering
11375
-
11376
- As of :trac:`22349`, this argument must be explicitly
11377
- specified (unless a ``key`` is given); otherwise a warning
11378
- is printed and ``sort=True`` is used. The default will
11379
- eventually be changed to ``False``.
11372
+ - ``sort`` -- boolean (default: ``False``); whether to sort vertices
11373
+ according the ordering specified with parameter ``key``. If ``False``
11374
+ (default), vertices are not sorted.
11380
11375
11381
11376
- ``key`` -- a function (default: ``None``); a function that takes a
11382
11377
vertex as its one argument and returns a value that can be used for
@@ -11464,20 +11459,7 @@ def vertices(self, sort=None, key=None, degree=None, vertex_property=None):
11464
11459
Traceback (most recent call last):
11465
11460
...
11466
11461
ValueError: sort keyword is False, yet a key function is given
11467
-
11468
- Deprecation warning for ``sort=None`` (:trac:`22349`)::
11469
-
11470
- sage: G = graphs.HouseGraph()
11471
- sage: G.vertices()
11472
- doctest:...: DeprecationWarning: parameter 'sort' will be set to False by default in the future
11473
- See https://github.com/sagemath/sage/issues/22349 for details.
11474
- [0, 1, 2, 3, 4]
11475
11462
"""
11476
- if sort is None:
11477
- if key is None:
11478
- deprecation(22349, "parameter 'sort' will be set to False by default in the future")
11479
- sort = True
11480
-
11481
11463
if (not sort) and key:
11482
11464
raise ValueError('sort keyword is False, yet a key function is given')
11483
11465
@@ -12403,7 +12385,7 @@ def has_edge(self, u, v=None, label=None):
12403
12385
label = None
12404
12386
return self._backend.has_edge(u, v, label)
12405
12387
12406
- def edges(self, vertices=None, labels=True, sort=None , key=None,
12388
+ def edges(self, vertices=None, labels=True, sort=False , key=None,
12407
12389
ignore_direction=False, sort_vertices=True):
12408
12390
r"""
12409
12391
Return a :class:`~EdgesView` of edges.
@@ -12427,13 +12409,10 @@ def edges(self, vertices=None, labels=True, sort=None, key=None,
12427
12409
- ``labels`` -- boolean (default: ``True``); if ``False``, each edge is
12428
12410
simply a pair ``(u, v)`` of vertices
12429
12411
12430
- - ``sort`` -- boolean (default: ``None``); if ``True``, edges are sorted
12431
- according to the default ordering
12432
-
12433
- As of :trac:`22349`, this argument must be explicitly
12434
- specified (unless a ``key`` is given); otherwise a warning
12435
- is printed and ``sort=True`` is used. The default will
12436
- eventually be changed to ``False``.
12412
+ - ``sort`` -- boolean (default: ``False``); whether to sort edges
12413
+ according the ordering specified with parameter ``key``. If ``False``
12414
+ (default), edges are not sorted. This is the fastest and less memory
12415
+ consuming method for iterating over edges.
12437
12416
12438
12417
- ``key`` -- a function (default: ``None``); a function that takes an
12439
12418
edge (a pair or a triple, according to the ``labels`` keyword) as its
@@ -12529,7 +12508,7 @@ def edges(self, vertices=None, labels=True, sort=None, key=None,
12529
12508
....: G.set_edge_label(e[0], e[1], chr(ord('A') + e[0] + 5 * e[1]))
12530
12509
sage: G.edges(sort=True)
12531
12510
[(0, 1, 'F'), (0, 4, 'U'), (1, 2, 'L'), (2, 3, 'R'), (3, 4, 'X')]
12532
- sage: G.edges(key=lambda x: x[2])
12511
+ sage: G.edges(sort=True, key=lambda x: x[2])
12533
12512
[(0, 1, 'F'), (1, 2, 'L'), (2, 3, 'R'), (0, 4, 'U'), (3, 4, 'X')]
12534
12513
12535
12514
We can restrict considered edges to those incident to a given set::
@@ -12580,20 +12559,7 @@ def edges(self, vertices=None, labels=True, sort=None, key=None,
12580
12559
sage: G.edge_label(0, 1)[0] += 1
12581
12560
sage: G.edges(sort=True)
12582
12561
[(0, 1, [8]), (0, 2, [7])]
12583
-
12584
- Deprecation warning for ``sort=None`` (:trac:`27408`)::
12585
-
12586
- sage: G = graphs.HouseGraph()
12587
- sage: G.edges(sort=None)
12588
- doctest:...: DeprecationWarning: parameter 'sort' will be set to False by default in the future
12589
- See https://github.com/sagemath/sage/issues/27408 for details.
12590
- [(0, 1, None), (0, 2, None), (1, 3, None), (2, 3, None), (2, 4, None), (3, 4, None)]
12591
12562
"""
12592
- if sort is None:
12593
- if key is None:
12594
- deprecation(27408, "parameter 'sort' will be set to False by default in the future")
12595
- sort = True
12596
-
12597
12563
if vertices is not None and vertices in self:
12598
12564
vertices = [vertices]
12599
12565
0 commit comments