Skip to content

Commit be82d6d

Browse files
committed
_generate_segments: return list of arrays in vanilla implementation
1 parent 65e7893 commit be82d6d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

navis/graph/graph_utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,17 @@ def _generate_segments(
150150
lengths = [d[s[0]] - d[s[-1]] for s in sequences]
151151
sequences = [x for _, x in sorted(zip(lengths, sequences), reverse=True)]
152152

153+
# Turn into list of arrays
154+
sequences = [np.array(s) for s in sequences]
155+
153156
# Isolated nodes would not be included in the sequences(because they are treated
154157
# as roots, not leafs. Let's add them manually here.
155158
for node in nx.isolates(x.graph):
156-
sequences.append([node])
159+
sequences.append(np.array([node]))
157160
lengths.append(0)
158161

159162
if return_lengths:
160-
return sequences, sorted(lengths, reverse=True)
163+
return sequences, np.array(sorted(lengths, reverse=True))
161164
else:
162165
return sequences
163166

0 commit comments

Comments
 (0)