Ask Your Question

Plotting a Cayley graph

asked 2021-07-19 18:21:04 +0200

salam gravatar image

I want to plot a Cayley graph that its connection set is derangements. I mean

I wrote this code, but it fails to run.

G = SymmetricGroup(3)
CG = G.cayley_graph(generators = Derangements(3))
CGU = CG.to_undirected()

Could you please give me help?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-07-19 20:32:10 +0200

updated 2021-07-20 01:33:16 +0200

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()

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 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.

edit flag offensive delete link more


@john, thank you so much.

salam gravatar imagesalam ( 2021-07-20 15:29:42 +0200 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2021-07-19 18:21:04 +0200

Seen: 439 times

Last updated: Jul 20 '21