opencog-dev team mailing list archive
-
opencog-dev team
-
Mailing list archive
-
Message #00316
Re: [Novamente] new tree data structure library released
Hi Joel,
> Possibly this is a question for Ari more than Moshe...
>
> How does treetree relate to the tree templates already in the
> Novemente/OpenCog... if at all?
>
> i.e. The tree templates used to make Vertex trees (vtrees).
>
Treetree was partly inspired by and shares significant features with
Kaspaar Peeter's tree.hh class (http://www.aei.mpg.de/~peekas/tree/),
which I believe is the tree class you are referring to.
Treetree has some features not found in tree.hh, and vice versa (and
the underlying node and iterator classes are significantly different).
> Just a question of curiosity. I'm not planning on replacing the
> existing vtrees as there's enough to do already, but it might "one
> day" be worth using treetree if it provides any advantage.
>
Yes, definitely! These would be:
1) specific features that make treetree easier and safer than tree.hh
- const iterators, subtrees, array-style access (tr[2][3] to mean "the
subtree rooted in tr's third child's fourth child), etc.
2) improved performance and reduced memory footprint - e.g. the size
of a treetree iterator is always a single pointer, whereas tree.hh
iterators may be larger and have additional state (this could be
important because all stl algorithms assume that iterators are "small"
objects to be passed by value)
3) an implementation that is more convenient to hack on and experiment
with due to having a full suite of unit tests to let you know if and
what goes wrong
- Moshe
P.S. of course if you are using some of tree.hh's features that
treetree doesn't have yet, like breath-first iterators, this is a
disincentive to switch, although contributing such code for treetree
would certainly be appreciated ;->.
References