def draw_pegasus_embedding(G, *args, **kwargs): """Draws an embedding onto the pegasus graph G, according to layout. If interaction_edges is not None, then only display the couplers in that list. If embedded_graph is not None, the only display the couplers between chains with intended couplings according to embedded_graph. Parameters ---------- G : NetworkX graph Should be a Pegasus graph or a subgraph of a Pegasus graph. This should be the product of dwave_networkx.pegasus_graph emb : dict A dict of chains associated with each node in G. Should be of the form {node: chain, ...}. Chains should be iterables of qubit labels (qubits are nodes in G). embedded_graph : NetworkX graph (optional, default None) A graph which contains all keys of emb as nodes. If specified, edges of G will be considered interactions if and only if they exist between two chains of emb if their keys are connected by an edge in embedded_graph interaction_edges : list (optional, default None) A list of edges which will be used as interactions. show_labels: boolean (optional, default False) If show_labels is True, then each chain in emb is labelled with its key. chain_color : dict (optional, default None) A dict of colors associated with each key in emb. Should be of the form {node: rgba_color, ...}. Colors should be length-4 tuples of floats between 0 and 1 inclusive. If chain_color is None, each chain will be assigned a different color. unused_color : tuple (optional, default (0.9,0.9,0.9,1.0)) The color to use for nodes and edges of G which are not involved in chains, and edges which are neither chain edges nor interactions. If unused_color is None, these nodes and edges will not be shown at all. crosses: boolean (optional, default False) If crosses is True, K_4,4 subgraphs are shown in a cross rather than L configuration. Ignored if G was defined with nice_coordinates=True. overlapped_embedding: boolean (optional, default False) If overlapped_embedding is True, then chains in emb may overlap (contain the same vertices in G), and the drawing will display these overlaps as concentric circles. 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. If `linear_biases` or `quadratic_biases` are provided, any provided `node_color` or `edge_color` arguments are ignored. """ crosses = kwargs.pop("crosses", False) draw_embedding(G, pegasus_layout(G, crosses=crosses), *args, **kwargs)
def draw_pegasus_embedding(G, *args, **kwargs): """Draws an embedding onto Pegasus graph G. Parameters ---------- G : NetworkX graph A Pegasus graph or a subgraph of a Pegasus graph, as produced by the :func:`dwave_networkx.pegasus_graph` function. emb : dict Chains, as a dict of form {qubit: chain, ...}, where qubits are nodes in G and chains are iterables of qubit labels. embedded_graph : NetworkX graph (optional, default None) A graph that contains all keys of ``emb`` as nodes. If specified, edges of G are considered interactions if and only if (1) they exist between two chains of ``emb`` and (2) their keys are connected by an edge in this graph. If given, only couplers between chains based on this graph are displayed. interaction_edges : list (optional, default None) A list of edges used as interactions. If given, only these couplers are displayed. show_labels: boolean (optional, default False) If True, each chain in ``emb`` is labelled with its key. chain_color : dict (optional, default None) Colors as a dict of form {node: rgba_color, ...} associated with each key in ``emb``, where colors are length-4 tuples of floats between 0 and 1 inclusive. If None, each chain is assigned a different color. unused_color : tuple (optional, default (0.9,0.9,0.9,1.0)) Color for nodes of G that are not part of chains, and edges that are neither chain edges nor interactions. If None, these nodes and edges are not shown. crosses: boolean (optional, default False) If True, :math:`K_{4,4}` subgraphs are shown in a cross rather than L configuration. Ignored if G is defined with ``nice_coordinates=True``. overlapped_embedding: boolean (optional, default False) If True, chains in ``emb`` may overlap (contain the same vertices in G), and these overlaps are displayed as concentric circles. 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. If ``linear_biases`` or ``quadratic_biases`` are provided, any provided ``node_color`` or ``edge_color`` arguments are ignored. """ crosses = kwargs.pop("crosses", False) draw_embedding(G, pegasus_layout(G, crosses=crosses), *args, **kwargs)
def draw_zephyr_embedding(G, *args, **kwargs): """Draws an embedding onto Zephyr graph G. Parameters ---------- G : NetworkX graph A Zephyr graph or a subgraph of a Zephyr graph, as produced by the :func:`dwave_networkx.zephyr_graph` function. emb : dict Minor-embedding as a dict of form {node: chain, ...}, where ``node`` are nodes in G and ``chain`` are iterables of qubit labels. embedded_graph : NetworkX graph (optional, default None) A graph that contains all keys of ``emb`` as nodes. If specified, edges of G are considered interactions if and only if (1) they exist between two chains of ``emb`` and (2) the keys of the corresponding chains are connected by an edge in the given graph. If given, only couplers between chains based on this graph are displayed. interaction_edges : list (optional, default None) A list of edges used as interactions. If given, only these couplers are displayed. show_labels: boolean (optional, default False) If True, each chain in ``emb`` is labelled with its key. chain_color : dict (optional, default None) Colors as a dict of form {node: rgba_color, ...} associated with each key in ``emb``, where colors are length-4 tuples of floats between 0 and 1 inclusive. If None, each chain is assigned a different color. unused_color : tuple (optional, default (0.9,0.9,0.9,1.0)) Color for nodes of G that are not part of chains, and edges that are neither chain edges nor interactions. If None, these nodes and edges are not shown. overlapped_embedding: boolean (optional, default False) If True, chains in ``emb`` may overlap (contain the same vertices in G), and these overlaps are displayed as concentric circles. kwargs : optional keywords See :func:`~networkx.drawing.nx_pylab.draw_networkx` for a description of optional keywords, with the exception of the ``pos`` parameter, which is unsupported. If the ``linear_biases`` or ``quadratic_biases`` parameters are provided, any provided ``node_color`` or ``edge_color`` arguments are ignored. """ draw_embedding(G, zephyr_layout(G), *args, **kwargs)
def draw_chimera_embedding(G, *args, **kwargs): """Draws an embedding onto the chimera graph G, according to layout. If interaction_edges is not None, then only display the couplers in that list. If embedded_graph is not None, the only display the couplers between chains with intended couplings according to embedded_graph. Parameters ---------- G : NetworkX graph Should be a Chimera graph or a subgraph of a Chimera graph. emb : dict A dict of chains associated with each node in G. Should be of the form {node: chain, ...}. Chains should be iterables of qubit labels (qubits are nodes in G). embedded_graph : NetworkX graph (optional, default None) A graph which contains all keys of emb as nodes. If specified, edges of G will be considered interactions if and only if they exist between two chains of emb if their keys are connected by an edge in embedded_graph interaction_edges : list (optional, default None) A list of edges which will be used as interactions. show_labels: boolean (optional, default False) If show_labels is True, then each chain in emb is labelled with its key. chain_color : dict (optional, default None) A dict of colors associated with each key in emb. Should be of the form {node: rgba_color, ...}. Colors should be length-4 tuples of floats between 0 and 1 inclusive. If chain_color is None, each chain will be assigned a different color. unused_color : tuple (optional, default (0.9,0.9,0.9,1.0)) The color to use for nodes and edges of G which are not involved in chains, and edges which are neither chain edges nor interactions. If unused_color is None, these nodes and edges will not be shown at all. 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. If `linear_biases` or `quadratic_biases` are provided, any provided `node_color` or `edge_color` arguments are ignored. """ draw_embedding(G, chimera_layout(G), *args, **kwargs)