Skip to content

Commit

Permalink
fix Skeleton.get_graph
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jun 9, 2022
1 parent 17dfe95 commit 63324a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion skeletor/skeletonize/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ def get_graph(self):
dists = np.sqrt((dists ** 2).sum(axis=1))

G = nx.DiGraph()
G.add_weighted_edges_from([(s, t, w) for s, t, w in zip(nodes, parents, dists)])
G.add_weighted_edges_from([(s, t, w) for s, t, w in zip(nodes.node_id.values,

This comment has been minimized.

Copy link
@Skylion007

Skylion007 Jun 10, 2022

Contributor

Your are just unpacking a tuple from the zip iterator and putting it back in a list. This could be done faster by doing this:

        G.add_weighted_edges_from(list(zip(nodes.node_id.values,nodes.parent_id.values, dists)))
nodes.parent_id.values, dists)])

return G

Expand Down

0 comments on commit 63324a3

Please sign in to comment.