diff --git a/docs/requirements.txt b/docs/requirements.txt index 8f9c56df..e601fec1 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,3 @@ -sphinx>=4.0.0,<5.0.0 +sphinx sphinx_rtd_theme dwave-greedy==0.3.0 \ No newline at end of file diff --git a/dwave/system/utilities.py b/dwave/system/utilities.py index 50747a94..63fa8af1 100644 --- a/dwave/system/utilities.py +++ b/dwave/system/utilities.py @@ -17,6 +17,7 @@ import os import json import networkx as nx +import warnings __all__ = ['common_working_graph', 'classproperty'] @@ -60,6 +61,9 @@ def common_working_graph(graph0, graph1): >>> p3_working_graph = common_working_graph(P3, sampler.adjacency) """ + warnings.warn("dwave.system.common_working_graph() is deprecated as of dwave-system 1.23.0 " + "and will be removed in dwave-system 2.0. Use networkx.intersection() instead.", + DeprecationWarning, stacklevel=2) G = nx.Graph() G.add_nodes_from(v for v in graph0 if v in graph1) diff --git a/setup.py b/setup.py index 7eaf071c..257c5ce3 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,6 @@ 'dwave-cloud-client>=0.11.0,<0.13.0', 'dwave-networkx>=0.8.10', 'dwave-preprocessing>=0.5.0', - 'networkx>=2.0,<3.0', 'homebase>=1.0.0,<2.0.0', 'minorminer>=0.2.8,<0.3.0', 'numpy>=1.21.6', # minimum inherited from minorminer diff --git a/tests/test_utilities.py b/tests/test_utilities.py index 233178b7..03d70033 100644 --- a/tests/test_utilities.py +++ b/tests/test_utilities.py @@ -26,7 +26,8 @@ class TestCommonWorkingGraph(unittest.TestCase): def test_single_tile(self): G1 = dnx.chimera_graph(1) - G = common_working_graph(G1, G1) + with self.assertWarns(DeprecationWarning): + G = common_working_graph(G1, G1) # should have 8 nodes self.assertEqual(len(G), 8) @@ -44,7 +45,8 @@ def test_c1_c2_tiles(self): G1 = dnx.chimera_graph(1) G2 = dnx.chimera_graph(2) - G = common_working_graph(G1, G1) + with self.assertWarns(DeprecationWarning): + G = common_working_graph(G1, G1) self.assertEqual(len(G), 8) @@ -53,7 +55,8 @@ def test_missing_node(self): G1.remove_node(2) G2 = dnx.chimera_graph(2) - G = common_working_graph(G1, G1) + with self.assertWarns(DeprecationWarning): + G = common_working_graph(G1, G1) self.assertNotIn(2, G) self.assertNotIn((2, 4), G.edges()) @@ -62,7 +65,8 @@ def test_sampler_adjacency(self): adj = {0: {1, 2}, 1: {2}, 2: {0, 1}} G = dnx.chimera_graph(1) - H = common_working_graph(adj, G) + with self.assertWarns(DeprecationWarning): + H = common_working_graph(adj, G) self.assertEqual(set(H.nodes), {0, 1, 2}) self.assertEqual(set(H.edges), set())