I am trying implement MAXCUT using QAOA. I have a graph with edges defined by an edges set. My edges set looks a bit like this:
edges_set = [Edge(0, 1), Edge(1, 2), Edge(2, 3), Edge(3, 0), Edge(2, 0), Edge(1, 3), Edge(0, 4), Edge(1, 4), Edge(2, 4), Edge(3, 4), Edge(4, 5), Edge(5, 0), Edge(2, 6), Edge(6, 3)]
The Edge object is already well defined as follows:
class Edge: """ This is a class defining the edges of the Graph that will be used by Networkx for the purpose of implementation and demonstration of the QAOA algorithm Attributes ---------- start_node : (int) This is a variable containing the starting node of a connecting edge in the Graph end_node : (int) This is a variable containing the ending node of a connecting edge in the Graph """ def __init__(self, start_node, end_node): self.start_node = start_node self.end_node = end_node
Now I'm trying to take this set of edges and turn them into GridQubits with assigned Qids. But I'm having trouble figuring out what would be the best way of going about this. I want to do this because, in the end, I want to visualize my MAXCUT coloring as they did in the Cirq QAOA tutorial as given here. But I cannot directly feed in my graph as that throws the error
Gate was called with type different than Qid. Type: <class 'str'>
Any help would be absolutely fantastic. Thanks in advance!