A = nx.adjacency_matrix(G) print(A.todense()) A.setdiag(A.diagonal() * 2) print(A.todense())****************
>>> import networkx as nx
>>> nx. __version__
'2.8.8'
>>> G = nx.Graph([(1, 1)])
>>> A = nx.adjacency_matrix(G)
<stdin>:1: FutureWarning: adjacency_matrix will return a scipy.sparse array instead of a matrix in Networkx 3.0.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/franckm/opt/anaconda3/lib/python3.9/site-packages/networkx/linalg/graphmatrix.py", line 173, in adjacency_matrix
return nx.to_scipy_sparse_matrix(G, nodelist=nodelist, dtype=dtype, weight=weight)
File "/Users/franckm/opt/anaconda3/lib/python3.9/site-packages/networkx/convert_matrix.py", line 1021, in to_scipy_sparse_matrix
A = to_scipy_sparse_array(
File "/Users/franckm/opt/anaconda3/lib/python3.9/site-packages/networkx/convert_matrix.py", line 923, 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'
--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/CAN%2BjCOoMgbL0yF-oDjNpYQWUGLYRZutWTc4qXeHT5QOKj87mCg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/networkx-discuss/CADyYXurEpF7oPCaWtC7ni8RfXhpXGMZAVpO2CajOcZ2OBzLCBA%40mail.gmail.com.