From 0b285f0f3da6d5182118674ce8bd024eb8ca41c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Vit=C3=B3ria=20Ribeiro=20Mendes?= <62755952+MaviMendes@users.noreply.github.com> Date: Mon, 8 May 2023 01:21:54 -0300 Subject: [PATCH] from_numpy_matrix doesnt exist G = nx.from_numpy_matrix(adj_matrix) gives error AttributeError: module 'networkx' has no attribute 'from_numpy_matrix' --- communities/algorithms/girvan_newman.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/communities/algorithms/girvan_newman.py b/communities/algorithms/girvan_newman.py index 14527d9..44b92a5 100644 --- a/communities/algorithms/girvan_newman.py +++ b/communities/algorithms/girvan_newman.py @@ -61,7 +61,7 @@ def animation_data(A, P_history, Q_history): def girvan_newman(adj_matrix : np.ndarray, n : int = None) -> list: M = modularity_matrix(adj_matrix) - G = nx.from_numpy_matrix(adj_matrix) + G = nx.from_numpy_array(adj_matrix) num_nodes = G.number_of_nodes() G.remove_edges_from(nx.selfloop_edges(G))