Skip to content

Commit 57ad082

Browse files
committed
remove deprecated algorithm choice in generic_graph
1 parent cb03043 commit 57ad082

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/sage/graphs/generic_graph.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8680,12 +8680,10 @@ def longest_path(self, s=None, t=None, use_edge_labels=False,
86808680
This parameter can only be used when ``algorithm`` is ``'MILP'``.
86818681

86828682
- ``algorithm`` -- string (default: ``'MILP'``); the algorithm to use
8683-
among ``'MILP'``, ``'backtrack'`` and ``'heuristic'``:
8683+
among ``'MILP'`` and ``'heuristic'``:
86848684

86858685
* ``'MILP'`` returns an exact answer.
86868686

8687-
* ``'backtrack'`` is renamed ``'heuristic'`` (:issue:`36574`).
8688-
86898687
* ``'heuristic'`` is a randomized heuristic for finding a long path in
86908688
an unweighted (di)graph. This heuristic does not take into account
86918689
parameters ``s``, ``t`` and ``use_edge_labels``. An error is raised
@@ -8760,13 +8758,13 @@ def longest_path(self, s=None, t=None, use_edge_labels=False,
87608758

87618759
TESTS:
87628760

8763-
The argument ``algorithm`` must be either ``'backtrack'``,
8764-
``'heuristic'`` or ``'MILP'``::
8761+
The argument ``algorithm`` must be either ``'heuristic'``
8762+
or ``'MILP'``::
87658763

87668764
sage: graphs.PetersenGraph().longest_path(algorithm='abc')
87678765
Traceback (most recent call last):
87688766
...
8769-
ValueError: algorithm must be either 'backtrack', 'heuristic' or 'MILP'
8767+
ValueError: algorithm must be either 'heuristic' or 'MILP'
87708768

87718769
Disconnected graphs not weighted::
87728770

@@ -8843,10 +8841,6 @@ def longest_path(self, s=None, t=None, use_edge_labels=False,
88438841
:issue:`36574`::
88448842

88458843
sage: G = graphs.PathGraph(3)
8846-
sage: P = G.longest_path(algorithm='backtrack')
8847-
doctest:...: DeprecationWarning: algorithm 'backtrack' is deprecated.
8848-
Use algorithm 'heuristic' instead.
8849-
See https://github.com/sagemath/sage/issues/36574 for details.
88508844
sage: G.longest_path(algorithm='heuristic', s=0)
88518845
Traceback (most recent call last):
88528846
...
@@ -8883,13 +8877,8 @@ def longest_path(self, s=None, t=None, use_edge_labels=False,
88838877
"""
88848878
self._scream_if_not_simple()
88858879

8886-
if algorithm not in ("backtrack", "heuristic", "MILP"):
8887-
raise ValueError("algorithm must be either 'backtrack', 'heuristic' or 'MILP'")
8888-
if algorithm == "backtrack":
8889-
from sage.misc.superseded import deprecation
8890-
deprecation(36574, "algorithm 'backtrack' is deprecated. "
8891-
"Use algorithm 'heuristic' instead.")
8892-
algorithm = 'heuristic'
8880+
if algorithm not in ("heuristic", "MILP"):
8881+
raise ValueError("algorithm must be either 'heuristic' or 'MILP'")
88938882
if algorithm == 'heuristic':
88948883
if s is not None or t is not None or use_edge_labels:
88958884
raise ValueError("parameters s, t, and use_edge_labels can not "

0 commit comments

Comments
 (0)