dwave_networkx.drawing.pegasus_layout.pegasus_layout

pegasus_layout(G, scale=1.0, center=None, dim=2, crosses=False)[source]

Positions the nodes of graph G in a Pegasus topology.

NumPy is required for this function.

Parameters
  • G (NetworkX graph) – A Pegasus graph or a subgraph of a Pegasus graph, as produced by the dwave_networkx.pegasus_graph() function.

  • scale (float (default 1.)) – Scale factor. A setting of scale = 1 fits all positions within [0, 1] on the x-axis and [-1, 0] on the y-axis.

  • center (None or array (default None)) – Coordinates of the top left corner.

  • dim (int (default 2)) – Number of dimensions. When dim > 2, all extra dimensions are set to 0.

  • crosses (boolean (optional, default False)) – If True, \(K_{4,4}\) subgraphs are shown in a cross rather than L configuration. Ignored if G is defined with nice_coordinates=True.

Returns

pos – Positions as a dictionary keyed by node.

Return type

dict

Examples

This example gives the positions of a Pegasus lattice of size 2.

>>> G = dnx.pegasus_graph(2)
>>> pos = dnx.pegasus_layout(G)