From 38360310764c0bb418a1d8bc1bb425ae2bdb6c5f Mon Sep 17 00:00:00 2001 From: Laura Berkowitz Date: Fri, 28 Mar 2025 16:59:53 -0400 Subject: [PATCH 1/2] Fix for Networkx compatibility Created new enviornment from this repo, and it didn't work due to dependency errrors with the newer version of Networkx. to_scipy_sparse_matrix was outdated, so I changed it to to_scipy_sparse_array to fix the error. --- src/track_linearization/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/track_linearization/core.py b/src/track_linearization/core.py index 81913af..5377bc3 100644 --- a/src/track_linearization/core.py +++ b/src/track_linearization/core.py @@ -149,7 +149,7 @@ def route_distance(candidates_t_1, candidates_t, track_graph): # calculate path distance path_distance = scipy.sparse.csgraph.dijkstra( - nx.to_scipy_sparse_matrix(track_graph, weight="distance") + nx.to_scipy_sparse_array(track_graph, weight="distance") ) n_total_nodes = len(track_graph.nodes) node_ind = np.arange(n_total_nodes) From 102c7439951cfd55f86a40ed63287b93e1e73cee Mon Sep 17 00:00:00 2001 From: Jean-Luc Shimizu Date: Fri, 28 Mar 2025 17:49:21 -0400 Subject: [PATCH 2/2] Updated toml to have minimum Networkx version (3.2.1) This is associated with the change in core.py with to_scipy_sparse_array. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c8f35a2..df67ce3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -dependencies = ["numpy", "scipy", "matplotlib", "pandas", "dask", "networkx"] +dependencies = ["numpy", "scipy", "matplotlib", "pandas", "dask", "networkx>=3.2.1"] dynamic = ["version"] [project.urls]