Skip to content

Commit

Permalink
fix geodesic_matrix when using networkx over igraph
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jan 9, 2024
1 parent 9a1956d commit a5d4b72
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions navis/graph/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,10 @@ def geodesic_matrix(x: 'core.NeuronObject',
indices = None
ix = nodeList

# For some reason csgrpah.dijkstra expects indices/indptr as int32
# igraph seems to do that by default but networkx uses int64 for indices
m.indptr = m.indptr.astype('int32', copy=False)
m.indices = m.indices.astype('int32', copy=False)
dmat = csgraph.dijkstra(m,
directed=directed,
indices=indices,
Expand Down

0 comments on commit a5d4b72

Please sign in to comment.