Commit 17bcbc1a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ca32f0c0
......@@ -45,9 +45,9 @@ class Tree:
def __init__(t, keyv, *children):
assert len(children) == len(keyv) + 1, (keyv, children)
_assertIncv(keyv)
# XXX assert children keys consistent?
# XXX assert all children are of the same type
# XXX assert type(child) is Tree | Bucket
# XXX assert children keys consistent
t.keyv = tuple(keyv)
t.children = tuple(children)
......@@ -159,20 +159,19 @@ def _iterAllStructPermutations(klo, khi, keyv, maxdepth, maxsplit):
assert klo <= khi
# XXX assert keyv sorted, in [klo, khi)
for nsplit in range(0, maxsplit):
for ksplitv in _iterSplitByN(klo, khi, nsplit)
# child_i
xlo, xhi
# just Tree + Buckets
# emit Tree -> Buckets
children = []
for xlo, xhi in ...:
children.append(Bucket(*_keyvSliceBy(keyv, xlo, xhi)))
yield Tree(ksplitv, children) # FIXME ksplitv wo klo/khi
# Tree + ...(Trees) + Buckets
# emit Tree -> Trees -> ...
if maxdepth == 0:
continue
ichildren = [] # of _iterAllStructPermutations for each child link
......
......@@ -50,12 +50,14 @@ def test_topologyOf():
T([], B(7)),
T([], B(11))) ))
"""
#assert btree.TopoEncodingOf(t) == ((4,), (2,), ø(4), (6,10), ø(5?), ø(7), ø(11), x(5?))
assert btree.TopoEncodingOf(t) == \
(4,), (2,),(), (),(),(6,10), B(1),B(3),(),(),(), (),B(7),B(11), B(5)
# T4 T2-T T-T-T6,10 B1-B3-T-T-T T-B7-B11 B5
# T4 T2-T T-T-T6,10 B1-B3-T-T-T T-B7-B11 B5 <-- good
"""
"""
assert xbtree.TopologyOf(t) == ( (4,),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment