Module 'networkx' has no attribute 'to_scipy_sparse_matrix'
hungpham13 opened this issue · 2 comments
I encountered this issue while running benchmark.
~/.local/lib/python3.10/site-packages/pygrank/algorithms/autotune/tuning.py in rank(self, graph, personalization, *args, **kwargs)
...
---> M = G.to_scipy_sparse_array() if isinstance(G, fastgraph.Graph) else nx.to_scipy_sparse_matrix(G, weight=weight, dtype=float)
renormalize = float(renormalize)
left_reduction = reduction #(lambda x: backend.degrees(x)) if reduction == "sum" else reduction
AttributeError: module 'networkx' has no attribute 'to_scipy_sparse_matrix'
Thanks for bringing this to our attention.
networkx
recently depracated the to_scipy_sparse_matrix
method in favor of to_scipy_sparse_array
, which causes the described issue. This will be addressed in the next minor release of pygrank
. It's taking some time because we are taking this opportunity to also fully transition from sparse matrices to sparse arrays. Most likely the transition will have been completed by 3/3/2023.
Temporary fix: Until the issue is correctly fixed, use networkx 2.8.8, which still provides the necessary method.
The replicated error is fixed as of pygrank 0.2.12
(e.g., installed via pip install --upgrade pygrank
).
Feel free to re-open this issue if the message persists in your setup after upgrading.