1
0
Fork 0

Updated the `networkx` dependency to the latest version (`3.0`) and updated the code to reflect the change

master
Meliurwen 2 years ago
parent df3225c288
commit 74d233893d
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 2
      setup-requirements.txt
  2. 2
      src/pyctbn/legacy/estimators/structure_estimator.py
  3. 2
      tests/estimators/test_structure_estimator.py

@ -1,5 +1,5 @@
matplotlib==3.6.3
networkx==2.8.8
networkx==3.0
numpy==1.24.1
pandas==1.5.3
scipy==1.10.0

@ -129,7 +129,7 @@ class StructureEstimator(object):
:return: The adjacency matrix of the graph ``_complete_graph``
:rtype: numpy.ndArray
"""
return nx.adj_matrix(self._complete_graph, self._nodes).toarray().astype(bool)
return nx.adjacency_matrix(self._complete_graph, self._nodes).toarray().astype(bool)
def spurious_edges(self) -> typing.List:
"""Return the spurious edges present in the estimated structure, if a prior net structure is present in

@ -103,7 +103,7 @@ class TestStructureEstimator(unittest.TestCase):
def test_adjacency_matrix(self):
se1 = StructureConstraintBasedEstimator(self.s1, 0.1, 0.1)
se1.ctpc_algorithm()
adj_matrix = nx.adj_matrix(self.real_net_structure, self.s1.structure.nodes_labels).toarray().astype(bool)
adj_matrix = nx.adjacency_matrix(self.real_net_structure, self.s1.structure.nodes_labels).toarray().astype(bool)
self.assertTrue(np.array_equal(adj_matrix, se1.adjacency_matrix()))
def test_save_plot_estimated_graph(self):