Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The parameter you are trying to pass to .cayley_graph() is not the first one, and thus you need to name it. 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

The parameter generators you are trying to pass to .cayley_graph() is not the first one, one (the first one is side), and thus you need to name it. 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

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)) 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() I = [h.to_undirected() for h in H]
k=[i.chromatic_number() k = [i.chromatic_number() for i in I]
k