glib-N-ary-Trees.html   [plain text]


<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>N-ary Trees</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="GLib Reference Manual"><link rel="up" href="glib-data-types.html" title="GLib Data Types"><link rel="previous" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees"><link rel="next" href="glib-Quarks.html" title="Quarks"><link rel="chapter" href="glib.html" title="GLib Overview"><link rel="refentry" href="glib-building.html" title="Compiling the GLib package"><link rel="refentry" href="glib-cross-compiling.html" title="Cross-compiling the GLib package"><link rel="refentry" href="glib-compiling.html" title="Compiling GLib Applications"><link rel="refentry" href="glib-running.html" title="Running GLib Applications"><link rel="refentry" href="glib-changes.html" title="Changes to GLib"><link rel="refentry" href="glib-resources.html" title="Mailing lists and bug reports"><link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals"><link rel="refentry" href="glib-Basic-Types.html" title="Basic Types"><link rel="refentry" href="glib-Limits-of-Basic-Types.html" title="Limits of Basic Types"><link rel="refentry" href="glib-Standard-Macros.html" title="Standard Macros"><link rel="refentry" href="glib-Type-Conversion-Macros.html" title="Type Conversion Macros"><link rel="refentry" href="glib-Byte-Order-Macros.html" title="Byte Order Macros"><link rel="refentry" href="glib-Numerical-Definitions.html" title="Numerical Definitions"><link rel="refentry" href="glib-Miscellaneous-Macros.html" title="Miscellaneous Macros"><link rel="refentry" href="glib-Atomic-Operations.html" title="Atomic Operations"><link rel="chapter" href="glib-core.html" title="GLib Core Application Support"><link rel="refentry" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop"><link rel="refentry" href="glib-Threads.html" title="
Threads"><link rel="refentry" href="glib-Thread-Pools.html" title="Thread Pools"><link rel="refentry" href="glib-Asynchronous-Queues.html" title="Asynchronous Queues"><link rel="refentry" href="glib-Dynamic-Loading-of-Modules.html" title="Dynamic Loading of Modules"><link rel="refentry" href="glib-Memory-Allocation.html" title="Memory Allocation"><link rel="refentry" href="glib-IO-Channels.html" title="IO Channels"><link rel="refentry" href="glib-Error-Reporting.html" title="Error Reporting"><link rel="refentry" href="glib-Warnings-and-Assertions.html" title="Message Output and Debugging Functions"><link rel="refentry" href="glib-Message-Logging.html" title="Message Logging"><link rel="chapter" href="glib-utilities.html" title="GLib Utilities"><link rel="refentry" href="glib-String-Utility-Functions.html" title="String Utility Functions"><link rel="refentry" href="glib-Character-Set-Conversion.html" title="Character Set Conversion"><link rel="refentry" href="glib-Unicode-Manipulation.html" title="Unicode Manipulation"><link rel="refentry" href="glib-I18N.html" title="Internationalization"><link rel="refentry" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions"><link rel="refentry" href="glib-Random-Numbers.html" title="Random Numbers"><link rel="refentry" href="glib-Hook-Functions.html" title="Hook Functions"><link rel="refentry" href="glib-Miscellaneous-Utility-Functions.html" title="Miscellaneous Utility Functions"><link rel="refentry" href="glib-Lexical-Scanner.html" title="Lexical Scanner"><link rel="refentry" href="glib-Automatic-String-Completion.html" title="Automatic String Completion"><link rel="refentry" href="glib-Timers.html" title="Timers"><link rel="refentry" href="glib-Spawning-Processes.html" title="Spawning Processes"><link rel="refentry" href="glib-File-Utilities.html" title="File Utilities"><link rel="refentry" href="glib-Shell-related-Utilities.html" title="Shell-related Utilities"><link rel="refentry" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching"><link rel="refentry" href="glib-Simple-XML-Subset-Parser.html" title="Simple XML Subset Parser"><link rel="refentry" href="glib-Windows-Compatability-Functions.html" title="Windows Compatibility Functions"><link rel="chapter" href="glib-data-types.html" title="GLib Data Types"><link rel="refentry" href="glib-Memory-Chunks.html" title="Memory Chunks"><link rel="refentry" href="glib-Doubly-Linked-Lists.html" title="Doubly-Linked Lists"><link rel="refentry" href="glib-Singly-Linked-Lists.html" title="Singly-Linked Lists"><link rel="refentry" href="glib-Double-ended-Queues.html" title="Double-ended Queues"><link rel="refentry" href="glib-Trash-Stacks.html" title="Trash Stacks"><link rel="refentry" href="glib-Hash-Tables.html" title="Hash Tables"><link rel="refentry" href="glib-Strings.html" title="Strings"><link rel="refentry" href="glib-String-Chunks.html" title="String Chunks"><link rel="refentry" href="glib-Arrays.html" title="Arrays"><link rel="refentry" href="glib-Pointer-Arrays.html" title="Pointer Arrays"><link rel="refentry" href="glib-Byte-Arrays.html" title="Byte Arrays"><link rel="refentry" href="glib-Balanced-Binary-Trees.html" title="Balanced Binary Trees"><link rel="refentry" href="glib-N-ary-Trees.html" title="N-ary Trees"><link rel="refentry" href="glib-Quarks.html" title="Quarks"><link rel="refentry" href="glib-Keyed-Data-Lists.html" title="Keyed Data Lists"><link rel="refentry" href="glib-Datasets.html" title="Datasets"><link rel="refentry" href="glib-Relations-and-Tuples.html" title="Relations and Tuples"><link rel="refentry" href="glib-Caches.html" title="Caches"><link rel="refentry" href="glib-Memory-Allocators.html" title="Memory Allocators"><link rel="chapter" href="tools.html" title="GLib Tools"><link rel="refentry" href="glib-gettextize.html" title="glib-gettextize"><link rel="index" href="ix01.html" title="Index"><link rel="section" href="glib-N-ary-Trees.html#id3312241" title="Description"><link rel="section" href="glib-N-ary-Trees.html#id3312642" title="Details"><meta name="generator" content="GTK-Doc V1.2 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="glib-Balanced-Binary-Trees.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="glib-data-types.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GLib Reference Manual</th><td><a accesskey="n" href="glib-Quarks.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="glib-N-ary-Trees"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">N-ary Trees</span></h2><p>N-ary Trees &#8212; trees of data with any number of branches.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">

#include &lt;glib.h&gt;


struct      <a href="glib-N-ary-Trees.html#GNode">GNode</a>;
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-new">g_node_new</a>                      (<a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-copy">g_node_copy</a>                     (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a href="glib-Basic-Types.html#gpointer">gpointer</a>    (<a href="glib-N-ary-Trees.html#GCopyFunc">*GCopyFunc</a>)                    (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> src,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-copy-deep">g_node_copy_deep</a>                (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GCopyFunc">GCopyFunc</a> copy_func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);

<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-insert">g_node_insert</a>                   (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-Basic-Types.html#gint">gint</a> position,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-insert-before">g_node_insert_before</a>            (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-insert-after">g_node_insert_after</a>             (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
#define     <a href="glib-N-ary-Trees.html#g-node-append">g_node_append</a>                   (parent, node)
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-prepend">g_node_prepend</a>                  (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);

#define     <a href="glib-N-ary-Trees.html#g-node-insert-data">g_node_insert_data</a>              (parent, position, data)
#define     <a href="glib-N-ary-Trees.html#g-node-insert-data-before">g_node_insert_data_before</a>       (parent, sibling, data)
#define     <a href="glib-N-ary-Trees.html#g-node-append-data">g_node_append_data</a>              (parent, data)
#define     <a href="glib-N-ary-Trees.html#g-node-prepend-data">g_node_prepend_data</a>             (parent, data)

void        <a href="glib-N-ary-Trees.html#g-node-reverse-children">g_node_reverse_children</a>         (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
void        <a href="glib-N-ary-Trees.html#g-node-traverse">g_node_traverse</a>                 (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                             <a href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gint">gint</a> max_depth,
                                             <a href="glib-N-ary-Trees.html#GNodeTraverseFunc">GNodeTraverseFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
enum        <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a>;
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    (<a href="glib-N-ary-Trees.html#GNodeTraverseFunc">*GNodeTraverseFunc</a>)            (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
void        <a href="glib-N-ary-Trees.html#g-node-children-foreach">g_node_children_foreach</a>         (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-N-ary-Trees.html#GNodeForeachFunc">GNodeForeachFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
void        (<a href="glib-N-ary-Trees.html#GNodeForeachFunc">*GNodeForeachFunc</a>)             (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);

<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-get-root">g_node_get_root</a>                 (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-find">g_node_find</a>                     (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                             <a href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-find-child">g_node_find_child</a>               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a href="glib-Basic-Types.html#gint">gint</a>        <a href="glib-N-ary-Trees.html#g-node-child-index">g_node_child_index</a>              (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);
<a href="glib-Basic-Types.html#gint">gint</a>        <a href="glib-N-ary-Trees.html#g-node-child-position">g_node_child_position</a>           (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *child);
#define     <a href="glib-N-ary-Trees.html#g-node-first-child">g_node_first_child</a>              (node)
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-last-child">g_node_last_child</a>               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-nth-child">g_node_nth_child</a>                (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#guint">guint</a> n);
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-first-sibling">g_node_first_sibling</a>            (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
#define     <a href="glib-N-ary-Trees.html#g-node-next-sibling">g_node_next_sibling</a>             (node)
#define     <a href="glib-N-ary-Trees.html#g-node-prev-sibling">g_node_prev_sibling</a>             (node)
<a href="glib-N-ary-Trees.html#GNode">GNode</a>*      <a href="glib-N-ary-Trees.html#g-node-last-sibling">g_node_last_sibling</a>             (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);

#define     <a href="glib-N-ary-Trees.html#G-NODE-IS-LEAF-CAPS">G_NODE_IS_LEAF</a>                  (node)
#define     <a href="glib-N-ary-Trees.html#G-NODE-IS-ROOT-CAPS">G_NODE_IS_ROOT</a>                  (node)
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-N-ary-Trees.html#g-node-depth">g_node_depth</a>                    (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-N-ary-Trees.html#g-node-n-nodes">g_node_n_nodes</a>                  (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-N-ary-Trees.html#g-node-n-children">g_node_n_children</a>               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
<a href="glib-Basic-Types.html#gboolean">gboolean</a>    <a href="glib-N-ary-Trees.html#g-node-is-ancestor">g_node_is_ancestor</a>              (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *descendant);
<a href="glib-Basic-Types.html#guint">guint</a>       <a href="glib-N-ary-Trees.html#g-node-max-height">g_node_max_height</a>               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root);

void        <a href="glib-N-ary-Trees.html#g-node-unlink">g_node_unlink</a>                   (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);
void        <a href="glib-N-ary-Trees.html#g-node-destroy">g_node_destroy</a>                  (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root);

void        <a href="glib-N-ary-Trees.html#g-node-push-allocator">g_node_push_allocator</a>           (<a href="glib-Memory-Allocators.html#GAllocator">GAllocator</a> *allocator);
void        <a href="glib-N-ary-Trees.html#g-node-pop-allocator">g_node_pop_allocator</a>            (void);
</pre></div><div class="refsect1" lang="en"><a name="id3312241"></a><h2>Description</h2><p>
The <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> struct and its associated functions provide a N-ary tree data
structure, where nodes in the tree can contain arbitrary data.
</p><p>
To create a new tree use <a href="glib-N-ary-Trees.html#g-node-new"><tt class="function">g_node_new()</tt></a>.
</p><p>
To insert a node into a tree use <a href="glib-N-ary-Trees.html#g-node-insert"><tt class="function">g_node_insert()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-insert-before"><tt class="function">g_node_insert_before()</tt></a>,
<a href="glib-N-ary-Trees.html#g-node-append"><tt class="function">g_node_append()</tt></a> and <a href="glib-N-ary-Trees.html#g-node-prepend"><tt class="function">g_node_prepend()</tt></a>.
</p><p>
To create a new node and insert it into a tree use <a href="glib-N-ary-Trees.html#g-node-insert-data"><tt class="function">g_node_insert_data()</tt></a>, 
<a href="glib-N-ary-Trees.html#g-node-insert-data-before"><tt class="function">g_node_insert_data_before()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-append-data"><tt class="function">g_node_append_data()</tt></a> and <a href="glib-N-ary-Trees.html#g-node-prepend-data"><tt class="function">g_node_prepend_data()</tt></a>.
</p><p>
To reverse the children of a node use <a href="glib-N-ary-Trees.html#g-node-reverse-children"><tt class="function">g_node_reverse_children()</tt></a>.
</p><p>
To find a node use <a href="glib-N-ary-Trees.html#g-node-get-root"><tt class="function">g_node_get_root()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-find"><tt class="function">g_node_find()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-find-child"><tt class="function">g_node_find_child()</tt></a>,
<a href="glib-N-ary-Trees.html#g-node-child-index"><tt class="function">g_node_child_index()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-child-position"><tt class="function">g_node_child_position()</tt></a>, 
<a href="glib-N-ary-Trees.html#g-node-first-child"><tt class="function">g_node_first_child()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-last-child"><tt class="function">g_node_last_child()</tt></a>,
<a href="glib-N-ary-Trees.html#g-node-nth-child"><tt class="function">g_node_nth_child()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-first-sibling"><tt class="function">g_node_first_sibling()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-prev-sibling"><tt class="function">g_node_prev_sibling()</tt></a>,
<a href="glib-N-ary-Trees.html#g-node-next-sibling"><tt class="function">g_node_next_sibling()</tt></a> or <a href="glib-N-ary-Trees.html#g-node-last-sibling"><tt class="function">g_node_last_sibling()</tt></a>.
</p><p>
To get information about a node or tree use <a href="glib-N-ary-Trees.html#G-NODE-IS-LEAF-CAPS"><tt class="function">G_NODE_IS_LEAF()</tt></a>,
<a href="glib-N-ary-Trees.html#G-NODE-IS-ROOT-CAPS"><tt class="function">G_NODE_IS_ROOT()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-depth"><tt class="function">g_node_depth()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-n-nodes"><tt class="function">g_node_n_nodes()</tt></a>, <a href="glib-N-ary-Trees.html#g-node-n-children"><tt class="function">g_node_n_children()</tt></a>,
<a href="glib-N-ary-Trees.html#g-node-is-ancestor"><tt class="function">g_node_is_ancestor()</tt></a> or <a href="glib-N-ary-Trees.html#g-node-max-height"><tt class="function">g_node_max_height()</tt></a>.
</p><p>
To traverse a tree, calling a function for each node visited in the
traversal, use <a href="glib-N-ary-Trees.html#g-node-traverse"><tt class="function">g_node_traverse()</tt></a> or <a href="glib-N-ary-Trees.html#g-node-children-foreach"><tt class="function">g_node_children_foreach()</tt></a>.
</p><p>
To remove a node or subtree from a tree use <a href="glib-N-ary-Trees.html#g-node-unlink"><tt class="function">g_node_unlink()</tt></a> or
<a href="glib-N-ary-Trees.html#g-node-destroy"><tt class="function">g_node_destroy()</tt></a>.
</p></div><div class="refsect1" lang="en"><a name="id3312642"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3312648"></a><h3><a name="GNode"></a>struct GNode</h3><a class="indexterm" name="id3312658"></a><pre class="programlisting">struct GNode {

  gpointer data;
  GNode	  *next;
  GNode	  *prev;
  GNode	  *parent;
  GNode	  *children;
};
</pre><p>
The <span class="structname">GNode</span> struct represents one node in a
<a href="glib-N-ary-Trees.html" title="N-ary Trees">N-ary Tree</a>.
The <i class="structfield"><tt>data</tt></i> field contains the actual data of the node.
The <i class="structfield"><tt>next</tt></i> and <i class="structfield"><tt>prev</tt></i>
fields point to the node's siblings (a sibling is another <span class="structname">GNode</span> with the
same parent).
The <i class="structfield"><tt>parent</tt></i> field points to the parent of the <span class="structname">GNode</span>,
or is <tt class="literal">NULL</tt> if the <span class="structname">GNode</span> is the root of the tree.
The <i class="structfield"><tt>children</tt></i> field points to the first child of the
<span class="structname">GNode</span>. The other children are accessed by using the
<i class="structfield"><tt>next</tt></i> pointer of each child.
</p></div><hr><div class="refsect2" lang="en"><a name="id3312734"></a><h3><a name="g-node-new"></a>g_node_new ()</h3><a class="indexterm" name="id3312744"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_new                      (<a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Creates a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> containing the given data.
Used to create the first node in a tree.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data of the new node.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3312818"></a><h3><a name="g-node-copy"></a>g_node_copy ()</h3><a class="indexterm" name="id3312828"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_copy                     (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Recursively copies a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> (but does not deep-copy the data inside the nodes,
see <a href="glib-N-ary-Trees.html#g-node-copy-deep"><tt class="function">g_node_copy_deep()</tt></a> if you need that).
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> containing the same data pointers.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3312920"></a><h3><a name="GCopyFunc"></a>GCopyFunc ()</h3><a class="indexterm" name="id3312931"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gpointer">gpointer</a>    (*GCopyFunc)                    (<a href="glib-Basic-Types.html#gconstpointer">gconstpointer</a> src,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
A function of this signature is used to copy the node data when doing a deep-copy
of a tree. 
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>src</tt></i> :</span></td><td>A pointer to the data which should be copied.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>Additional data.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>A pointer to the copy.
</td></tr></tbody></table></div><p>Since 2.4


</p></div><hr><div class="refsect2" lang="en"><a name="id3313016"></a><h3><a name="g-node-copy-deep"></a>g_node_copy_deep ()</h3><a class="indexterm" name="id3313026"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_copy_deep                (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GCopyFunc">GCopyFunc</a> copy_func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Recursively copies a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> and its data.</p><p>

</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td> a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>
</td></tr><tr><td><span class="term"><i class="parameter"><tt>copy_func</tt></i> :</span></td><td> the function which is called to copy the data inside each node,
  or <tt class="literal">NULL</tt> to use the original data.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td> data to pass to <i class="parameter"><tt>copy_func</tt></i>
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> containing copies of the data in <i class="parameter"><tt>node</tt></i>.

</td></tr></tbody></table></div><p>Since  2.4
</p></div><hr><div class="refsect2" lang="en"><a name="id3313177"></a><h3><a name="g-node-insert"></a>g_node_insert ()</h3><a class="indexterm" name="id3313187"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_insert                   (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-Basic-Types.html#gint">gint</a> position,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Inserts a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> beneath the parent at the given position.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <i class="parameter"><tt>node</tt></i> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>position</tt></i> :</span></td><td>the position to place <i class="parameter"><tt>node</tt></i> at, with respect to its siblings.
If position is -1, <i class="parameter"><tt>node</tt></i> is inserted as the last child of <i class="parameter"><tt>parent</tt></i>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the inserted <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3313345"></a><h3><a name="g-node-insert-before"></a>g_node_insert_before ()</h3><a class="indexterm" name="id3313356"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_insert_before            (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Inserts a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> beneath the parent before the given sibling.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <i class="parameter"><tt>node</tt></i> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>sibling</tt></i> :</span></td><td>the sibling <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <i class="parameter"><tt>node</tt></i> before. If sibling is <tt class="literal">NULL</tt>,
the node is inserted as the last child of <i class="parameter"><tt>parent</tt></i>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the inserted <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3313522"></a><h3><a name="g-node-insert-after"></a>g_node_insert_after ()</h3><a class="indexterm" name="id3313533"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_insert_after             (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *sibling,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Inserts a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> beneath the parent after the given sibling.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <i class="parameter"><tt>node</tt></i> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>sibling</tt></i> :</span></td><td>the sibling <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place <i class="parameter"><tt>node</tt></i> after. If sibling is <tt class="literal">NULL</tt>,
the node is inserted as the first child of <i class="parameter"><tt>parent</tt></i>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the inserted <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3313698"></a><h3><a name="g-node-append"></a>g_node_append()</h3><a class="indexterm" name="id3313709"></a><pre class="programlisting">#define     g_node_append(parent, node)</pre><p>
Inserts a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the last child of the given parent.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the inserted <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3313807"></a><h3><a name="g-node-prepend"></a>g_node_prepend ()</h3><a class="indexterm" name="id3313818"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_prepend                  (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *parent,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Inserts a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the first child of the given parent.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to insert.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the inserted <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3313937"></a><h3><a name="g-node-insert-data"></a>g_node_insert_data()</h3><a class="indexterm" name="id3313948"></a><pre class="programlisting">#define     g_node_insert_data(parent, position, data)</pre><p>
Inserts a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> at the given position.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>position</tt></i> :</span></td><td>the position to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> at.
If position is -1, the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is inserted as the last child of <i class="parameter"><tt>parent</tt></i>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data for the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3314083"></a><h3><a name="g-node-insert-data-before"></a>g_node_insert_data_before()</h3><a class="indexterm" name="id3314094"></a><pre class="programlisting">#define     g_node_insert_data_before(parent, sibling, data)</pre><p>
Inserts a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> before the given sibling.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>sibling</tt></i> :</span></td><td>the sibling <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> before.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data for the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3314222"></a><h3><a name="g-node-append-data"></a>g_node_append_data()</h3><a class="indexterm" name="id3314234"></a><pre class="programlisting">#define     g_node_append_data(parent, data)</pre><p>
Inserts a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the last child of the given parent.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data for the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3314332"></a><h3><a name="g-node-prepend-data"></a>g_node_prepend_data()</h3><a class="indexterm" name="id3314343"></a><pre class="programlisting">#define     g_node_prepend_data(parent, data)</pre><p>
Inserts a new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> as the first child of the given parent.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>parent</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to place the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> under.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data for the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the new <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3314441"></a><h3><a name="g-node-reverse-children"></a>g_node_reverse_children ()</h3><a class="indexterm" name="id3314453"></a><pre class="programlisting">void        g_node_reverse_children         (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Reverses the order of the children of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
(It doesn't change the order of the grandchildren.)
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3314516"></a><h3><a name="g-node-traverse"></a>g_node_traverse ()</h3><a class="indexterm" name="id3314527"></a><pre class="programlisting">void        g_node_traverse                 (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                             <a href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gint">gint</a> max_depth,
                                             <a href="glib-N-ary-Trees.html#GNodeTraverseFunc">GNodeTraverseFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Traverses a tree starting at the given root <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
It calls the given function for each node visited.
The traversal can be halted at any point by returning <tt class="literal">TRUE</tt> from <i class="parameter"><tt>func</tt></i>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>root</tt></i> :</span></td><td>the root <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> of the tree to traverse.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>order</tt></i> :</span></td><td>the order in which nodes are visited - <tt class="literal">G_IN_ORDER</tt>, <tt class="literal">G_PRE_ORDER</tt>,
<tt class="literal">G_POST_ORDER</tt>, or <tt class="literal">G_LEVEL_ORDER</tt>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>flags</tt></i> :</span></td><td>which types of children are to be visited, one of <tt class="literal">G_TRAVERSE_ALL</tt>,
<tt class="literal">G_TRAVERSE_LEAFS</tt> and <tt class="literal">G_TRAVERSE_NON_LEAFS</tt>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>max_depth</tt></i> :</span></td><td>the maximum depth of the traversal. Nodes below this
depth will not be visited. If max_depth is -1 all nodes in the tree are
visited. If depth is 1, only the root is visited. If depth is 2, the root
and its children are visited. And so on.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</span></td><td>the function to call for each visited <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>user data to pass to the function.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3314767"></a><h3><a name="GTraverseFlags"></a>enum GTraverseFlags</h3><a class="indexterm" name="id3314778"></a><pre class="programlisting">typedef enum
{
  G_TRAVERSE_LEAFS      = 1 &lt;&lt; 0,
  G_TRAVERSE_NON_LEAFS  = 1 &lt;&lt; 1,
  G_TRAVERSE_ALL        = G_TRAVERSE_LEAFS | G_TRAVERSE_NON_LEAFS,
  G_TRAVERSE_MASK       = 0x03
} GTraverseFlags;
</pre><p>
Specifies which nodes are visited during several of the tree functions,
including <a href="glib-N-ary-Trees.html#g-node-traverse"><tt class="function">g_node_traverse()</tt></a> and <a href="glib-N-ary-Trees.html#g-node-find"><tt class="function">g_node_find()</tt></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><tt class="literal">G_TRAVERSE_LEAFS</tt></span></td><td>only leaf nodes should be visited.
</td></tr><tr><td><span class="term"><tt class="literal">G_TRAVERSE_NON_LEAFS</tt></span></td><td>only non-leaf nodes should be visited.
</td></tr><tr><td><span class="term"><tt class="literal">G_TRAVERSE_ALL</tt></span></td><td>all nodes should be visited.
</td></tr><tr><td><span class="term"><tt class="literal">G_TRAVERSE_MASK</tt></span></td><td>

</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3314886"></a><h3><a name="GNodeTraverseFunc"></a>GNodeTraverseFunc ()</h3><a class="indexterm" name="id3314898"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    (*GNodeTraverseFunc)            (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Specifies the type of function passed to <a href="glib-N-ary-Trees.html#g-node-traverse"><tt class="function">g_node_traverse()</tt></a>.
The function is called with each of the nodes visited, together with the
user data passed to <a href="glib-N-ary-Trees.html#g-node-traverse"><tt class="function">g_node_traverse()</tt></a>.
If the function returns <tt class="literal">TRUE</tt>, then the traversal is stopped.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>user data passed to <a href="glib-N-ary-Trees.html#g-node-traverse"><tt class="function">g_node_traverse()</tt></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> to stop the traversal.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3315028"></a><h3><a name="g-node-children-foreach"></a>g_node_children_foreach ()</h3><a class="indexterm" name="id3315040"></a><pre class="programlisting">void        g_node_children_foreach         (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-N-ary-Trees.html#GNodeForeachFunc">GNodeForeachFunc</a> func,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Calls a function for each of the children of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
Note that it doesn't descend beneath the child nodes.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>flags</tt></i> :</span></td><td>which types of children are to be visited, one of <tt class="literal">G_TRAVERSE_ALL</tt>,
<tt class="literal">G_TRAVERSE_LEAFS</tt> and <tt class="literal">G_TRAVERSE_NON_LEAFS</tt>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>func</tt></i> :</span></td><td>the function to call for each visited node.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>user data to pass to the function.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3315189"></a><h3><a name="GNodeForeachFunc"></a>GNodeForeachFunc ()</h3><a class="indexterm" name="id3315199"></a><pre class="programlisting">void        (*GNodeForeachFunc)             (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Specifies the type of function passed to <a href="glib-N-ary-Trees.html#g-node-children-foreach"><tt class="function">g_node_children_foreach()</tt></a>.
The function is called with each child node, together with the user data
passed to <a href="glib-N-ary-Trees.html#g-node-children-foreach"><tt class="function">g_node_children_foreach()</tt></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>user data passed to <a href="glib-N-ary-Trees.html#g-node-children-foreach"><tt class="function">g_node_children_foreach()</tt></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3315310"></a><h3><a name="g-node-get-root"></a>g_node_get_root ()</h3><a class="indexterm" name="id3315320"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_get_root                 (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Gets the root of a tree.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the root of the tree.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3315385"></a><h3><a name="g-node-find"></a>g_node_find ()</h3><a class="indexterm" name="id3315395"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_find                     (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                             <a href="glib-Balanced-Binary-Trees.html#GTraverseType">GTraverseType</a> order,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Finds a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> in a tree.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>root</tt></i> :</span></td><td>the root <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> of the tree to search.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>order</tt></i> :</span></td><td>the order in which nodes are visited - <tt class="literal">G_IN_ORDER</tt>, <tt class="literal">G_PRE_ORDER</tt>,
<tt class="literal">G_POST_ORDER</tt>, or <tt class="literal">G_LEVEL_ORDER</tt>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>flags</tt></i> :</span></td><td>which types of children are to be searched, one of <tt class="literal">G_TRAVERSE_ALL</tt>,
<tt class="literal">G_TRAVERSE_LEAFS</tt> and <tt class="literal">G_TRAVERSE_NON_LEAFS</tt>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data to find.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the found <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <tt class="literal">NULL</tt> if the data is not found.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3315590"></a><h3><a name="g-node-find-child"></a>g_node_find_child ()</h3><a class="indexterm" name="id3315602"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_find_child               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Finds the first child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> with the given data.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>flags</tt></i> :</span></td><td>which types of children are to be searched, one of <tt class="literal">G_TRAVERSE_ALL</tt>,
<tt class="literal">G_TRAVERSE_LEAFS</tt> and <tt class="literal">G_TRAVERSE_NON_LEAFS</tt>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data to find.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the found child <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, or <tt class="literal">NULL</tt> if the data is not found.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3315750"></a><h3><a name="g-node-child-index"></a>g_node_child_index ()</h3><a class="indexterm" name="id3315762"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_node_child_index              (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre><p>
Gets the position of the first child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> which contains the given data.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>data</tt></i> :</span></td><td>the data to find.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the index of the child of <i class="parameter"><tt>node</tt></i> which contains <i class="parameter"><tt>data</tt></i>, or -1
if the data is not found.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3315869"></a><h3><a name="g-node-child-position"></a>g_node_child_position ()</h3><a class="indexterm" name="id3315881"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gint">gint</a>        g_node_child_position           (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *child);</pre><p>
Gets the position of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> with respect to its siblings.
<i class="parameter"><tt>child</tt></i> must be a child of <i class="parameter"><tt>node</tt></i>.
The first child is numbered 0, the second 1, and so on.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>child</tt></i> :</span></td><td>a child of <i class="parameter"><tt>node</tt></i>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the position of <i class="parameter"><tt>child</tt></i> with respect to its siblings.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316000"></a><h3><a name="g-node-first-child"></a>g_node_first_child()</h3><a class="indexterm" name="id3316012"></a><pre class="programlisting">#define     g_node_first_child(node)</pre><p>
Gets the first child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the last child of <i class="parameter"><tt>node</tt></i>, or <tt class="literal">NULL</tt> if <i class="parameter"><tt>node</tt></i> is <tt class="literal">NULL</tt> or has no children.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316095"></a><h3><a name="g-node-last-child"></a>g_node_last_child ()</h3><a class="indexterm" name="id3316107"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_last_child               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Gets the last child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> (must not be <tt class="literal">NULL</tt>).
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the last child of <i class="parameter"><tt>node</tt></i>, or <tt class="literal">NULL</tt> if <i class="parameter"><tt>node</tt></i> has no children.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316203"></a><h3><a name="g-node-nth-child"></a>g_node_nth_child ()</h3><a class="indexterm" name="id3316214"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_nth_child                (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-Basic-Types.html#guint">guint</a> n);</pre><p>
Gets a child of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>, using the given index.
The first child is at index 0. If the index is too big, <tt class="literal">NULL</tt> is returned.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>n</tt></i> :</span></td><td>the index of the desired child.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the child of <i class="parameter"><tt>node</tt></i> at index <i class="parameter"><tt>n</tt></i>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316327"></a><h3><a name="g-node-first-sibling"></a>g_node_first_sibling ()</h3><a class="indexterm" name="id3316338"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_first_sibling            (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Gets the first sibling of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
This could possibly be the node itself.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the first sibling of <i class="parameter"><tt>node</tt></i>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316418"></a><h3><a name="g-node-next-sibling"></a>g_node_next_sibling()</h3><a class="indexterm" name="id3316429"></a><pre class="programlisting">#define     g_node_next_sibling(node)</pre><p>
Gets the next sibling of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the next sibling of <i class="parameter"><tt>node</tt></i>, or <tt class="literal">NULL</tt> if <i class="parameter"><tt>node</tt></i> is <tt class="literal">NULL</tt>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316513"></a><h3><a name="g-node-prev-sibling"></a>g_node_prev_sibling()</h3><a class="indexterm" name="id3316524"></a><pre class="programlisting">#define     g_node_prev_sibling(node)</pre><p>
Gets the previous sibling of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the previous sibling of <i class="parameter"><tt>node</tt></i>, or <tt class="literal">NULL</tt> if <i class="parameter"><tt>node</tt></i> is <tt class="literal">NULL</tt>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316608"></a><h3><a name="g-node-last-sibling"></a>g_node_last_sibling ()</h3><a class="indexterm" name="id3316619"></a><pre class="programlisting"><a href="glib-N-ary-Trees.html#GNode">GNode</a>*      g_node_last_sibling             (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Gets the last sibling of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
This could possibly be the node itself.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the last sibling of <i class="parameter"><tt>node</tt></i>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316698"></a><h3><a name="G-NODE-IS-LEAF-CAPS"></a>G_NODE_IS_LEAF()</h3><a class="indexterm" name="id3316709"></a><pre class="programlisting">#define	 G_NODE_IS_LEAF(node)	(((GNode*) (node))-&gt;children == NULL)
</pre><p>
Returns <tt class="literal">TRUE</tt> if a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is a leaf node.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> if the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is a leaf node (i.e. it has no children).


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316789"></a><h3><a name="G-NODE-IS-ROOT-CAPS"></a>G_NODE_IS_ROOT()</h3><a class="indexterm" name="id3316799"></a><pre class="programlisting">#define     G_NODE_IS_ROOT(node)</pre><p>
Returns <tt class="literal">TRUE</tt> if a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is the root of a tree.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> if the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> is the root of a tree (i.e. it has no parent
or siblings).


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316878"></a><h3><a name="g-node-depth"></a>g_node_depth ()</h3><a class="indexterm" name="id3316889"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_node_depth                    (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Gets the depth of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</p><p>
If <i class="parameter"><tt>node</tt></i> is <tt class="literal">NULL</tt> the depth is 0.
The root node has a depth of 1.
For the children of the root node the depth is 2. And so on.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the depth of the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3316986"></a><h3><a name="g-node-n-nodes"></a>g_node_n_nodes ()</h3><a class="indexterm" name="id3316997"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_node_n_nodes                  (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root,
                                             <a href="glib-N-ary-Trees.html#GTraverseFlags">GTraverseFlags</a> flags);</pre><p>
Gets the number of nodes in a tree.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>root</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>flags</tt></i> :</span></td><td>which types of children are to be counted, one of <tt class="literal">G_TRAVERSE_ALL</tt>,
<tt class="literal">G_TRAVERSE_LEAFS</tt> and <tt class="literal">G_TRAVERSE_NON_LEAFS</tt>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of nodes in the tree.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3317102"></a><h3><a name="g-node-n-children"></a>g_node_n_children ()</h3><a class="indexterm" name="id3317114"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_node_n_children               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Gets the number of children of a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the number of children of <i class="parameter"><tt>node</tt></i>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3317192"></a><h3><a name="g-node-is-ancestor"></a>g_node_is_ancestor ()</h3><a class="indexterm" name="id3317203"></a><pre class="programlisting"><a href="glib-Basic-Types.html#gboolean">gboolean</a>    g_node_is_ancestor              (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node,
                                             <a href="glib-N-ary-Trees.html#GNode">GNode</a> *descendant);</pre><p>
Returns <tt class="literal">TRUE</tt> if <i class="parameter"><tt>node</tt></i> is an ancestor of <i class="parameter"><tt>descendant</tt></i>.
This is true if node is the parent of <i class="parameter"><tt>descendant</tt></i>, or if node is the
grandparent of <i class="parameter"><tt>descendant</tt></i> etc.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>descendant</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td><tt class="literal">TRUE</tt> if <i class="parameter"><tt>node</tt></i> is an ancestor of <i class="parameter"><tt>descendant</tt></i>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3317344"></a><h3><a name="g-node-max-height"></a>g_node_max_height ()</h3><a class="indexterm" name="id3317356"></a><pre class="programlisting"><a href="glib-Basic-Types.html#guint">guint</a>       g_node_max_height               (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root);</pre><p>
Gets the maximum height of all branches beneath a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
This is the maximum distance from the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to all leaf nodes.
</p><p>
If <i class="parameter"><tt>root</tt></i> is <tt class="literal">NULL</tt>, 0 is returned. If <i class="parameter"><tt>root</tt></i> has no children, 1 is returned.
If <i class="parameter"><tt>root</tt></i> has children, 2 is returned. And so on.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>root</tt></i> :</span></td><td>a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the maximum height of the tree beneath <i class="parameter"><tt>root</tt></i>.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3317472"></a><h3><a name="g-node-unlink"></a>g_node_unlink ()</h3><a class="indexterm" name="id3317482"></a><pre class="programlisting">void        g_node_unlink                   (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *node);</pre><p>
Unlinks a <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> from a tree, resulting in two separate trees.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>node</tt></i> :</span></td><td>the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> to unlink, which becomes the root of a new tree.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3317546"></a><h3><a name="g-node-destroy"></a>g_node_destroy ()</h3><a class="indexterm" name="id3317557"></a><pre class="programlisting">void        g_node_destroy                  (<a href="glib-N-ary-Trees.html#GNode">GNode</a> *root);</pre><p>
Removes the <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> and its children from the tree, freeing any memory
allocated.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>root</tt></i> :</span></td><td>the root of the tree/subtree to destroy.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3317613"></a><h3><a name="g-node-push-allocator"></a>g_node_push_allocator ()</h3><a class="indexterm" name="id3317624"></a><pre class="programlisting">void        g_node_push_allocator           (<a href="glib-Memory-Allocators.html#GAllocator">GAllocator</a> *allocator);</pre><p>
Sets the allocator to use to allocate <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> elements.
Use <a href="glib-N-ary-Trees.html#g-node-pop-allocator"><tt class="function">g_node_pop_allocator()</tt></a> to restore the previous allocator.
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>allocator</tt></i> :</span></td><td>the <a href="glib-Memory-Allocators.html#GAllocator"><span class="type">GAllocator</span></a> to use when allocating <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> elements.


</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3317707"></a><h3><a name="g-node-pop-allocator"></a>g_node_pop_allocator ()</h3><a class="indexterm" name="id3317718"></a><pre class="programlisting">void        g_node_pop_allocator            (void);</pre><p>
Restores the previous <a href="glib-Memory-Allocators.html#GAllocator"><span class="type">GAllocator</span></a>, used when allocating <a href="glib-N-ary-Trees.html#GNode"><span class="type">GNode</span></a> elements.
</p></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="glib-Balanced-Binary-Trees.html"><b>&lt;&lt; Balanced Binary Trees</b></a></td><td align="right"><a accesskey="n" href="glib-Quarks.html"><b>Quarks &gt;&gt;</b></a></td></tr></table></body></html>