dwave.embedding.pegasus.find_clique_embedding#
- find_clique_embedding(k, m=None, target_graph=None)[source]#
Find an embedding for a clique in a Pegasus graph.
Given a clique (fully connected graph) and target Pegasus graph, attempts to find an embedding by transforming the Pegasus graph into a \(K_{2,2}\) Chimera graph and then applying a Chimera clique-finding algorithm. Results are converted back to Pegasus coordinates.
- Parameters:
k (int/iterable/
networkx.Graph
) – A complete graph to embed, formatted as a number of nodes, node labels, or a NetworkX graph.m (int) – Number of tiles in a row of a square Pegasus graph. Required to generate an m-by-m Pegasus graph when target_graph is None.
target_graph (
networkx.Graph
) – A Pegasus graph. Required when m is None.
- Returns:
An embedding as a dict, where keys represent the clique’s nodes and values, formatted as lists, represent chains of pegasus coordinates.
- Return type:
Examples
This example finds an embedding for a \(K_3\) complete graph in a 2-by-2 Pegaus graph.
>>> from dwave.embedding.pegasus import find_clique_embedding ... >>> print(find_clique_embedding(3, 2)) {0: [10, 34], 1: [35, 11], 2: [32, 12]}