qml.qaoa.cycle.edges_to_wires

edges_to_wires(graph: networkx.classes.graph.Graph)Dict[Tuple, int][source]

Maps the edges of a graph to corresponding wires.

Example

>>> g = nx.complete_graph(4).to_directed()
>>> edges_to_wires(g)
{(0, 1): 0,
 (0, 2): 1,
 (0, 3): 2,
 (1, 0): 3,
 (1, 2): 4,
 (1, 3): 5,
 (2, 0): 6,
 (2, 1): 7,
 (2, 3): 8,
 (3, 0): 9,
 (3, 1): 10,
 (3, 2): 11}
Parameters

graph (nx.Graph) – the graph specifying possible edges

Returns

a mapping from graph edges to wires

Return type

Dict[Tuple, int]