# h0nzra/data_structure architecture

> Architecture diagram of the GitHub repository h0nzra/data_structure, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/h0nzra/data_structure
- Repository: https://github.com/h0nzra/data_structure

## Overview

libds is a generic C data-structure library: callers configure fixed-size elements, then use container-specific operations that copy element bytes into library-managed storage. Its documented capabilities include a min/max priority queue, a doubly linked list, and a LIFO stack; the tree and source index also show a FIFO queue implementation. Heap ordering and shared allocation helpers are useful internal layers. The queue and several implementation details are represented from the tree and index, not inspected excerpts, so their internal call relationships are omitted.

Main entry points: [`lib/src/heapq.c`](https://github.com/h0nzra/data_structure/blob/master/lib/src/heapq.c) (Heap Operations), [`lib/inc/queue.h`](https://github.com/h0nzra/data_structure/blob/master/lib/inc/queue.h) (Queue API), [`lib/inc/heapq.h`](https://github.com/h0nzra/data_structure/blob/master/lib/inc/heapq.h) (Heap API), [`lib/src/list_operation.c`](https://github.com/h0nzra/data_structure/blob/master/lib/src/list_operation.c) (Doubly Linked List)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_containers["Containers"]
  node_list["Doubly Linked List<br/>[list_operation.c]"]
  node_list_api["List API<br/>[list.h]"]
  node_stack["LIFO Stack<br/>[stack_operation.c]"]
  node_stack_api["Stack API<br/>[stack.h]"]
  node_queue["FIFO Queue<br/>[queue.c]"]
  node_queue_api["Queue API<br/>[queue.h]"]
end

subgraph group_heap["Priority Queue"]
  node_heap_api["Heap API<br/>[heapq.h]"]
  node_heap_core["Heap Operations<br/>[heapq.c]"]
  node_heap_order["Heap Ordering<br/>[heapq_operation.c]"]
  node_heap_relation["Heap Relations<br/>[heapq_relation.c]"]
end

subgraph group_memory["Storage Helpers"]
  node_memory["Dynamic Allocation<br/>[memory.c]"]
  node_queue_memory["Queue Storage<br/>[queue_memory.c]"]
end

node_caller(("Library Caller"))

node_caller -->|"pushes and pops"| node_stack
node_caller -->|"uses operations"| node_list
node_caller -->|"configures ordering"| node_heap_api
node_caller -.->|"uses FIFO operations"| node_queue_api
node_list_api -->|"declares operations"| node_list
node_stack_api -->|"declares operations"| node_stack
node_queue_api -->|"declares operations"| node_queue
node_heap_api -->|"declares operations"| node_heap_core
node_heap_core -->|"sifts and heapifies"| node_heap_order
node_heap_core -->|"resizes storage"| node_memory

click node_list "https://github.com/h0nzra/data_structure/blob/master/lib/src/list_operation.c"
click node_list_api "https://github.com/h0nzra/data_structure/blob/master/lib/inc/list.h"
click node_stack "https://github.com/h0nzra/data_structure/blob/master/lib/src/stack_operation.c"
click node_stack_api "https://github.com/h0nzra/data_structure/blob/master/lib/inc/stack.h"
click node_queue "https://github.com/h0nzra/data_structure/blob/master/lib/src/queue.c"
click node_queue_api "https://github.com/h0nzra/data_structure/blob/master/lib/inc/queue.h"
click node_heap_api "https://github.com/h0nzra/data_structure/blob/master/lib/inc/heapq.h"
click node_heap_core "https://github.com/h0nzra/data_structure/blob/master/lib/src/heapq.c"
click node_heap_order "https://github.com/h0nzra/data_structure/blob/master/lib/src/heapq_operation.c"
click node_heap_relation "https://github.com/h0nzra/data_structure/blob/master/lib/src/heapq_relation.c"
click node_memory "https://github.com/h0nzra/data_structure/blob/master/lib/src/memory.c"
click node_queue_memory "https://github.com/h0nzra/data_structure/blob/master/lib/src/queue_memory.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_list,node_list_api,node_stack,node_stack_api,node_queue,node_queue_api toneBlue
class node_heap_api,node_heap_core,node_heap_order,node_heap_relation toneAmber
class node_memory,node_queue_memory toneMint
class node_caller toneIndigo
```

## Components

### Containers

- [Doubly Linked List](https://github.com/h0nzra/data_structure/blob/master/lib/src/list_operation.c): `lib/src/list_operation.c`
- [List API](https://github.com/h0nzra/data_structure/blob/master/lib/inc/list.h): `lib/inc/list.h`
- [LIFO Stack](https://github.com/h0nzra/data_structure/blob/master/lib/src/stack_operation.c): `lib/src/stack_operation.c`
- [Stack API](https://github.com/h0nzra/data_structure/blob/master/lib/inc/stack.h): `lib/inc/stack.h`
- [FIFO Queue](https://github.com/h0nzra/data_structure/blob/master/lib/src/queue.c): `lib/src/queue.c`
- [Queue API](https://github.com/h0nzra/data_structure/blob/master/lib/inc/queue.h): `lib/inc/queue.h`

### Priority Queue

- [Heap API](https://github.com/h0nzra/data_structure/blob/master/lib/inc/heapq.h): `lib/inc/heapq.h`
- [Heap Operations](https://github.com/h0nzra/data_structure/blob/master/lib/src/heapq.c): `lib/src/heapq.c`
- [Heap Ordering](https://github.com/h0nzra/data_structure/blob/master/lib/src/heapq_operation.c): `lib/src/heapq_operation.c`
- [Heap Relations](https://github.com/h0nzra/data_structure/blob/master/lib/src/heapq_relation.c): `lib/src/heapq_relation.c`

### Storage Helpers

- [Dynamic Allocation](https://github.com/h0nzra/data_structure/blob/master/lib/src/memory.c): `lib/src/memory.c`
- [Queue Storage](https://github.com/h0nzra/data_structure/blob/master/lib/src/queue_memory.c): `lib/src/queue_memory.c`

### Other components

- **Library Caller**

## Connections

- Library Caller → LIFO Stack: pushes and pops (evidence: `README.md`)
- Library Caller → Doubly Linked List: uses operations (evidence: `README.md`)
- Library Caller → Heap API: configures ordering (evidence: `README.md`)
- Library Caller → Queue API: uses FIFO operations
- List API → Doubly Linked List: declares operations (evidence: `lib/inc/list.h`)
- Stack API → LIFO Stack: declares operations (evidence: `lib/inc/stack.h`)
- Queue API → FIFO Queue: declares operations (evidence: `lib/inc/queue.h`)
- Heap API → Heap Operations: declares operations (evidence: `lib/inc/heapq.h`)
- Heap Operations → Heap Ordering: sifts and heapifies (evidence: `lib/src/heapq.c`)
- Heap Operations → Dynamic Allocation: resizes storage (evidence: `lib/src/heapq.c`)
