# How to formulate QUBO as summation quadratic and linear parts of K-graph coloring problem?

While trying to understand the graph coloring problem with VQE using the QUBO Formulation mentioned section "5.2 Graph Coloring". Mentioned article prepared the QUBO directly in to matrix form as shown below. But would like to achieve through the python code.

My query: What shall be the initial matrix we need to consider? ex: all zero or all one's

I am assuming shall look like linear_term * x + xT * qudratic_term * x. if there is better approach please do share.

I am able to get solution with the hard coded matrix as mentioned in the paper using VQE. But i want to try with the python code for the matrix part.

And graph part as shown below

G = nx.Graph()
G.add_edges_from([(1, 2), (1, 5), (2, 3), (2, 4), (2, 5), (3, 4), (4, 5)])
nx.draw(G, with_labels=True)


Please share the hints or reference for further explore.

Thank you

• Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
– Community Bot
Dec 16, 2021 at 13:25
• not able to delete the post due to a non registered user. So deleted the content.. Thanks for replying
– Ket
Dec 16, 2021 at 16:52
• @Ket why do you want to delete the post? Dec 16, 2021 at 18:11