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 quarter (4 by 4 Chimera tiles) of a particular D-Wave system’s working graph.
>>> import dwave_networkx as dnx >>> from dwave.system import DWaveSampler, common_working_graph ... >>> sampler = DWaveSampler() >>> C4 = dnx.chimera_graph(4) # a 4x4 lattice of Chimera tiles >>> c4_working_graph = common_working_graph(C4, sampler.adjacency)