Commit 56d07b9d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 19b49305
......@@ -128,19 +128,31 @@ def StructureOf(node):
panic("unknown node type %r" % typ)
# TypoEncodingOf returns topology encoding for internal structure of the tree.
# TypoEncode returns topology encoding for internal structure of the tree.
#
# See top-level docstring for what topology is.
def TypoEncodingOf(tree):
def TypoEncode(tree):
treeStruct = StructureOf(tree)
return topoEncode(treeStruct)
def topoEncode(treeStruct):
1/0
# TopoDecode decodes topology-encoded text into Tree structure.
#
# XXX see -> ?
def TopoDecode(text):
1/0
# Restructure reorganizes BTree instance (not Tree) according to new structure.
def Restructure(tree, newStructure):
assert istree(tree)
assert isinstance(newStructure, Tree)
1/0
# AllStructs generates subset of all possible BTree structures for BTrees with
# specified keys and btree depth up-to maxdepth. Eatch tree node is split by
# up-to maxsplit points.
......@@ -213,7 +225,7 @@ def _keyvSliceBy(keyv, klo, khi):
# si < s_{i+1}
#
# XXX remove lo and hi from the output?
def _iterSplitByN(lo, hi, nsplit): # -> [] of [lo, s1, s2, ..., sn, hi)
def _iterSplitByN(lo, hi, nsplit): # -> i[] of [lo, s1, s2, ..., sn, hi)
assert lo <= hi
assert nsplit >= 0
......
......@@ -53,10 +53,12 @@ def test_topologyOf():
T([], B(7)),
T([], B(11))) ))
#assert xbtree.TopoEncode(t) == 'T4/T2-T/T-T-T6,10/B1-B3-T-T-T/T-B7-B11/B5'
"""
#assert btree.TopoEncodingOf(t) == ((4,), (2,), ø(4), (6,10), ø(5?), ø(7), ø(11), x(5?))
assert btree.TopoEncodingOf(t) == \
assert btree.TopoEncode(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 <-- good
......
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