From a8dc5f6a75425c1f7ddfdc0cf4993501fea1b54f Mon Sep 17 00:00:00 2001 From: Akhilesh Halageri Date: Wed, 27 Sep 2023 16:17:45 +0000 Subject: [PATCH] fix(edits): check for no cx edges; comments --- pychunkedgraph/graph/edits.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pychunkedgraph/graph/edits.py b/pychunkedgraph/graph/edits.py index 63fbc6e6b..b7174437a 100644 --- a/pychunkedgraph/graph/edits.py +++ b/pychunkedgraph/graph/edits.py @@ -266,8 +266,11 @@ def _process_l2_agglomeration( cross_edges = agg.cross_edges.get_pairs() # we must avoid the cache to read roots to get segment state before edit began parents = cg.get_parents(cross_edges[:, 0], time_stamp=parent_ts, raw_only=True) + + # if there are cross edges, there must be a single parent. + # if there aren't any, there must be no parents. XOR these 2 conditions. err = f"got cross edges from more than one l2 node; op {operation_id}" - assert np.unique(parents).size == 1, err + assert (np.unique(parents).size == 1) != (cross_edges.size == 0), err root = cg.get_root(parents[0], time_stamp=parent_ts, raw_only=True) # inactive edges must be filtered out