Skip to content

Commit

Permalink
rewire_skeleton: make sure graph is DAG
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Oct 26, 2023
1 parent f11f9b9 commit 4d5497b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions navis/graph/graph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,8 @@ def rewire_skeleton(x: 'core.TreeNeuron',
if g.is_directed():
g = g.to_undirected()

g = nx.minimum_spanning_tree(g, weight='weight')

if not root:
root = x.root[0] if x.root[0] in g.nodes else next(iter(g.nodes))

Expand Down

0 comments on commit 4d5497b

Please sign in to comment.