Skip to content

Commit bad9d4f

Browse files
committed
fix(edits): check for no cx edges; comments
1 parent cfd6841 commit bad9d4f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pychunkedgraph/graph/edits.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,11 @@ def _process_l2_agglomeration(
266266
cross_edges = agg.cross_edges.get_pairs()
267267
# we must avoid the cache to read roots to get segment state before edit began
268268
parents = cg.get_parents(cross_edges[:, 0], time_stamp=parent_ts, raw_only=True)
269+
270+
# if there are cross edges, there must be a single parent.
271+
# if there aren't any, there must be no parents. XOR these 2 conditions.
269272
err = f"got cross edges from more than one l2 node; op {operation_id}"
270-
assert np.unique(parents).size == 1, err
273+
assert (np.unique(parents).size == 1) != (cross_edges.size == 0), err
271274
root = cg.get_root(parents[0], time_stamp=parent_ts, raw_only=True)
272275

273276
# inactive edges must be filtered out

0 commit comments

Comments
 (0)