Ask Your Question

Revision history [back]

If I change the invocation of cayley_graph, it works for me:

G = SymmetricGroup(3)
CG = G.cayley_graph(generators = [x.to_permutation() for x in Derangements(3)])
CGU = CG.to_undirected()
CGU.show()

Explanation: When I ran G.cayley_graph(generators = Derangements(3)), it gave the error 'Derangements_with_category' object has no attribute 'keys' , so I thought I would try to just past a list of derangements: G.cayley_graph(generators = list(Derangements(3))). That produced a different error: invalid data to initialize a permutation. However, derangements have a method to convert them to a permutation: if x is a derangement, then x.to_permutation() is the corresponding permutation.

If I change the invocation of cayley_graph, it works for me:

G = SymmetricGroup(3)
CG = G.cayley_graph(generators = [x.to_permutation() for x in Derangements(3)])
CGU = CG.to_undirected()
CGU.show()

Explanation: When I ran G.cayley_graph(generators = Derangements(3)), it gave the error 'Derangements_with_category' object has no attribute 'keys' , so I thought I would try to just past pass a list of derangements: G.cayley_graph(generators = list(Derangements(3))). That produced a different error: invalid data to initialize a permutation. However, derangements have a method to convert them to a permutation: if x is a derangement, then x.to_permutation() is the corresponding permutation.