from collections import defaultdict,deque,Counter def run(load,read,check): r=load('C286_DATA.json')['target_register'];ix=defaultdict(list) for i,z in enumerate(r):ix[z['center']].append(i) X=sorted(ix);C=[3188,3190,3248,3250];adj={x:[] for x in X};edges=[] for x in X: for c in C: y=2*c-x if y in ix: adj[x].append((y,c)) if x<=y:edges.append({'lower':x,'upper':y,'center':c,'lower_indices':ix[x],'upper_indices':ix[y]}) remaining=set(X);comps=[];witnesses=[] while remaining: start=min(remaining);seen={start};q=deque([start]) while q: x=q.popleft() for y,c in adj[x]: if y not in seen:seen.add(y);q.append(y) remaining-=seen;comp=sorted(seen);diam=0 for start in comp: paths={start:[]};q=deque([start]) while q: x=q.popleft() for y,c in adj[x]: if y not in paths:paths[y]=paths[x]+[{'from':x,'center':c,'to':y}];q.append(y) check(f'connected_{start}',set(paths)==seen) for end in comp: if start1 for c in comps),'active_coordinates':sum(c['size'] for c in comps if c['edges']),'isolated_coordinates':sum(c['edges']==0 for c in comps),'component_size_distribution':dict(sorted(Counter(c['size'] for c in comps).items())),'max_diameter':max(c['diameter'] for c in comps),'reachable_distinct_pairs':len(witnesses)}}