If any one wants to, here is a very minor change you could make in the calculation of chromatic number that would make it faster! The change is to take the line that says
if len(G.edges()) == 0:
to
if G.size() == 0:
def chromatic_number(G):
r"""
Returns the minimal number of colors needed to color the
vertices of the graph `G`.
EXAMPLES::
sage: from sage.graphs.graph_coloring import chromatic_number
sage: G = Graph({0:[1,2,3],1:[2]})
sage: chromatic_number(G)
3
sage: G = graphs.PetersenGraph()
sage: G.chromatic_number()
3
"""
o = G.order()
if o == 0:
return 0
if len(G.edges()) == 0:
return 1
elif G.is_bipartite(): #can we do it in linear time?
return 2
else: #counting cliques is faster than our brute-force method...
m = G.clique_number()
if m >= o-1: #marginal improvement... if there's an o-1 clique and not an o clique, don't waste our time coloring.
return m
for n in range(m,o+1):
for C in all_graph_colorings(G,n):
return n