Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Constructing Cayley Graphs

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?

Constructing Cayley Graphs

I am having confusions in constructing a Cayley Graph in Sage Math. Math. Say, I want to construct the Cayley graph on the Symmetric Group $S_4$ $S_4$ with respect to the generating set consisting of all transpositions, 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])])
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

expensive ValueError: invalid data to initialize a permutation ````

How do I rectify the code so as to produce my desired Cayley Graph. Any suggestions?

click to hide/show revision 3
retagged

Constructing Cayley Graphs

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?