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

bump

parent 8eaeea23
No related branches found
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 = matrix(QQ, len(b), len(b), dict(), sparse=True)
for c, cb in enumerate(b):
for r, rb in enumerate(b):
rg = FakeGadget(s, [ Boundary(rb, 1) ])
cg = FakeGadget(s, [ Boundary(cb, 1) ])
m[r, c] = Gadget.join(
[ cg, rg ],
[ ((1, i), (2, i)) for i in range(1, s+1) ],
[]
).eval(CircuitDoubleCover)
assert m.is_symmetric()
_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 ):
ret.update(set(m.column(b_).support()))
return ret
ret = namedtuple("calc_ret", ["matrix", "boundaries", "eval", "map"])
ret.matrix = m
ret.boundaries = b
ret.eval = eval_
ret.map = lambda x: _bmap[x]
return ret
G1 = Gadget.join([FREE_EDGE]*2, [], [(1,1),(1,2),(2,1),(2,2)])
G2 = Gadget.join([CUBIC_VERTEX]*2, [((1,1), (2,1))], [(1,2), (1,3), (2,2), (2,3)])
#G = Gadget.join([CUBIC_VERTEX]*4, [((1,2), (2,1)), ((2,2), (3,1)), ((3,2), (4,1)), ((4,2), (1,1))],
# [(1,3), (2,3), (3,3), (4,3)])
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) ]
)
k = 4
X = calc(k)
m = str(X.matrix)
m = m.replace("0", " ")
print(m)
print(len(X.boundaries))
print("\n")
S = []
#for x in X.boundaries: print(x)
for G in [ G1, G2 ]:
for i in range(1,4):
o = [ (1,1), (1,3), (1,4) ]
o.insert(i, (1,2))
g = Gadget.join([G], [], o)
e = X.eval(g)
S.append(e)
print(o)
print(e)
print(len(e))
print("\n\n================================\n")
L = []
for l in range(4):
for c in combinations(range(len(X.boundaries)), l):
c = set(c)
if not all( len(c.intersection(s)) > 0 for s in S ):
continue
L.append(c)
# print(c)
def meet(R, C):
for r in R:
for c in C:
if X.matrix[r, c]:
return True
return False
def test():
for R in L:
for C in L:
if not meet(R, C):
print(R, C)
test()
#!/usr/bin/python
from sys import stdin
from sage.all import Graph
from flower_snarks import count_cdc_naive
for l in stdin:
G = Graph(l)
cdc, hyp = count_cdc_naive(G)
print("%-20i %s" % (cdc, "" if cdc >= hyp else "FAIL"))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment