dwave_networkx.pegasus_sublattice_mappings#
- pegasus_sublattice_mappings(source, target, offset_list=None)[source]#
Yields mappings from a Chimera or Pegasus graph into a Pegasus graph.
A sublattice mapping is a function from the nodes of a
pegasus_graph(m_s)
orchimera_graph(m_c, n_c, 4)
to the nodes of apegasus_graph(m_t)
withm_s <= m_t
orm_c <= m_t - 1
andn_c <= m_t - 1
. This sublattice mapping is used to identify subgraphs of the target Pegasus graph that are isomorphic to the source graph. However, if the target graph is not of perfect yield,[1] this function does not generally produce isomorphisms; for example, if a node is missing in the target graph, it may still appear in the source graph’s image.Note that the function requires that the tile parameter of Chimera graphs to be 4, and the mappings produced are not exhaustive. The mappings take the form
(y, x, u, k) -> (t_offset, y+y_offset, x+x_offset, u, k)
when the source is a Chimera graph, or
(t, y, x, u, k) -> ((t + t_offset)%3, y+y_offset, x+x_offset, u, k)
when the source is a Pegasus graph, thus preserving the orientation and tile index of nodes. The notation of Chimera coordinates and Pegasus nice coordinates is used, but the mapping produced respects the labelings of the source and target graph. Note, the notation above for Pegasus-to-Pegasus mappings is only suggestive; see
_pegasus_pegasus_sublattice_mapping
in the source code for a precise formula.- Parameters:
source (NetworkX Graph) – The Chimera or Pegasus graph that nodes are input from.
target (NetworkX Graph) – The Pegasus graph that nodes are output to.
offset_list (iterable (tuple), optional (default None)) – An iterable of offsets that can be used to reconstruct a set of mappings since the offset used to generate a single mapping is stored in the
offset
attribute of that mapping.
- Yields:
mapping (function) – A function from the nodes of the source graph to the nodes of the target graph. The offset used to generate this mapping is stored in
mapping.offset
, which can be collected and passed intooffset_list
in a later session.
Notes
The full group of isomorphisms of a Chimera graph includes mappings which permute tile indices on a per-row and per-column basis in addition to reflections and rotations of the grid of unit tiles where rotations by 90 and 270 degrees induce a change in orientation. The isomorphisms of Pegasus graphs permit the swapping across rows and columns of odd couplers as well as a reflection about the main antidiagonal which induces a change in orientation. Although the full set of sublattice mappings would take those isomorphisms into account, this function does not handle that complex task.