Ask Your Question
1

Constructing Cayley Graphs

asked 2022-04-22 13:48:42 +0200

vidyarthi gravatar image

updated 2024-04-12 11:12:11 +0200

FrédéricC gravatar image

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:

G = SymmetricGroup(4)
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

    501         # a valid permutation (else segfaults, infinite loops may occur).
    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. Any suggestions?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2022-04-24 10:21:32 +0200

rburing gravatar image

If you enter PermutationGroupElement? at a SageMath prompt you will see the required format of the input, and that your input doesn't satisfy any of the requirements.

Moreover, from the documentation of the cayley_graph method (accessed e.g. by entering G.cayley_graph?), you can see that you don't have to be so verbose when specifying generators which are cycles.

sage: G = SymmetricGroup(4)
sage: G.cayley_graph(generators=[(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)])
Digraph on 24 vertices
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2022-04-22 13:48:42 +0200

Seen: 370 times

Last updated: Apr 26 '22