dwave-system
dwave-system copied to clipboard
Add `target_edges` parameter to pegasus.find_clique_embedding
Current Problem
Unlike the Chimera version of find_clique_embedding, the Pegasus version requires a NetworkX graph.
Proposed Solution
Similar parameter to Chimera's find_clique_embedding
Alternatives Considered Grunt work to use the existing function:
G =nx.Graph()
G.add_nodes_from(qpu.nodelist)
G.add_edges_from(qpu.edgelist)
p6 = dnx.pegasus_graph(6)
missing_nodes = [node for node in p6.nodes if node not in G.nodes]
missing_edges = [edge for edge in p6.edges if edge not in G.edges]
p6.remove_nodes_from(missing_nodes)
p6.remove_edges_from(missing_edges)
Additional context Advantage
Preferred Alternative:
import dwave_networkx as dnx
import dwave.embedding as dwe
p = dnx.pegasus_graph(6, node_list = qpu.nodelist, edge_list = qpu.edgelist)
# even more preferable, already-requested feature:
# p = dnx.pegasus_graph(solver=qpu)
emb = dwe.pegasus.find_clique_embedding(k, target_graph=p)
See also https://github.com/dwavesystems/dwave_networkx/issues/165
I think this has largely been resolved by the addition to to_networkx_graph() method.