diff --git a/src/sage/graphs/generic_graph.py b/src/sage/graphs/generic_graph.py index 0d156608534..3e631a7fc9f 100644 --- a/src/sage/graphs/generic_graph.py +++ b/src/sage/graphs/generic_graph.py @@ -8680,12 +8680,10 @@ def longest_path(self, s=None, t=None, use_edge_labels=False, This parameter can only be used when ``algorithm`` is ``'MILP'``. - ``algorithm`` -- string (default: ``'MILP'``); the algorithm to use - among ``'MILP'``, ``'backtrack'`` and ``'heuristic'``: + among ``'MILP'`` and ``'heuristic'``: * ``'MILP'`` returns an exact answer. - * ``'backtrack'`` is renamed ``'heuristic'`` (:issue:`36574`). - * ``'heuristic'`` is a randomized heuristic for finding a long path in an unweighted (di)graph. This heuristic does not take into account 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, TESTS: - The argument ``algorithm`` must be either ``'backtrack'``, - ``'heuristic'`` or ``'MILP'``:: + The argument ``algorithm`` must be either ``'heuristic'`` + or ``'MILP'``:: sage: graphs.PetersenGraph().longest_path(algorithm='abc') Traceback (most recent call last): ... - ValueError: algorithm must be either 'backtrack', 'heuristic' or 'MILP' + ValueError: algorithm must be either 'heuristic' or 'MILP' Disconnected graphs not weighted:: @@ -8843,10 +8841,6 @@ def longest_path(self, s=None, t=None, use_edge_labels=False, :issue:`36574`:: sage: G = graphs.PathGraph(3) - sage: P = G.longest_path(algorithm='backtrack') - doctest:...: DeprecationWarning: algorithm 'backtrack' is deprecated. - Use algorithm 'heuristic' instead. - See https://github.com/sagemath/sage/issues/36574 for details. sage: G.longest_path(algorithm='heuristic', s=0) Traceback (most recent call last): ... @@ -8883,13 +8877,8 @@ def longest_path(self, s=None, t=None, use_edge_labels=False, """ self._scream_if_not_simple() - if algorithm not in ("backtrack", "heuristic", "MILP"): - raise ValueError("algorithm must be either 'backtrack', 'heuristic' or 'MILP'") - if algorithm == "backtrack": - from sage.misc.superseded import deprecation - deprecation(36574, "algorithm 'backtrack' is deprecated. " - "Use algorithm 'heuristic' instead.") - algorithm = 'heuristic' + if algorithm not in ("heuristic", "MILP"): + raise ValueError("algorithm must be either 'heuristic' or 'MILP'") if algorithm == 'heuristic': if s is not None or t is not None or use_edge_labels: raise ValueError("parameters s, t, and use_edge_labels can not "