dwave_networkx.drawing.pegasus_layout.draw_pegasus#
- draw_pegasus(G, crosses=False, **kwargs)[source]#
Draws 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.linear_biases (dict (optional, default {})) – Linear biases as a dict of the form
{node: bias, ...}
, where keys are nodes inG
and biases are numeric. If specified, the linear biases are visualized on the plot.quadratic_biases (dict (optional, default {})) – Quadratic biases as a dict of the form
{edge: bias, ...}
, where keys are edges inG
and biases are numeric. Self-loop edges (i.e., \(i=j\)) are treated as linear biases. If specified, the quadratic biases are visualized on the plot.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.kwargs (optional keywords) – Parameters in
draw_networkx()
, except for thepos
parameter. If thelinear_biases
orquadratic_biases
parameters are specified, thedraw_networkx()
node_color
oredge_color
parameters are ignored.
Examples
This example plots a Pegasus graph with size parameter 2.
>>> import networkx as nx >>> import dwave_networkx as dnx >>> import matplotlib.pyplot as plt >>> G = dnx.pegasus_graph(2) >>> dnx.draw_pegasus(G) >>> plt.show()