dwave.graphs.algorithms.coloring.pegasus_four_color#

pegasus_four_color(q: tuple[int, int, int, int]) int[source]#

Returns a node color sufficient for four coloring a Pegasus graph.

Parameters:

q – Qubit label in standard coordinate format: (u, w, k, z).

Returns:

A color in {0, 1, 2, 3}.

Example

A mapping of every qubit in a Pegasus[m] graph to one of four colors.

>>> m = 2
>>> G = dwave.graphs.pegasus_graph(m, coordinates=True)
>>> colors = {q: dwave.graphs.pegasus_four_color(q) for q in G.nodes()}