Opened 3 years ago

Closed 2 years ago

#17462 closed defect (fixed)

Remove the (deprecated) _boundary parameter

Reported by: ncohen Owned by:
Priority: major Milestone: sage-6.9
Component: graph theory Keywords:
Cc: Merged in:
Authors: Nathann Cohen Reviewers: David Coudert
Report Upstream: N/A Work issues:
Branch: 43cf74a (Commits) Commit: 43cf74ac4b0bb2729ffe7288d8d1ab4ed8e76a8d
Dependencies: Stopgaps:

Description (last modified by ncohen)

The _boundary attribute has been deprecated since Sage 6.3 in #15494. This ticket totally removes it fro the graph class.

The branch fixes a small problem that went probably unnoticed in #15494: the function Graph.genus was using this attribute (and so has been raising warnings for one year) but there was no other way to give a list of vertices to the function. Consequently, this branch turns one of its boolean arguments into a list, so that this function can be used properly, i.e. without global variables.

Change History (20)

comment:1 Changed 3 years ago by ncohen

  • Branch set to u/ncohen/17462
  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 3 years ago by git

  • Commit set to 55b2fdd77f0eb3de5aa789801f26f5f79ffef267

Branch pushed to git repo; I updated commit sha1. New commits:

55b2fddtrac #17462: Removed the _boundary flag, deprecated in #15494 on 2013-12-08

comment:3 Changed 3 years ago by jdemeyer

  • Description modified (diff)
  • Milestone changed from sage-6.5 to sage-pending

comment:4 Changed 3 years ago by ncohen

  • Description modified (diff)
  • Milestone changed from sage-pending to sage-6.5

Please do not add such a message on the ticket without explaining why. The developper's manual says that the deprecation should hold for at least a year, and this deprecation is from more than one year.

http://www.sagemath.org/doc/developer/coding_in_python.html#deprecation

Nathann

comment:5 follow-up: Changed 3 years ago by jdemeyer

  • Description modified (diff)
  • Milestone changed from sage-6.5 to sage-pending

I think the "one year" rule should be interpreted since a stable Sage release, not just since the opening of the ticket. The idea is to give users a one year warning that whatever they are using is deprecated.

It's very unreasonable to expect users to read all trac tickets for deprecations.

comment:6 in reply to: ↑ 5 ; follow-up: Changed 3 years ago by ncohen

Really Jeroen, I do not think that you are achieving anything besides being unpleasant. Coming on somebody else's ticket to discuss whether the date to take into account for deprecation is the day it was merged or the stable release that followed, really....

You take into account the 'first stable release' as the first date on which the deprecation appears, and you add a message here saying that 'no beta release' should be made that contains this branch. Stable on one hand, beta on the other, and all for nothing.

Anyway. Not even worth fighting for, it is just unpleasant and pointless.

Nathann

comment:7 in reply to: ↑ 6 Changed 3 years ago by jdemeyer

Replying to ncohen:

Coming on somebody else's ticket to discuss whether the date to take into account for deprecation is the day it was merged or the stable release that followed, really....

For this ticket, it was merged in the git repo 2015-06-06, which is only half a year ago.

comment:8 Changed 3 years ago by ncohen

Oh I see. The date is from when I wrote the commit....

Nathann

comment:9 Changed 3 years ago by git

  • Commit changed from 55b2fdd77f0eb3de5aa789801f26f5f79ffef267 to 084df3f59d4f5a3b1cc4614de742d846d7f8da96

Branch pushed to git repo; I updated commit sha1. New commits:

084df3ftrac #17462: Merged with 6.7.beta4

comment:10 Changed 2 years ago by ncohen

  • Description modified (diff)

comment:11 Changed 2 years ago by git

  • Commit changed from 084df3f59d4f5a3b1cc4614de742d846d7f8da96 to 41943ff9a08e086a14f2bf4d897bac60321288c1

Branch pushed to git repo; I updated commit sha1. New commits:

41943fftrac #17462: Merged with 6.9.beta0

comment:12 Changed 2 years ago by dcoudert

Long tests ok for graph.py, digraph.py and graph_plot.py, but not for generic_graph.py.

sage -t --long src/sage/graphs/generic_graph.py
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 1999, in sage.graphs.generic_graph.GenericGraph.get_embedding
Failed example:
    G.genus()
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.get_embedding[1]>", line 1, in <module>
        G.genus()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 2001, in sage.graphs.generic_graph.GenericGraph.get_embedding
Failed example:
    G.get_embedding()
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.get_embedding[2]>", line 1, in <module>
        G.get_embedding()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 2007, in get_embedding
        raise ValueError('%s has been modified and the embedding is no longer valid'%self)
    ValueError: Petersen graph has been modified and the embedding is no longer valid
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 3823, in sage.graphs.generic_graph.GenericGraph.is_planar
Failed example:
    g.is_planar(on_embedding=emb)
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.is_planar[26]>", line 1, in <module>
        g.is_planar(on_embedding=emb)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 3834, in is_planar
        return (0 == self.genus(minimal=False,set_embedding=False,on_embedding=on_embedding))
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4280, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    g.genus() # tests for minimal genus by default
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[1]>", line 1, in <module>
        g.genus() # tests for minimal genus by default
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4282, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    g.genus(on_embedding=True, maximal=True) # on_embedding overrides minimal and maximal arguments
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[2]>", line 1, in <module>
        g.genus(on_embedding=True, maximal=True) # on_embedding overrides minimal and maximal arguments
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4284, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    g.genus(maximal=True) # setting maximal to True overrides default minimal=True
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[3]>", line 1, in <module>
        g.genus(maximal=True) # setting maximal to True overrides default minimal=True
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4286, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    g.genus(on_embedding=g.get_embedding()) # can also send a valid combinatorial embedding dict
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[4]>", line 1, in <module>
        g.genus(on_embedding=g.get_embedding()) # can also send a valid combinatorial embedding dict
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 2007, in get_embedding
        raise ValueError('%s has been modified and the embedding is no longer valid'%self)
    ValueError: Petersen graph has been modified and the embedding is no longer valid
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4288, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    (graphs.CubeGraph(3)).genus()
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[5]>", line 1, in <module>
        (graphs.CubeGraph(Integer(3))).genus()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4291, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    K23.genus()
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[7]>", line 1, in <module>
        K23.genus()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4294, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    K33.genus()
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[9]>", line 1, in <module>
        K33.genus()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4321, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    G.genus()
Expected:
    Traceback (most recent call last):
    ...
    NotImplementedError: Can't work with embeddings of non-simple graphs
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[17]>", line 1, in <module>
        G.genus()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4325, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    G.to_simple().genus()
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[18]>", line 1, in <module>
        G.to_simple().genus()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4327, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    G.genus(set_embedding=False)
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[19]>", line 1, in <module>
        G.genus(set_embedding=False)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4329, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    G.genus(maximal=True, set_embedding=False)
Expected:
    Traceback (most recent call last):
    ...
    NotImplementedError: Can't compute the maximal genus of a graph with loops or multiple edges
Got:
    <BLANKLINE>
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[20]>", line 1, in <module>
        G.genus(maximal=True, set_embedding=False)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 4346, in sage.graphs.generic_graph.GenericGraph.genus
Failed example:
    G.genus()
Exception raised:
    Traceback (most recent call last):
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.generic_graph.GenericGraph.genus[25]>", line 1, in <module>
        G.genus()
      File "/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/graphs/generic_graph.py", line 4362, in genus
        raise ValueError("'circular' is expected to be a list")
    ValueError: 'circular' is expected to be a list
**********************************************************************
3 items had failures:
  12 of  27 in sage.graphs.generic_graph.GenericGraph.genus
   2 of   4 in sage.graphs.generic_graph.GenericGraph.get_embedding
   1 of  28 in sage.graphs.generic_graph.GenericGraph.is_planar
    [2690 tests, 15 failures, 63.86 s]
----------------------------------------------------------------------
sage -t --long src/sage/graphs/generic_graph.py  # 15 doctests failed
----------------------------------------------------------------------
Total time for all tests: 64.4 seconds
    cpu time: 45.2 seconds
    cumulative wall time: 63.9 seconds

comment:13 Changed 2 years ago by git

  • Commit changed from 41943ff9a08e086a14f2bf4d897bac60321288c1 to 43bb53f2d5e98c58d571695dd797f858ad2f96ae

Branch pushed to git repo; I updated commit sha1. New commits:

43bb53ftrac #17462: Change the default value of 'circular' in GenericGraph.genus

comment:14 Changed 2 years ago by ncohen

Sorry for that. The default value was clearly wrong, so I changed it ^^;

Nathann

comment:15 Changed 2 years ago by dcoudert

  • Branch changed from u/ncohen/17462 to u/dcoudert/17462

comment:16 Changed 2 years ago by dcoudert

  • Commit changed from 43bb53f2d5e98c58d571695dd797f858ad2f96ae to 43cf74ac4b0bb2729ffe7288d8d1ab4ed8e76a8d

Hello,

I did small modifications, but I'm not good for pushing commits and so all is in a new branch. Sorry for that.

I did only the following modifications:

  • in both files graph.py and digraph.py, remove in the description of the class parameters
        -  ``boundary`` - a list of boundary vertices, if
           empty, digraph is considered as a 'graph without boundary'
    
  • and remove boundary=None in
        def __init__(self, data=None, pos=None, loops=None, format=None,
                     boundary=None, weighted=None, implementation='c_graph',
                     data_structure="sparse", vertex_labels=True, name=None,
                     multiedges=None, convert_empty_dict_labels_to_None=None,
                     sparse=True, immutable=False):
    
  • In file generic_graph.py, remove word boundary from the method description
        :meth:`~GenericGraph.clear` | Empty the graph of vertices and edges and removes name, boundary, associated objects, and position information.
    
  • and in
        def clear(self):
            """
            Empties the graph of vertices and edges and removes name, boundary,
            associated objects, and position information.
    

If you agree, you can set the ticket to positive review.

David.


New commits:

e1c00ebtrac #17462: remove useless doc and parameter in graph.py and digraph.py
43cf74atrac #17462: clean doc in generic_graph.py

comment:17 Changed 2 years ago by ncohen

  • Status changed from needs_review to positive_review

:-/

Thank you very much. My branch was clearly careless :-/

Thanks.

Nathann

comment:18 Changed 2 years ago by dcoudert

  • Reviewers set to David Coudert

should we set the milestone to 6.9 or is it too early ?

comment:19 Changed 2 years ago by ncohen

  • Milestone changed from sage-pending to sage-6.9

Nono it's fine. I don't see a stable version released before 5 days :-P

comment:20 Changed 2 years ago by vbraun

  • Branch changed from u/dcoudert/17462 to 43cf74ac4b0bb2729ffe7288d8d1ab4ed8e76a8d
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.