dwave.graphs.find_chimera_indices#

find_chimera_indices(G: Graph) dict[Hashable, tuple[int, int, int, int]][source]#

Determines the Chimera indices of the nodes in graph G.

See the chimera_graph() function for a definition of a Chimera graph and Chimera indices.

Parameters:

G – Should be a single-tile Chimera graph.

Returns:

(i, j, u, k), …} where (i, j, u, k) is a 4-tuple of integer Chimera indices.

Return type:

A dict of the form {node

Examples

>>> G = dwave.graphs.chimera_graph(1, 1, 4)
>>> chimera_indices = dwave.graphs.find_chimera_indices(G)
>>> G = nx.Graph()
>>> G.add_edges_from([(0, 2), (1, 2), (1, 3), (0, 3)])
>>> chimera_indices = dwave.graphs.find_chimera_indices(G)
>>> nx.set_node_attributes(G, chimera_indices, 'chimera_index')