# Cayley graph side error

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 close merge delete

Sort by » oldest newest most voted 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

more