Skip to content

Commit b9a8e20

Browse files
TheChymeraeffigies
authored andcommitted
updating networkx from_numpy_{matrix,array}
1 parent 24c55a6 commit b9a8e20

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

nipype/interfaces/cmtk/cmtk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def cmat(
264264
)
265265
intersection_matrix = np.matrix(intersection_matrix)
266266
I = G.copy()
267-
H = nx.from_numpy_matrix(np.matrix(intersection_matrix))
267+
H = nx.from_numpy_array(np.matrix(intersection_matrix))
268268
H = nx.relabel_nodes(H, lambda x: x + 1) # relabel nodes so they start at 1
269269
I.add_weighted_edges_from(
270270
((u, v, d["weight"]) for u, v, d in H.edges(data=True))

nipype/interfaces/cmtk/nbs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ def _run_interface(self, runtime):
150150
pADJ[x, y] = PVAL[idx]
151151

152152
# Create networkx graphs from the adjacency matrix
153-
nbsgraph = nx.from_numpy_matrix(ADJ)
154-
nbs_pval_graph = nx.from_numpy_matrix(pADJ)
153+
nbsgraph = nx.from_numpy_array(ADJ)
154+
nbs_pval_graph = nx.from_numpy_array(pADJ)
155155

156156
# Relabel nodes because they should not start at zero for our convention
157157
nbsgraph = nx.relabel_nodes(nbsgraph, lambda x: x + 1)

nipype/interfaces/cmtk/tests/test_nbs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def creating_graphs(tmpdir):
1818
graphnames = ["name" + str(i) for i in range(6)]
1919
for idx, name in enumerate(graphnames):
2020
graph = np.random.rand(10, 10)
21-
G = nx.from_numpy_matrix(graph)
21+
G = nx.from_numpy_array(graph)
2222
out_file = tmpdir.strpath + graphnames[idx] + ".pck"
2323
# Save as pck file
2424
with open(out_file, 'wb') as f:

0 commit comments

Comments
 (0)