dwave_networkx.drawing.pegasus_layout.draw_pegasus¶
- draw_pegasus(G, crosses=False, **kwargs)[source]¶
Draws graph G in a Pegasus topology.
If
linear_biases
and/orquadratic_biases
are provided, these are visualized on the plot.- Parameters
G (NetworkX graph) – A Pegasus graph or a subgraph of a Pegasus graph, as produced by the
dwave_networkx.pegasus_graph()
function.linear_biases (dict (optional, default {})) – Biases as a dict, of form {node: bias, …}, where keys are nodes in G and biases are numeric.
quadratic_biases (dict (optional, default {})) – Biases as a dict, of form {edge: bias, …}, where keys are edges in G and biases are numeric. Self-loop edges (i.e., \(i=j\)) are treated as linear biases.
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
.kwargs (optional keywords) – See networkx.draw_networkx() for a description of optional keywords, with the exception of the
pos
parameter, which is not used by this function. Iflinear_biases
orquadratic_biases
are provided, any providednode_color
oredge_color
arguments 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()