Balanced Binary Trees
a sorted collection of key/value pairs optimized for searching
and traversing in order.
The #GTree structure and its associated functions provide a sorted collection
of key/value pairs optimized for searching and traversing in order.
To create a new #GTree use g_tree_new().
To insert a key/value pair into a #GTree use g_tree_insert().
To lookup the value corresponding to a given key, use g_tree_lookup() and
g_tree_lookup_extended().
To find out the number of nodes in a #GTree, use g_tree_nnodes().
To get the height of a #GTree, use g_tree_height().
To traverse a #GTree, calling a function for each node visited in the
traversal, use g_tree_foreach().
To remove a key/value pair use g_tree_remove().
To destroy a #GTree, use g_tree_destroy().
The GTree struct is an opaque data structure representing a
Balanced Binary Tree.
It should be accessed only by using the following functions.
@key_compare_func:
@Returns:
@key_compare_func:
@key_compare_data:
@Returns:
@key_compare_func:
@key_compare_data:
@key_destroy_func:
@value_destroy_func:
@Returns:
@tree:
@key:
@value:
@tree:
@key:
@value:
@tree:
@Returns:
@tree:
@Returns:
@tree:
@key:
@Returns:
@tree:
@lookup_key:
@orig_key:
@value:
@Returns:
@tree:
@func:
@user_data:
@tree:
@traverse_func:
@traverse_type:
@user_data:
Specifies the type of function passed to g_tree_traverse().
It is passed the key and value of each node, together with
the @user_data parameter passed to g_tree_traverse().
If the function returns %TRUE, the traversal is stopped.
@key: a key of a #GTree node.
@value: the value corresponding to the key.
@data: user data passed to g_tree_traverse().
@Returns: %TRUE to stop the traversal.
Specifies the type of traveral performed by g_tree_traverse(),
g_node_traverse() and g_node_find().
@G_IN_ORDER: vists a node's left child first, then the node itself, then its
right child. This is the one to use if you want the output sorted according
to the compare function.
@G_PRE_ORDER: visits a node, then its children.
@G_POST_ORDER: visits the node's children, then the node itself.
@G_LEVEL_ORDER: is not implemented for
Balanced Binary Trees.
For N-ary Trees, it vists the root
node first, then its children, then its grandchildren, and so on. Note that
this is less efficient than the other orders.
@tree:
@search_func:
@user_data:
@Returns:
@tree:
@key:
@tree:
@key:
@tree: