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.- Parameters:
G (NetworkX graph) – Pegasus graph or a subgraph of a Pegasus graph as produced by the
dwave_networkx.pegasus_graph()
function.scale (float (default 1.)) – Scale factor. If
scale
= 1, all positions fit 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. If
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 an L configuration. If
G
is defined withnice_coordinates=True
, this parameter is ignored.
- Returns:
pos – Positions as a dictionary keyed by node.
- Return type:
Examples
This example gives the positions of a Pegasus lattice of size 2.
>>> G = dnx.pegasus_graph(2) >>> pos = dnx.pegasus_layout(G)