错误提示如下:
File "D:\Anaconda\lib\site-packages\networkx\convert_matrix.py", line 594, in to_scipy_sparse_array
A = sp.sparse.coo_array((d, (r, c)), shape=(nlen, nlen), dtype=dtype)
AttributeError: module 'scipy.sparse' has no attribute 'coo_array'
原因是scipy.sparse包中没有coo_array函数方法,只需要把coo_array替换成coo_matrix实现即可
在运行networkx构建关系图中出现报错,版本是:
- networkx: 3.1
- python 3.8
- scipy: 1.5.4