I do not like a solution involving a m log(m) cost at initialization. EdgesView is supposed to be O(1) at construction right?
On Thu, 6 Jul 2023 at 06:54, David Coudert <david.coud...@gmail.com> wrote: > > The current design choice in `EdgesView` is to sort only when asking for the > list of edges, that is when calling `__repr__` if `sort=True`. > The alternative is to sort at the initialization of the object and to cache > the sorted list of edges in the object. > Should we go for this alternative implementation ? > > On Wednesday, July 5, 2023 at 8:48:05 AM UTC+2 Vincent Delecroix wrote: >> >> To my mind, this is not the problem. The first command does generate a >> warning (fine) >> >> sage: E = Graph([('A','B'),(1,2)]).edges() >> <ipython-input-1-28a7859d6cf7>:1: DeprecationWarning: parameter 'sort' >> will be set to False by default in the future >> See https://github.com/sagemath/sage/issues/27408 for details. >> >> But the EdgesView.__repr__ is buggy (bad) >> >> sage: E >> <repr(<sage.graphs.views.EdgesView at 0x7fd82c935720>) failed: >> TypeError: unsupported operand parent(s) for <: 'Integer Ring' and >> '<class 'str'>'> >> >> I think that either E is broken from start and an error should have >> been raised in the first stage or everything is fine and we should >> have a proper string representation. >> >> On Wed, 5 Jul 2023 at 08:33, David Coudert <david....@gmail.com> wrote: >> > >> > There is an active deprecation warning in method edges(). Parameter sort >> > will be set to False in the future. I'm surprised you don't see it. >> > >> > sage: Graph([('A','B'),(1,2)]).edges() >> > <ipython-input-1-266d02e19563>:1: DeprecationWarning: parameter 'sort' >> > will be set to False by default in the future See >> > https://github.com/sagemath/sage/issues/27408 for details. >> > Graph([('A','B'),(Integer(1),Integer(2))]).edges() >> > <repr(<sage.graphs.views.EdgesView at 0x1511698a0>) failed: TypeError: >> > unsupported operand parent(s) for <: 'Integer Ring' and '<class 'str'>'> >> > >> > >> > On Tuesday, July 4, 2023 at 4:29:21 PM UTC+2 Vincent Delecroix wrote: >> >> >> >> https://github.com/sagemath/sage/issues/35897 >> >> >> >> On Tue, 4 Jul 2023 at 16:25, Vincent Delecroix >> >> <20100.d...@gmail.com> wrote: >> >> > >> >> > This is a bug in the __repr__ method of EdgesView. Thanks for your >> >> > report. >> >> > >> >> > On Tue, 4 Jul 2023 at 10:52, Georgi Guninski <ggun...@gmail.com> wrote: >> >> > > >> >> > > Graph([('A','B'),(1,2)]).edges() >> >> > > <repr(<sage.graphs.views.EdgesView at 0x7fe9a43c0a00>) failed: >> >> > > TypeError: unsupported operand parent(s) for <: 'Integer Ring' and >> >> > > '<class 'str'>'> >> >> > > >> >> > > I think this is related to sorting the edges. >> >> > > >> >> > > The following works: >> >> > > sage: Graph([("A",1),("B",2)]).edges() >> >> > > [(1, 'A', None), (2, 'B', None)] >> >> > > >> >> > > -- >> >> > > You received this message because you are subscribed to the Google >> >> > > Groups "sage-devel" group. >> >> > > To unsubscribe from this group and stop receiving emails from it, >> >> > > send an email to sage-devel+...@googlegroups.com. >> >> > > To view this discussion on the web visit >> >> > > https://groups.google.com/d/msgid/sage-devel/CAGUWgD9zHPdu2ifxaMOc%3DEaUN5B9A_v6RmDXMLkFLCvc-Etc0w%40mail.gmail.com. >> > >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "sage-devel" group. >> > To unsubscribe from this group and stop receiving emails from it, send an >> > email to sage-devel+...@googlegroups.com. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msgid/sage-devel/1ec8c4cf-c0d5-4682-8d10-8e74d0779dfdn%40googlegroups.com. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-devel/af6e1bb0-9662-4994-ba14-28ffe010e68fn%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAGEwAAmFM9OEo%3DC2_qv%2BCX7wuBBoJKdhzJLwwPkoeeR_w7JVAQ%40mail.gmail.com.