Skip to content
Snippets Groups Projects
Commit 5bb1656f authored by Radek Hušek's avatar Radek Hušek
Browse files

analyze-cut

parent ee4b9b5d
Branches
No related tags found
No related merge requests found
from flower_snarks import *
from sage.all import *
from collections import namedtuple
from itertools import *
def calc(s):
b = list(CircuitDoubleCover.enumerate_boundaries(s))
m = dict()
_bmap = { x: i for i, x in enumerate(b) }
def eval_(g):
ret = set()
for b_ in ( _bmap[x.boundary] for x in g.eval(CircuitDoubleCover) if x.value > 0 ):
if b_ not in m:
x = set()
cg = FakeGadget(s, [ Boundary(b[b_], 1) ])
for r, rb in enumerate(b):
rg = FakeGadget(s, [ Boundary(rb, 1) ])
v = Gadget.join(
[ cg, rg ],
[ ((1, i), (2, i)) for i in range(1, s+1) ],
[]
).eval(CircuitDoubleCover)
if v > 0: x.add(r)
m[b_] = x
ret.update(m[b_])
return ret
ret = namedtuple("calc_ret", ["boundaries", "eval", "map"])
ret.boundaries = b
ret.eval = eval_
ret.map = lambda x: _bmap[x]
return ret
def C_k(k):
return Gadget.join(
[CUBIC_VERTEX]*k,
[ ((i+1, 2), (((i+1) % k) + 1, 1)) for i in range(k) ],
[ (i+1, 3) for i in range(k) ]
)
def G_k(k):
return Gadget.join(
[CUBIC_VERTEX]*k,
[ ((i+1, 2), (((i+1) % (k-1)) + 1, 1)) for i in range(k-1) ] + [ ((1,3), (k,1)) ],
[ (i+2, 3) for i in range(k-2) ] + [ (k, 2), (k, 3) ]
)
k = 6
c = calc(k)
e = c.eval(C_k(k))
f = c.eval(G_k(k))
print(len(e))
print(len(f))
print(len(set(f).intersection(set(e))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment