dwave_networkx.chimera_graph#

chimera_graph(m, n=None, t=None, create_using=None, node_list=None, edge_list=None, data=True, coordinates=False, check_node_list=False, check_edge_list=False)[source]#

Creates a Chimera lattice of size (m, n, t).

Parameters:
  • m (int) – Number of rows in the Chimera lattice.

  • n (int (optional, default m)) – Number of columns in the Chimera lattice.

  • t (int (optional, default 4)) – Size of the shore within each Chimera tile.

  • create_using (Graph (optional, default None)) – If provided, this graph is cleared of nodes and edges and filled with the new graph. Usually used to set the type of the graph.

  • node_list (iterable (optional, default None)) – Iterable of nodes in the graph. The nodes should typically be compatible with the requested lattice-shape parameters and coordinate system; incompatible nodes are accepted unless you set check_node_list=True. If not specified, calculated from (m, n, t) and coordinates per the topology description below; all \(2 t m n\) nodes are included.

  • edge_list (iterable (optional, default None)) – Iterable of edges in the graph. Edges must be 2-tuples of the nodes specified in node_list, or calculated from (m, n, t) and coordinates per the topology description below; incompatible edges are ignored unless you set check_edge_list=True. If not specified, all edges compatible with the node_list and topology description are included.

  • data (bool (optional, default True)) – If True, each node has a chimera_index attribute. The attribute is a 4-tuple Chimera index as defined below.

  • coordinates (bool (optional, default False)) – If True, node labels are 4-tuples, equivalent to the chimera_index attribute as below. In this case, the data parameter controls the existence of a linear_index attribute, which is an integer.

  • check_node_list (bool (optional, default False)) – If True, the node_list elements are checked for compatibility with the graph topology and node labeling conventions, and an error is thrown if any node is incompatible or duplicates exist. In other words, the node_list must specify a subgraph of the full-yield graph described below. An exception is allowed if check_edge_list=False, in which case any node in edge_list is treated as valid.

  • check_edge_list (bool (optional, default False)) – If True, the edge_list elements are checked for compatibility with the graph topology and node labeling conventions, an error is thrown if any edge is incompatible or duplicates exist. In other words, the edge_list must specify a subgraph of the full-yield graph described below.

Returns:

G – An (m, n, t) Chimera lattice. Nodes are labeled by integers.

Return type:

NetworkX Graph

A Chimera lattice is an m-by-n grid of Chimera tiles. Each Chimera tile is itself a bipartite graph with shores of size t. The connection in a Chimera lattice can be expressed using a node-indexing notation (i, j, u, k) for each node.

  • (i, j) indexes the (row, column) of the Chimera tile. i must be between 0 and m - 1, inclusive, and j must be between 0 and n - 1, inclusive.

  • u=0 indicates the left-hand nodes in the tile, and u=1 indicates the right-hand nodes.

  • k=0, 1, …, t - 1 indexes nodes within either the left- or right-hand shores of a tile.

In this notation, two nodes (i, j, u, k) and (i’, j’, u’, k’) are neighbors if and only if:

(i = i’ AND j = j’ AND u != u’) OR (i = i’ +/- 1 AND j = j’ AND u = 0 AND u’ = 0 AND k = k’) OR (i = i’ AND j = j’ +/- 1 AND u = 1 AND u’ = 1 AND k = k’)

The first of the three terms of the disjunction gives the bipartite connections within the tile. The second and third terms give the vertical and horizontal connections between blocks respectively.

Node (i, j, u, k) is labeled by:

label = i * n * 2 * t + j * 2 * t + u * t + k

Examples

>>> G = dnx.chimera_graph(1, 1, 2)  # a single Chimera tile
>>> len(G)
4
>>> list(G.nodes())  
[0, 1, 2, 3]
>>> list(G.nodes(data=True))  
[(0, {'chimera_index': (0, 0, 0, 0)}),
 (1, {'chimera_index': (0, 0, 0, 1)}),
 (2, {'chimera_index': (0, 0, 1, 0)}),
 (3, {'chimera_index': (0, 0, 1, 1)})]
>>> list(G.edges())  
[(0, 2), (0, 3), (1, 2), (1, 3)]