GLib.Node¶
Fields¶
| Name | Type | Access | Description | 
|---|---|---|---|
| children | GLib.Node | r/w | points to the first child of the GLib.Node.  The other children are accessed by using the next pointer of each child. | 
| data | object | r/w | contains the actual data of the node. | 
| next | GLib.Node | r/w | points to the node’s next sibling (a sibling is another GLib.Nodewith the same parent). | 
| parent | GLib.Node | r/w | points to the parent of the GLib.Node, or isNoneif theGLib.Nodeis the root of the tree. | 
| prev | GLib.Node | r/w | points to the node’s previous sibling. | 
Methods¶
| child_index(data) | |
| child_position(child) | |
| depth() | |
| destroy() | |
| is_ancestor(descendant) | |
| max_height() | |
| n_children() | |
| n_nodes(flags) | |
| reverse_children() | |
| unlink() | 
Details¶
- 
class GLib.Node¶
- The - GLib.Nodestruct represents one node in a n-ary tree.- 
child_index(data)[source]¶
- Parameters: - data ( - objector- None) – the data to find- Returns: - the index of the child of self which contains data, or -1 if the data is not found - Return type: - int- Gets the position of the first child of a - GLib.Nodewhich contains the given data.
 - 
child_position(child)[source]¶
- Parameters: - child ( - GLib.Node) – a child of self- Returns: - the position of child with respect to its siblings - Return type: - int- Gets the position of a - GLib.Nodewith respect to its siblings. child must be a child of self. The first child is numbered 0, the second 1, and so on.
 - 
depth()[source]¶
- Returns: - the depth of the - GLib.Node- Return type: - int- Gets the depth of a - GLib.Node.- If self is - Nonethe 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.
 - 
is_ancestor(descendant)[source]¶
- Parameters: - descendant ( - GLib.Node) – a- GLib.Node- Returns: - Trueif self is an ancestor of descendant- Return type: - bool- Returns - Trueif self is an ancestor of descendant. This is true if node is the parent of descendant, or if node is the grandparent of descendant etc.
 - 
max_height()[source]¶
- Returns: - the maximum height of the tree beneath self - Return type: - int- Gets the maximum height of all branches beneath a - GLib.Node. This is the maximum distance from the- GLib.Nodeto all leaf nodes.- If self is - None, 0 is returned. If self has no children, 1 is returned. If self has children, 2 is returned. And so on.
 - 
n_children()[source]¶
- Returns: - the number of children of self - Return type: - int- Gets the number of children of a - GLib.Node.
 - 
n_nodes(flags)[source]¶
- Parameters: - flags ( - GLib.TraverseFlags) – which types of children are to be counted, one of- GLib.TraverseFlags.ALL,- GLib.TraverseFlags.LEAVESand- GLib.TraverseFlags.NON_LEAVES- Returns: - the number of nodes in the tree - Return type: - int- Gets the number of nodes in a tree. 
 
-