Ask Your Question

Revision history [back]

The reason is simple.

A graph coloring is a dictionary whose keys are colours and values are lists of vertices of that colour.

The thing is, each list of vertices is sorted.

sage: from sage.graphs.graph_coloring import all_graph_colorings
sage: G = Graph({0: [1], 1: [2], 2: [3, 5], 3: [4, 6]})
sage: C = list(all_graph_colorings(G, 3, hex_colors=True))

Your example has [6, 2] as the last list:

sage: D = {'#ff0000': [0, 4, 5], '#0000ff': [1, 3], '#00ff00': [6, 2]}
sage: D in C
False

Using [2, 6] instead:

sage: D = {'#ff0000': [0, 4, 5], '#0000ff': [1, 3], '#00ff00': [2, 6]}
sage: D in C
True