Hi,
sometimes when I use draw_networkx it returns the error in the object.
For example in an ipynb I receive the following:
nx.draw_networkx( G , node_size = 0 , with_labels = False )
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [31], in <cell line: 1>()
----> 1 nx.draw_networkx( G , node_size = 0 , with_labels = False )
File ~/.local/lib/python3.8/site-packages/networkx/drawing/nx_pylab.py:331, in draw_networkx(G, pos, arrows, with_labels, **kwds)
328 label_kwds = {k: v for k, v in kwds.items() if k in valid_label_kwds}
330 if pos is None:
--> 331 pos = nx.drawing.spring_layout(G) # default to spring layout
333 draw_networkx_nodes(G, pos, **node_kwds)
334 draw_networkx_edges(G, pos, arrows=arrows, **edge_kwds)
File <class 'networkx.utils.decorators.argmap'> compilation 13:4, in argmap_spring_layout_10(G, k, pos, fixed, iterations, threshold, weight, scale, center, dim, seed)
2 from os.path import splitext
3 from contextlib import contextmanager
----> 4 from pathlib import Path
6 import networkx as nx
7 from networkx.utils import create_random_state, create_py_random_state
File ~/.local/lib/python3.8/site-packages/networkx/drawing/layout.py:476, in spring_layout(G, k, pos, fixed, iterations, threshold, weight, scale, center, dim, seed)
474 if len(G) < 500: # sparse solver for large graphs
475 raise ValueError
--> 476 A = nx.to_scipy_sparse_array(G, weight=weight, dtype="f")
477 if k is None and fixed is not None:
478 # We must adjust k by domain size for layouts not near 1x1
479 nnodes, _ = A.shape
File ~/.local/lib/python3.8/site-packages/networkx/convert_matrix.py:907, in to_scipy_sparse_array(G, nodelist, dtype, weight, format)
904 row, col, data = [], [], []
906 if G.is_directed():
--> 907 A = sp.sparse.coo_array((data, (row, col)), shape=(nlen, nlen), dtype=dtype)
908 else:
909 # symmetrize matrix
910 d = data + data
AttributeError: module 'scipy.sparse' has no attribute 'coo_array'
Some hints to fix this?
Thanks
Saverio