dwave.system.utilities.common_working_graph#
- common_working_graph(graph0, graph1)[source]#
Creates a graph using the common nodes and edges of two given graphs.
This function finds the edges and nodes with common labels. Note that this not the same as finding the greatest common subgraph with isomorphisms.
- Parameters:
- Returns:
A graph with the nodes and edges common to both input graphs.
- Return type:
Examples
This example creates a graph that represents a part of a particular Advantage quantum computer’s working graph.
>>> import dwave_networkx as dnx >>> from dwave.system import DWaveSampler, common_working_graph ... >>> sampler = DWaveSampler(solver={'topology__type': 'pegasus'}) >>> P3 = dnx.pegasus_graph(3) >>> p3_working_graph = common_working_graph(P3, sampler.adjacency)