Ask Your Question
0

Cayley graph side error

asked 2022-08-12 17:52:16 +0200

vidyarthi gravatar image

updated 2022-08-12 17:52:55 +0200

Why is the following code giving me error? I want to construct several cayley graphs at once and find their chromatic numbers. Though in the below example, the graphs are all bipartite, but in a general example, how do we proceed?

import itertools
from sage.graphs.graph_coloring import chromatic_number
G=SymmetricGroup(4)
l=[G((1,2)),G((1,3)),G((1,4)),G((2,3)),G((2,4)),G((3,4))]
m=itertools.combinations(l,4)
H=[G.cayley_graph(list(s)) for s in m]
I=[h.to_undirected() for h in H]
k=[i.chromatic_number for i in I]
k

The error I got on the console is Value error: option 'side' must be 'left', 'right' or 'twosided' pointing to cayley graph construction. Kindly help me in this regard. Thanks beforehand.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-08-12 23:42:11 +0200

Max Alekseyev gravatar image

updated 2022-08-13 06:07:22 +0200

slelievre gravatar image

The parameter generators you are trying to pass to .cayley_graph() is not the first one (the first one is side), and thus you need to name it explicitly. Also, you forgot () after the .chromatic_number. Here is a corrected code:

import itertools
from sage.graphs.graph_coloring import chromatic_number
G = SymmetricGroup(4)
l = [G((1, 2)), G((1, 3)), G((1, 4)), G((2, 3)), G((2, 4)), G((3, 4))]
m = itertools.combinations(l, 4)
H = [G.cayley_graph(generators=list(s)) for s in m]
I = [h.to_undirected() for h in H]
k = [i.chromatic_number() for i in I]
k
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

1 follower

Stats

Asked: 2022-08-12 17:52:16 +0200

Seen: 119 times

Last updated: Aug 13 '22