-
-
Notifications
You must be signed in to change notification settings - Fork 654
Description
There are several cases in relabel()
which assume sorting of vertices.
The following cases are fixed:
-
perm=None
. This should just relabel with integers from 0 to N-1 in an arbitrary order (as the documentation already says). -
perm
is a callable. This is easy to avoid, as the ordering of the vertices is not used in the code:
elif callable(perm):
perm = dict( [ i, perm(i) ] for i in self.vertices() )
complete_partial_function = False
This broke several functions which did assume a particular ordering for G.relabel(perm=None)
. Those are fixed by using G.relabel(perm=range(G.order()))
instead.
Furthermore, we allow arbitrary iterables to be given for relabeling instead of only list
and tuple
. This improves things with Python 3 where range()
becomes an iterator.
CC: @dcoudert
Component: graph theory
Author: Jeroen Demeyer
Branch/Commit: a7eaec9
Reviewer: David Coudert
Issue created by migration from https://trac.sagemath.org/ticket/27027