Dear list, Relabeling a graph in Sage 9.2 exhibits some strange behavior. If the argument is a dictionary constructed by dictionary comprehension Sage seems to just ignore it. If the dictionary is explicitly given then everything works. Here is an example
sage: bar = DiGraph([((2, 3), (1, 2), 2), ((3, 4), (3, 5), 3), ((3, 5), (2, 3), 3), ((5, 6), (5, 7), 5), ((5, 7), (3, 5), 5)]) sage: foo = [(5,6), (3,4), (5,7), (3,5), (2,3), (1,2)] sage: bar.relabel({foo[i]: i for i in range(6)}) sage: bar.vertices() [(1, 2), (2, 3), (3, 4), (3, 5), (5, 6), (5, 7)] sage: ## However if I explicitly give the dictionary sage: {foo[i]: i for i in range(6)} {(5,6): 0, (3,4): 1, (5,7): 2, (3,5): 3, (2,3): 4, (1,2): 5} sage: bar.relabel({(5,6): 0, (3,4): 1, (5,7): 2, (3,5): 3, (2,3): 4, (1,2): 5}) sage: bar.vertices() [0, 1, 2, 3, 4, 5] sage: sage0_version() 'SageMath version 9.2, Release Date: 2020-10-24' This problem doesn't seem to happen in older versions of Sage. I have Sage 8.8 in another box and the problem doesn't occur: sage: bar = DiGraph([((2, 3), (1, 2), 2), ((3, 4), (3, 5), 3), ((3, 5), (2, 3), 3), ((5, 6), (5, 7), 5), ((5, 7), (3, 5), 5)]) sage: foo = [(5,6), (3,4), (5,7), (3,5), (2,3), (1,2)] sage: bar.relabel({foo[i]: i for i in range(6)}) sage: bar.vertices() [0, 1, 2, 3, 4, 5] sage: sage0_version() 'SageMath version 8.8, Release Date: 2019-06-26' I wonder if this is caused by the transition to Python3. Some kind of lazy evaluation? Thanks, Nikos Apostolakis -- Οι ελαφροί ας με λέγουν ελαφρόν. Στα σοβαρά πράγματα ήμουν πάντοτε επιμελέστατος. The frivolous can call me frivolous. In serious matters I've always been most diligent. K. P. Kavafy -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAO2SUmJnoUBYS88n4QP0oU_9odJVKJE053wLSH3%3Dz2ggeNDAAw%40mail.gmail.com.