Ask Your Question
1

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 https://doc.sagemath.org/html/en/refe...

I wrote this code, but it fails to run.

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

Could you please give me help?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

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

Comments

@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

Stats

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

Seen: 405 times

Last updated: Jul 20 '21