7

What is the most complete n-ary tree implementation for C++ ? I need a simple (not boost BGL please) implementation to use in a project compatible with LGPL, so the Tree.hh desn't fit.

Tarantula
  • 19,031
  • 12
  • 54
  • 71
  • 1
    What are the requirements of the tree? You can throw together an n-ary tree in 10 minutes if the requirements are simple enough. – corsiKa Mar 02 '11 at 17:39
  • what operations you want to do with it? – Andrey Mar 02 '11 at 17:42
  • I don't want to spent time writing a new n-ary tree library, since I'll need almost all traversal methods. The requirements are there: http://library.gnome.org/devel/glib/2.28/glib-N-ary-Trees.html, I'm thinking in use glib, but I'm trying to find something more C++ friendly. – Tarantula Mar 02 '11 at 17:43
  • Possible duplicate: http://stackoverflow.com/questions/181630/whats-a-good-and-stable-c-tree-implementation – Emile Cormier Mar 02 '11 at 20:27
  • 2
    Read the question and then you'll see that isn't a duplicate. – Tarantula Mar 02 '11 at 20:39
  • @Tarantula: It might not be unreasonable to expand the question a bit. If the requirements (linked to in your comment) are really key to what you want, then I would suggest `edit`ing your question to quote the most important ones. This will help make your question searchable for others later, and it would also help convince me and other users that this is not, in fact, a duplicate. – phooji Mar 05 '11 at 04:55

4 Answers4

3

I know you said you don't want it, but...why not at least demo/prototype with BGL? At worst you've wasted a few hours, and at best you realize that (for your particular use case at least) it's not as complicated as you thought it would be. The up-side is that BGL is likely the most well tested option out there.

Kevin
  • 24,871
  • 19
  • 102
  • 158
  • 3
    I don't even was able to find a simple example of the BGL implementing a simple tree, I don't want to spent time with a library in which I'll use 10% of it. – Tarantula Mar 02 '11 at 20:59
  • 1
    +1 I second this answer. @Tarantula: I've used the Boost Graph Library for a number of projects between 2004 and the present (I am using it right now, actually). I agree that the initial documentation is a bit overwhelming and heavy on the 'concept' classes and iterators. But beyond that, I disagree with you: "using only 10% of it" is find for the BGL. It is a header-only library, so if you don't use something, it won't contribute to code bloat. – phooji Mar 05 '11 at 05:02
2

Looking for an answer to the same question I've found http://www.datasoftsolutions.net/tree_container_library/overview.php which seems to be under the 3-clause BSD licence.

peterph
  • 980
  • 6
  • 11
1

The author of Tree.hh seems very open to working something out under a license different from the GPL. Why don't you drop him a line and see if he'd be open to an LGPL exemption?

joshperry
  • 41,167
  • 16
  • 88
  • 103
1

What I have discovered from this question, is that there is no simple, documented, LGPL compatible Tree library which compares to GLib n-ary Tree implementation. In the end, I used the C API from the GLib.

Tarantula
  • 19,031
  • 12
  • 54
  • 71