Skip to content

Commit 145f75b

Browse files
committed
FIX: test_viz.py regression with networkx 2.8.8
As seen in nitime github issue #207, fixing the deprecation of adj_matrix with adjacency_matrix in networkx 3.0 caused a regression in test_viz.py when running with the slightly older networkx 2.8.8. Per Chris' suggestion, this patch abandons the approach of using adjacent matrix methods for the more generic to_numpy_array, which works unchanged for both networks 2.8.8 and 3.0 onwards. Thanks: Nilesh Patra and Chris Markiewicz Signed-off-by: Étienne Mollier <[email protected]>
1 parent 02d55a0 commit 145f75b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

nitime/viz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ def draw_graph(G,
680680

681681
# Build a 'weighted degree' array obtained by adding the (absolute value)
682682
# of the weights for all edges pointing to each node:
683-
amat = nx.adjacency_matrix(G).todense() # get a normal array out of it
683+
amat = nx.to_numpy_array(G) # get a normal array out of it
684684
degarr = abs(amat).sum(0) # weights are sums across rows
685685

686686
# Map the degree to the 0-1 range so we can use it for sizing the nodes.

0 commit comments

Comments
 (0)