Glib BTree & GTree wrapper



Owen Taylor wrote:
> Josh Macdonald apparently has a BTree implementation in the GLib style
> that he was proposing for addition at one time.

     Josh,
	Owen Taylor mentioned that you had a BTree implementation in the
Glib style.

	Was that a complete implementation?  Owen is considering another
tree addition to Glib (specifically, a configurable BTree that lets the
user set the max number of children per node).  I was hoping we could use
yours.  

	It is my understanding that a Red/Black balancing binary tree is
really just a BTree with a maximum of two child nodes.  Therefor, I would
suggest that we replace the existing balancing binary tree code to use
your BTree code, and having something like a function

GTree* g_tree_new_with_max( GCompareFunc key_compare_func, 
				guint max_children_per_node)


...with a wrapper that looks like:

#define g_tree_new((a))     g_tree_new_with_max((a),2)

	This would make the new BTree API backwards compatible with the
existing GTree API, wouldn't it?  Then we could have one GTree which would
either as a Red/Black balancing binary tree, or else the programmer could
define the number of max children if he needed a flatter tree.

	We may also want to add additional functions to the API which
allow further probing into the tree (something like the GNode functions),
but that should not interfere with the existing GTree functions.

	Any suggestions or comments are greatly appreciated.  And if
possible, please email me personally the code for your Glib-like BTree
(assuming you can distribute it under an Open Source license).


Thank You,
Derek Simkowiak
dereks@kd-dev.com

P.S.> For other interested parties on the gtk-list, there is an excellent
introduction to BTrees at
http://www.plover.com/~mjd/perl/BTree/article.html



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]