# innocent-gift/alu-binary_trees architecture

> Architecture diagram of the GitHub repository innocent-gift/alu-binary_trees, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/innocent-gift/alu-binary_trees
- Repository: https://github.com/innocent-gift/alu-binary_trees

## Overview

This is a small C binary-tree utility library for creating, modifying, traversing, measuring, and inspecting binary trees. Its principal workflow is for a caller to build or change a tree, then invoke traversal, measurement, or relationship helpers; these are independent API operations, not a built-in pipeline. The header documents the public API, while sampled source confirms printing behavior. Other function relationships are not inferred from filenames alone.

Main entry points: [`binary_tree_print.c`](https://github.com/innocent-gift/alu-binary_trees/blob/master/binary_tree_print.c) (Print Tree), [`0-binary_tree_node.c`](https://github.com/innocent-gift/alu-binary_trees/blob/master/0-binary_tree_node.c) (Create Node), [`1-binary_tree_insert_left.c`](https://github.com/innocent-gift/alu-binary_trees/blob/master/1-binary_tree_insert_left.c) (Insert Left), [`2-binary_tree_insert_right.c`](https://github.com/innocent-gift/alu-binary_trees/blob/master/2-binary_tree_insert_right.c) (Insert Right)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_structure["Tree Structure"]
  node_tree_model["Tree Node API<br/>[binary_trees.h]"]
  node_create_node["Create Node"]
  node_insert_left["Insert Left"]
  node_insert_right["Insert Right"]
  node_delete_tree["Delete Tree"]
end

subgraph group_traversal["Traversal"]
  node_preorder["Preorder Walk"]
  node_inorder["Inorder Walk"]
  node_postorder["Postorder Walk"]
  node_print_tree["Print Tree"]
end

subgraph group_metrics["Tree Metrics"]
  node_is_leaf["Check Leaf"]
  node_is_root["Check Root"]
  node_height["Measure Height"]
  node_depth["Measure Depth"]
  node_size["Count Nodes"]
  node_leaves["Count Leaves"]
  node_internal_nodes["Count Internal"]
  node_balance["Measure Balance"]
  node_is_full["Check Full"]
  node_is_perfect["Check Perfect"]
end

subgraph group_relationships["Node Relationships"]
  node_sibling["Find Sibling"]
  node_uncle["Find Uncle"]
end

node_caller(("Library Caller"))
node_stdout(("Standard Output"))

node_caller -->|"creates"| node_create_node
node_caller -->|"inserts"| node_insert_left
node_caller -->|"inserts"| node_insert_right
node_caller -->|"deletes"| node_delete_tree
node_caller -->|"traverses"| node_preorder
node_caller -->|"traverses"| node_inorder
node_caller -->|"traverses"| node_postorder
node_caller -->|"prints"| node_print_tree
node_caller -->|"measures"| node_height
node_caller -->|"measures"| node_depth
node_caller -->|"counts"| node_size
node_caller -->|"counts"| node_leaves
node_caller -->|"counts"| node_internal_nodes
node_caller -->|"checks"| node_balance
node_caller -->|"checks"| node_is_full
node_caller -->|"checks"| node_is_perfect
node_caller -->|"checks"| node_is_leaf
node_caller -->|"checks"| node_is_root
node_caller -->|"finds"| node_sibling
node_caller -->|"finds"| node_uncle
node_print_tree -->|"prints to"| node_stdout

click node_tree_model "https://github.com/innocent-gift/alu-binary_trees/blob/master/binary_trees.h"
click node_create_node "https://github.com/innocent-gift/alu-binary_trees/blob/master/0-binary_tree_node.c"
click node_insert_left "https://github.com/innocent-gift/alu-binary_trees/blob/master/1-binary_tree_insert_left.c"
click node_insert_right "https://github.com/innocent-gift/alu-binary_trees/blob/master/2-binary_tree_insert_right.c"
click node_delete_tree "https://github.com/innocent-gift/alu-binary_trees/blob/master/3-binary_tree_delete.c"
click node_preorder "https://github.com/innocent-gift/alu-binary_trees/blob/master/6-binary_tree_preorder.c"
click node_inorder "https://github.com/innocent-gift/alu-binary_trees/blob/master/7-binary_tree_inorder.c"
click node_postorder "https://github.com/innocent-gift/alu-binary_trees/blob/master/8-binary_tree_postorder.c"
click node_print_tree "https://github.com/innocent-gift/alu-binary_trees/blob/master/binary_tree_print.c"
click node_is_leaf "https://github.com/innocent-gift/alu-binary_trees/blob/master/4-binary_tree_is_leaf.c"
click node_is_root "https://github.com/innocent-gift/alu-binary_trees/blob/master/5-binary_tree_is_root.c"
click node_height "https://github.com/innocent-gift/alu-binary_trees/blob/master/9-binary_tree_height.c"
click node_depth "https://github.com/innocent-gift/alu-binary_trees/blob/master/10-binary_tree_depth.c"
click node_size "https://github.com/innocent-gift/alu-binary_trees/blob/master/11-binary_tree_size.c"
click node_leaves "https://github.com/innocent-gift/alu-binary_trees/blob/master/12-binary_tree_leaves.c"
click node_internal_nodes "https://github.com/innocent-gift/alu-binary_trees/blob/master/13-binary_tree_nodes.c"
click node_balance "https://github.com/innocent-gift/alu-binary_trees/blob/master/14-binary_tree_balance.c"
click node_is_full "https://github.com/innocent-gift/alu-binary_trees/blob/master/15-binary_tree_is_full.c"
click node_is_perfect "https://github.com/innocent-gift/alu-binary_trees/blob/master/16-binary_tree_is_perfect.c"
click node_sibling "https://github.com/innocent-gift/alu-binary_trees/blob/master/17-binary_tree_sibling.c"
click node_uncle "https://github.com/innocent-gift/alu-binary_trees/blob/master/18-binary_tree_uncle.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_tree_model,node_create_node,node_insert_left,node_insert_right,node_delete_tree toneBlue
class node_preorder,node_inorder,node_postorder,node_print_tree toneAmber
class node_is_leaf,node_is_root,node_height,node_depth,node_size,node_leaves,node_internal_nodes,node_balance,node_is_full,node_is_perfect toneMint
class node_sibling,node_uncle toneRose
class node_caller,node_stdout toneIndigo
```

## Components

### Tree Structure

- [Tree Node API](https://github.com/innocent-gift/alu-binary_trees/blob/master/binary_trees.h): `binary_trees.h`
- [Create Node](https://github.com/innocent-gift/alu-binary_trees/blob/master/0-binary_tree_node.c): `0-binary_tree_node.c`
- [Insert Left](https://github.com/innocent-gift/alu-binary_trees/blob/master/1-binary_tree_insert_left.c): `1-binary_tree_insert_left.c`
- [Insert Right](https://github.com/innocent-gift/alu-binary_trees/blob/master/2-binary_tree_insert_right.c): `2-binary_tree_insert_right.c`
- [Delete Tree](https://github.com/innocent-gift/alu-binary_trees/blob/master/3-binary_tree_delete.c): `3-binary_tree_delete.c`

### Traversal

- [Preorder Walk](https://github.com/innocent-gift/alu-binary_trees/blob/master/6-binary_tree_preorder.c): `6-binary_tree_preorder.c`
- [Inorder Walk](https://github.com/innocent-gift/alu-binary_trees/blob/master/7-binary_tree_inorder.c): `7-binary_tree_inorder.c`
- [Postorder Walk](https://github.com/innocent-gift/alu-binary_trees/blob/master/8-binary_tree_postorder.c): `8-binary_tree_postorder.c`
- [Print Tree](https://github.com/innocent-gift/alu-binary_trees/blob/master/binary_tree_print.c): `binary_tree_print.c`

### Tree Metrics

- [Check Leaf](https://github.com/innocent-gift/alu-binary_trees/blob/master/4-binary_tree_is_leaf.c): `4-binary_tree_is_leaf.c`
- [Check Root](https://github.com/innocent-gift/alu-binary_trees/blob/master/5-binary_tree_is_root.c): `5-binary_tree_is_root.c`
- [Measure Height](https://github.com/innocent-gift/alu-binary_trees/blob/master/9-binary_tree_height.c): `9-binary_tree_height.c`
- [Measure Depth](https://github.com/innocent-gift/alu-binary_trees/blob/master/10-binary_tree_depth.c): `10-binary_tree_depth.c`
- [Count Nodes](https://github.com/innocent-gift/alu-binary_trees/blob/master/11-binary_tree_size.c): `11-binary_tree_size.c`
- [Count Leaves](https://github.com/innocent-gift/alu-binary_trees/blob/master/12-binary_tree_leaves.c): `12-binary_tree_leaves.c`
- [Count Internal](https://github.com/innocent-gift/alu-binary_trees/blob/master/13-binary_tree_nodes.c): `13-binary_tree_nodes.c`
- [Measure Balance](https://github.com/innocent-gift/alu-binary_trees/blob/master/14-binary_tree_balance.c): `14-binary_tree_balance.c`
- [Check Full](https://github.com/innocent-gift/alu-binary_trees/blob/master/15-binary_tree_is_full.c): `15-binary_tree_is_full.c`
- [Check Perfect](https://github.com/innocent-gift/alu-binary_trees/blob/master/16-binary_tree_is_perfect.c): `16-binary_tree_is_perfect.c`

### Node Relationships

- [Find Sibling](https://github.com/innocent-gift/alu-binary_trees/blob/master/17-binary_tree_sibling.c): `17-binary_tree_sibling.c`
- [Find Uncle](https://github.com/innocent-gift/alu-binary_trees/blob/master/18-binary_tree_uncle.c): `18-binary_tree_uncle.c`

### Other components

- **Library Caller**
- **Standard Output**

## Connections

- Library Caller → Create Node: creates
- Library Caller → Insert Left: inserts
- Library Caller → Insert Right: inserts
- Library Caller → Delete Tree: deletes
- Library Caller → Preorder Walk: traverses
- Library Caller → Inorder Walk: traverses
- Library Caller → Postorder Walk: traverses
- Library Caller → Print Tree: prints
- Library Caller → Measure Height: measures
- Library Caller → Measure Depth: measures
- Library Caller → Count Nodes: counts
- Library Caller → Count Leaves: counts
- Library Caller → Count Internal: counts
- Library Caller → Measure Balance: checks
- Library Caller → Check Full: checks
- Library Caller → Check Perfect: checks
- Library Caller → Check Leaf: checks
- Library Caller → Check Root: checks
- Library Caller → Find Sibling: finds
- Library Caller → Find Uncle: finds
- Print Tree → Standard Output: prints to
