aoldoni/tetre

When grouping trees, search should be in constant time

aoldoni opened this issue · 1 comments

The whole structure is not option as group finding for a tree should be in constant time: O(1).

This data structure is not optimal: https://github.com/aoldoni/comp9596/blob/master/internallib/graph.py#L287

To resolve, use a canonical representation of the tree to be the index of the dictionary, e.g.: use some pair of delimiter (e.g., [, ] as you used) to enclose each subtree. (this is similar to lisp).

u [ a [ b c d]
e [f [g h] i]
k
]

btw, this is very similar to q-tree's syntax: http://texdoc.net/texmf-dist/doc/latex/tikz-qtree/tikz-qtree-manual.pdf

Fixed by 411faed and 7ec862d