Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 9980a1f

Browse files
author
Release Manager
committed
Trac #29518: remove deprecated stuff from graphs
Goal: remove all the code of the graph module that has a deprecation warning referring to a ticket closed for at least one year. These tickets are: - #26200 deprecate import of all_max_clique, max_clique and clique_number in global namespace - #27491 deprecate parameter copy in networkx_graph - #19227 Graphs: DFS and broken distance-parameter - #19517 Graphs: canonical_label() and several errors - #25864 make LinearExtensions an iterator Note that the current ticket completely deletes the file `graphs/linearextensions.py`. URL: https://trac.sagemath.org/29518 Reported by: gh-jfraymond Ticket author(s): Jean-Florent Raymond Reviewer(s): Frédéric Chapoton
2 parents 1007d3c + b1f507f commit 9980a1f

File tree

5 files changed

+19
-233
lines changed

5 files changed

+19
-233
lines changed

src/doc/en/reference/graphs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ Libraries of algorithms
7575
sage/graphs/matchpoly
7676
sage/graphs/genus
7777
sage/graphs/lovasz_theta
78-
sage/graphs/linearextensions
7978
sage/graphs/schnyder
8079
sage/graphs/planarity
8180
sage/graphs/traversals

src/sage/combinat/posets/linear_extensions.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ class LinearExtensionsOfPoset(UniqueRepresentation, Parent):
417417
.. SEEALSO::
418418
419419
- :meth:`sage.combinat.posets.posets.FinitePoset.linear_extensions`
420-
- :class:`sage.graphs.linearextensions.LinearExtensions`
421420
422421
EXAMPLES::
423422

src/sage/graphs/all.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
import sage.graphs.partial_cube
1515
from . import graph_list as graphs_list
1616
lazy_import("sage.graphs", "graph_coloring")
17-
lazy_import("sage.graphs.cliquer", ['all_max_clique', 'max_clique',
18-
'clique_number'],
19-
deprecation=26200)
2017
from .graph_database import graph_db_info
2118
lazy_import("sage.graphs.graph_editor", "graph_editor")
2219

@@ -35,15 +32,15 @@
3532
sage.graphs.cliquer are deprecated from the global namespace (:trac:`26200`)::
3633
3734
sage: all_max_clique(Graph())
38-
doctest:...: DeprecationWarning: Importing all_max_clique from here is deprecated. If you need to use it, please import it directly from sage.graphs.cliquer
39-
See https://trac.sagemath.org/26200 for details.
40-
[[]]
35+
Traceback (most recent call last):
36+
...
37+
NameError: name 'all_max_clique' is not defined
4138
sage: max_clique(Graph())
42-
doctest:...: DeprecationWarning: Importing max_clique from here is deprecated. If you need to use it, please import it directly from sage.graphs.cliquer
43-
See https://trac.sagemath.org/26200 for details.
44-
[]
39+
Traceback (most recent call last):
40+
...
41+
NameError: name 'max_clique' is not defined
4542
sage: clique_number(Graph())
46-
doctest:...: DeprecationWarning: Importing clique_number from here is deprecated. If you need to use it, please import it directly from sage.graphs.cliquer
47-
See https://trac.sagemath.org/26200 for details.
48-
0
43+
Traceback (most recent call last):
44+
...
45+
NameError: name 'clique_number' is not defined
4946
"""

src/sage/graphs/generic_graph.py

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ def _scream_if_not_simple(self, allow_loops=False, allow_multiple_edges=False):
14191419
functions + ".")
14201420
raise ValueError(msg)
14211421

1422-
def networkx_graph(self, copy=True, weight_function=None):
1422+
def networkx_graph(self, weight_function=None):
14231423
"""
14241424
Return a new ``NetworkX`` graph from the Sage graph.
14251425

@@ -1447,8 +1447,6 @@ def networkx_graph(self, copy=True, weight_function=None):
14471447
OutMultiEdgeDataView([(1, 2, {'weight': 1}), (1, 3, {'weight': 4}), (2, 3, {'weight': 3}), (3, 4, {'weight': 5}), (3, 4, {'weight': 4})])
14481448

14491449
"""
1450-
if copy is not True:
1451-
deprecation(27491, "parameter copy is removed")
14521450
if weight_function is not None:
14531451
self._check_weight_function(weight_function)
14541452
import networkx
@@ -17677,7 +17675,7 @@ def breadth_first_search(self, start, ignore_direction=False,
1767717675
yield w
1767817676

1767917677
def depth_first_search(self, start, ignore_direction=False,
17680-
distance=None, neighbors=None, edges=False):
17678+
neighbors=None, edges=False):
1768117679
"""
1768217680
Return an iterator over the vertices in a depth-first ordering.
1768317681

@@ -17690,8 +17688,6 @@ def depth_first_search(self, start, ignore_direction=False,
1769017688
directed graphs. If ``True``, searches across edges in either
1769117689
direction.
1769217690

17693-
- ``distance`` -- Deprecated. Broken, do not use.
17694-
1769517691
- ``neighbors`` -- function (default: ``None``); a function that inputs
1769617692
a vertex and return a list of vertices. For an undirected graph,
1769717693
``neighbors`` is by default the :meth:`.neighbors` function. For a
@@ -17786,11 +17782,8 @@ def depth_first_search(self, start, ignore_direction=False,
1778617782
[(1, 3), (3, 6), (6, 7), (7, 5), (5, 4), (1, 2)]
1778717783

1778817784
"""
17789-
if distance is not None:
17790-
deprecation(19227, "Parameter 'distance' is broken. Do not use.")
17791-
1779217785
# Preferably use the Cython implementation
17793-
if (neighbors is None and not isinstance(start, list) and distance is None
17786+
if (neighbors is None and not isinstance(start, list)
1779417787
and hasattr(self._backend, "depth_first_search") and not edges):
1779517788
for v in self._backend.depth_first_search(start, ignore_direction=ignore_direction):
1779617789
yield v
@@ -17813,10 +17806,9 @@ def depth_first_search(self, start, ignore_direction=False,
1781317806
if v not in seen:
1781417807
yield v
1781517808
seen.add(v)
17816-
if distance is None or d < distance:
17817-
for w in neighbors(v):
17818-
if w not in seen:
17819-
queue.append((w, d + 1))
17809+
for w in neighbors(v):
17810+
if w not in seen:
17811+
queue.append((w, d + 1))
1782017812
else:
1782117813
queue = [(None, v, d) for v, d in queue]
1782217814
while queue:
@@ -17825,10 +17817,9 @@ def depth_first_search(self, start, ignore_direction=False,
1782517817
if v is not None:
1782617818
yield v, w
1782717819
seen.add(w)
17828-
if distance is None or d < distance:
17829-
for x in neighbors(w):
17830-
if x not in seen:
17831-
queue.append((w, x, d + 1))
17820+
for x in neighbors(w):
17821+
if x not in seen:
17822+
queue.append((w, x, d + 1))
1783217823

1783317824
### Constructors
1783417825

@@ -22864,7 +22855,7 @@ def is_isomorphic(self, other, certificate=False, verbosity=0, edge_labels=False
2286422855
isom_trans[v] = other_vertices[isom[G_to[v]]]
2286522856
return True, isom_trans
2286622857

22867-
def canonical_label(self, partition=None, certificate=False, verbosity=0,
22858+
def canonical_label(self, partition=None, certificate=False,
2286822859
edge_labels=False, algorithm=None, return_graph=True):
2286922860
r"""
2287022861
Return the canonical graph.
@@ -22906,8 +22897,6 @@ class by some canonization function `c`. If `G` and `H` are graphs,
2290622897
instead of the canonical graph; only available when ``'bliss'``
2290722898
is explicitly set as algorithm.
2290822899

22909-
- ``verbosity`` -- deprecated, does nothing
22910-
2291122900
EXAMPLES:
2291222901

2291322902
Canonization changes isomorphism to equality::
@@ -23046,9 +23035,6 @@ class by some canonization function `c`. If `G` and `H` are graphs,
2304623035
....: assert gcan0 == gcan1, (edges, labels, part, pp)
2304723036
....: assert gcan0 == gcan2, (edges, labels, part, pp)
2304823037
"""
23049-
# Deprecation
23050-
if verbosity != 0:
23051-
deprecation(19517, "Verbosity-parameter is removed.")
2305223038

2305323039
# Check parameter combinations
2305423040
if algorithm not in [None, 'sage', 'bliss']:

src/sage/graphs/linearextensions.py

Lines changed: 0 additions & 195 deletions
This file was deleted.

0 commit comments

Comments
 (0)