## Tree


A tree data structure with a nested Node class.


Usage


``` python
Tree(root_value=None)
```


## Parameters


`root_value=None`  
Value for the root node.


## Classes

| Name | Description |
|----|----|
| [Node](#Node) | A tree node. |

------------------------------------------------------------------------


#### Node


A tree node.


Usage


``` python
Node(value)
```


##### Parameters


`value`  
The node value.


##### Methods

| Name | Description |
|----|----|
| [add_child()](#add_child) | Add a child node. |
| [is_leaf()](#is_leaf) | Check if this node is a leaf. |


##### add_child()


Add a child node.


Usage


``` python
add_child(value)
```


###### Parameters


`value`  
The child's value.


###### Returns


`Tree.Node`  
The new child node.


##### is_leaf()


Check if this node is a leaf.


Usage


``` python
is_leaf()
```


###### Returns


`bool`  
True if no children.


## Methods

| Name | Description |
|----|----|
| [depth()](#depth) | Calculate the depth of the tree. |
| [size()](#size) | Count the total number of nodes. |

------------------------------------------------------------------------


#### depth()


Calculate the depth of the tree.


Usage


``` python
depth()
```


##### Returns


`int`  
Maximum depth from root to leaf.


------------------------------------------------------------------------


#### size()


Count the total number of nodes.


Usage


``` python
size()
```


##### Returns


`int`  
Total number of nodes.
