dwave_networkx.find_chimera_indices#

find_chimera_indices(G)[source]#

Attempts to determine 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 (NetworkX graph) – Should be a single-tile Chimera graph.

Returns:

chimera_indices – A dict of the form {node: (i, j, u, k), …} where (i, j, u, k) is a 4-tuple of integer Chimera indices.

Return type:

dict

Examples

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