dwave_networkx.chimera_graph¶

chimera_graph
(m, n=None, t=None, create_using=None, node_list=None, edge_list=None, data=True, coordinates=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. If None, calculated from (m, n, t). Note that this list is used to remove nodes, so any nodes specified not in range(m * n * 2 * t) are not added.
edge_list (iterable (optional, default None)) – Iterable of edges in the graph. If None, edges are generated as described below. The nodes in each edge must be integerlabeled in
range(m * n * t * 2)
.data (bool (optional, default True)) – If True, each node has a chimera_index attribute. The attribute is a 4tuple Chimera index as defined below.
coordinates (bool (optional, default False)) – If True, node labels are 4tuples, 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 int.
 Returns
G – An (m, n, t) Chimera lattice. Nodes are labeled by integers.
 Return type
NetworkX Graph
A Chimera lattice is an mbyn 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 nodeindexing notation (i,j,u,k) for each node.
(i,j) indexes the (row, column) of the Chimera tile. i must be between 0 and m1, inclusive, and j must be between 0 and n1, inclusive.
u=0 indicates the lefthand nodes in the tile, and u=1 indicates the righthand nodes.
k=0,1,…,t1 indexes nodes within either the left or righthand 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)]