Commit 03f27262 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ce5ef12e
......@@ -164,26 +164,24 @@ def _iterAllStructs(klo, khi, keyv, maxdepth, maxsplit):
for nsplit in range(0, maxsplit):
for ksplitv in _iterSplitByN(klo, khi, nsplit):
# child_i
xlo, xhi
# ksplitv = [klo, s1, s2, ..., sN, khi]
# emit Tree -> Buckets
children = []
for xlo, xhi in ...:
for (xlo, xhi) in zip(ksplitv[:-1], ksplitv[1:]): # (klo, s1), (s1, s2), ..., (sN, khi)
children.append(Bucket(*_keyvSliceBy(keyv, xlo, xhi)))
yield Tree(ksplitv, children) # FIXME ksplitv wo klo/khi
yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN)
# emit Tree -> Trees -> ...
if maxdepth == 0:
continue
ichildren = [] # of _iterAllStructs for each child link
for xlo, xhi in ...:
for (xlo, xhi) in zip(ksplitv[:-1], ksplitv[1:]): # (klo, s1), (s1, s2), ..., (sN, khi)
ichildren.append( _iterAllStructs(
xlo, xhi, _keyvSliceBy(keyv, xlo, xhi), maxdepth - 1, maxsplit))
for children in itertools.product(ichildren):
yield Tree(ksplitv, *children) # FIXME ksplitv w/o klo, khi
yield Tree(ksplitv[1:-1], *children) # (s1, s2, ..., sN)
# _keyvSliceBy returns [] of keys from keyv : k ∈ [klo, khi)
......
......@@ -57,6 +57,8 @@ def test_topologyOf():
(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 <-- good
# T4·T2-T·T-T-T6,10·B1-B3-T-T-T·T-B7-B11·B5. <- ?
"""
"""
......
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