# dwave_networkx.algorithms.coloring.vertex_color_qubo¶

vertex_color_qubo(G, colors)[source]

Return the QUBO with ground states corresponding to a vertex coloring.

If V is the set of nodes, E is the set of edges and C is the set of colors the resulting qubo will have:

• $$|V|*|C|$$ variables/nodes

• $$|V|*|C|*(|C| - 1) / 2 + |E|*|C|$$ interactions/edges

The QUBO has ground energy $$-|V|$$ and an infeasible gap of 1.

Parameters
• G (NetworkX graph) – The graph on which to find a minimum vertex coloring.

• colors (int/sequence) – The colors. If an int, the colors are labelled [0, n). The number of colors must be greater or equal to the chromatic number of the graph.

Returns

QUBO – The QUBO with ground states corresponding to valid colorings of the graph. The QUBO variables are labelled (v, c) where v is a node in G and c is a color. In the ground state of the QUBO, a variable (v, c) has value 1 if v should be colored c in a valid coloring.

Return type

dict
{"ft_lang_label":"__label__en","ft_lang_prob":0.76604205,"math_prob":0.9943053,"size":962,"snap":"2021-31-2021-39","text_gpt3_token_len":283,"char_repetition_ratio":0.14300627,"word_repetition_ratio":0.024096385,"special_character_ratio":0.27130976,"punctuation_ratio":0.104166664,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99530905,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-16T14:54:50Z\",\"WARC-Record-ID\":\"<urn:uuid:41ada73d-8461-419f-b518-9de1c232e7ba>\",\"Content-Length\":\"19018\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3b3da50d-6dec-42b7-a532-14b8aa69ad21>\",\"WARC-Concurrent-To\":\"<urn:uuid:43c56f78-6cbd-4eb3-8932-ee2c0fbfb420>\",\"WARC-IP-Address\":\"54.190.95.90\",\"WARC-Target-URI\":\"https://docs.ocean.dwavesys.com/en/stable/docs_dnx/reference/algorithms/generated/dwave_networkx.algorithms.coloring.vertex_color_qubo.html\",\"WARC-Payload-Digest\":\"sha1:WEBVQYU2JSJYQUKYX5KAXTOEZ3RYPE7P\",\"WARC-Block-Digest\":\"sha1:EMW3Z3LGHZEEGGJHP74QLAYJXJTGUXBO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780053657.29_warc_CC-MAIN-20210916145123-20210916175123-00575.warc.gz\"}"}