Skip to content

Commit 06ce4b4

Browse files
committed
fix relabel for permutation groups
1 parent 30b3d78 commit 06ce4b4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/sage/graphs/generic_graph.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23067,6 +23067,14 @@ def relabel(self, perm=None, inplace=True, return_map=False, check_input=True, c
2306723067
[0 0 1]
2306823068
[0 0 1]
2306923069
[1 1 0]
23070+
sage: G = graphs.CycleGraph(5)
23071+
sage: G.relabel({u: str(u) for u in G}, inplace=True)
23072+
sage: ar = G.automorphism_group().random_element() # needs sage.groups
23073+
sage: H = G.relabel(ar, inplace=False) # needs sage.groups
23074+
sage: G.is_isomorphic(H, certificate=True)[1] # needs sage.groups
23075+
{'0': '3', '1': '2', '2': '1', '3': '0', '4': '4'}
23076+
sage: {u: ar(u) for u in G} # needs sage.groups
23077+
{'0': '3', '1': '2', '2': '1', '3': '0', '4': '4'}
2307023078

2307123079
A way to get a random relabeling::
2307223080

@@ -23225,13 +23233,8 @@ def relabel(self, perm=None, inplace=True, return_map=False, check_input=True, c
2322523233
perm = dict(perm)
2322623234

2322723235
elif isinstance(perm, PermutationGroupElement):
23228-
n = self.order()
23229-
ddict = {}
23230-
for i in range(1, n):
23231-
ddict[i] = perm(i) % n
23232-
if n > 0:
23233-
ddict[0] = perm(n) % n
23234-
perm = ddict
23236+
# Each vertex is relabeled according to the permutation group
23237+
perm = {u: perm(u) for u in self}
2323523238

2323623239
else:
2323723240
# Check for generic iterable/callable

0 commit comments

Comments
 (0)