Constructing Cayley Graphs in SageMath

591 Views Asked by At

I am having confusions in constructing a Cayley Graph in Sage Math. Say, I want to construct the Cayley graph on the Symmetric Group $S_4$ with respect to the generating set consisting of all transpositions, what code do I use.

I tried the following minimal code:

CG = G.cayley_graph(generators = [PermutationGroupElement([1,2]),PermutationGroupElement([1,3]),PermutationGroupElement([1,4]),PermutationGroupElement([2,3]),PermutationGroupElement([2,4]),PermutationGroupElement([3,4])])
CGU = CG.to_undirected()
CGU.show()

But, I get the error

    502         if not is_valid_permutation(self.perm, self.n):
--> 503             raise ValueError("invalid data to initialize a permutation")
    504 
    505         # This is more expensive

ValueError: invalid data to initialize a permutation

How do I rectify the code so as to produce my desired Cayley Graph. Thanks beforehand.

1

There are 1 best solutions below

1
On BEST ANSWER

I had success with the following:

G=SymmetricGroup(4)
CG = G.cayley_graph(generators=[G((1,2)),G((1,3)),G((1,4)),G((2,3)),G((2,4)),G((3,4))])
CGU = CG.to_undirected()
CGU.show()