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

Drop HamiltonianCycle

It is broken
parent 766330a8
No related branches found
No related tags found
No related merge requests found
......@@ -174,67 +174,6 @@ def _init_():
def finalize(self, b): return b[0].value
@Singleton
class HamiltonianCycle(GraphParameterBase):
FREE_EDGE = [ BV((1, 1), 1), BV((None, None), 1) ]
CUBIC_VERTEX = [
BV((1, 1, None), 1),
BV((1, None, 1), 1),
BV((None, 1, 1), 1)
]
def join_boundaries(self, x, _):
offsets = [ 0 ]
try:
for b in x:
offsets.append(offsets[-1] + max_(b.boundary))
except ValueError:
return
def shift(k, off):
if k is None: return None
return k + off
ret_b = tuple(chain(*[
[ shift(x, offsets[i]) for x in b.boundary ] for i, b in enumerate(x)
]))
yield BV(ret_b, prod( b.value for b in x ))
def join_edges(self, b, e1, e2):
# print("%s %s %s" % (b, e1, e2))
c1 = b.boundary[e1]
c2 = b.boundary[e2]
if c1 is None and c2 is None: yield b
if c1 is None or c2 is None: return
if c1 != c2:
if c1 > c2: c1, c2 = c2, c1
boundary = tuple( v if v != c2 else c1 for v in b.boundary )
yield BV(boundary, b.value)
elif max_(b.boundary) == 1:
yield b
def project_and_canonize(self, p, b):
boundary = select(p, b)
rename = { None: None }
i = 1
for x in boundary:
if x not in rename:
rename[x] = i
i += 1
boundary = tuple( rename[x] for x in boundary )
return boundary
def finalize(self, b):
assert len(b) <= 1
if len(b) == 0: return 0
assert b[0].boundary == tuple()
return b[0].value
@Singleton
class CircuitDoubleCover(GraphParameterBase):
FREE_EDGE = [ BV(((1,2), (1,2), None), Fraction(1, 2)) ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment