# delialia/bst architecture

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

- Interactive diagram: https://gitdiagram.com/delialia/bst
- Repository: https://github.com/delialia/bst

## Overview

This repository is a Python library and research code for converting numeric time series into undirected natural and horizontal visibility graphs. The main user workflow is to provide a series and timeline, choose the basic, divide-and-conquer, or BST implementation, and receive visibility connections; the example compares algorithm outputs. Separate paper experiments benchmark these methods on generated, finance, and speech data, and plotting scripts visualize the reported results. The excerpts show the algorithm calls and experiment wiring; unsampled implementation details are not inferred.

Main entry points: [`run_exp02_finance.py`](https://github.com/delialia/bst/blob/master/run_exp02_finance.py) (Finance benchmarks), [`run_exp02_speech.py`](https://github.com/delialia/bst/blob/master/run_exp02_speech.py) (Speech benchmarks), [`example.py`](https://github.com/delialia/bst/blob/master/example.py) (Algorithm comparison example), [`results`](https://github.com/delialia/bst/tree/master/results) (Experiment results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_algorithms["Graph algorithms"]
  node_basic_nvg["Basic NVG"]
  node_dc_nvg["Divide-conquer NVG"]
  node_basic_hvg["Basic HVG"]
  node_dc_hvg["Divide-conquer HVG"]
  node_bst_visibility["BST visibility<br/>[node_class.py]"]
  node_bst_nodes["BST node operations<br/>[node_class.py]"]
end

subgraph group_experiments["Research experiments"]
  node_example["Algorithm comparison example<br/>[example.py]"]
  node_exp01["Synthetic benchmarks<br/>[run_exp01.py]"]
  node_exp02_finance["Finance benchmarks"]
  node_exp02_speech["Speech benchmarks"]
  node_exp03["Online merge benchmark<br/>[run_exp03.py]"]
end

subgraph group_reporting["Results and plots"]
  node_experiment_results["Experiment results"]
  node_plot01["Synthetic result plots"]
  node_plot02["Domain result plots"]
  node_plot03["Merge result plot"]
  node_sample_data["Plot sample data"]
end

node_user(("Library user"))
node_series["Time series"]
node_finance_data["Finance input data"]
node_speech_data["Speech input data"]

node_user -->|"runs example"| node_example
node_series -->|"provides input"| node_example
node_example -->|"calls"| node_basic_nvg
node_example -->|"calls"| node_dc_nvg
node_example -->|"calls"| node_basic_hvg
node_example -->|"calls"| node_dc_hvg
node_example -->|"calls"| node_bst_visibility
node_bst_visibility -->|"uses node methods"| node_bst_nodes
node_exp01 -->|"benchmarks"| node_basic_nvg
node_exp01 -->|"benchmarks"| node_dc_nvg
node_exp01 -->|"benchmarks"| node_basic_hvg
node_exp01 -->|"benchmarks"| node_dc_hvg
node_exp01 -->|"benchmarks"| node_bst_visibility
node_exp01 -->|"writes results"| node_experiment_results
node_exp02_finance -->|"reads"| node_finance_data
node_exp02_finance -->|"benchmarks"| node_basic_nvg
node_exp02_finance -->|"benchmarks"| node_dc_nvg
node_exp02_finance -->|"benchmarks"| node_basic_hvg
node_exp02_finance -->|"benchmarks"| node_dc_hvg
node_exp02_finance -->|"benchmarks"| node_bst_visibility
node_exp02_finance -->|"writes results"| node_experiment_results
node_exp02_speech -->|"reads"| node_speech_data
node_exp02_speech -->|"benchmarks"| node_basic_nvg
node_exp02_speech -->|"benchmarks"| node_dc_nvg
node_exp02_speech -->|"benchmarks"| node_basic_hvg
node_exp02_speech -->|"benchmarks"| node_dc_hvg
node_exp02_speech -->|"benchmarks"| node_bst_visibility
node_exp02_speech -->|"writes results"| node_experiment_results
node_exp03 -->|"builds trees"| node_bst_visibility
node_exp03 -->|"writes results"| node_experiment_results
node_experiment_results -->|"plots synthetic data"| node_plot01
node_experiment_results -->|"plots benchmark data"| node_plot02
node_experiment_results -->|"plots merge data"| node_plot03
node_sample_data -->|"supplies series"| node_plot01
node_sample_data -->|"supplies samples"| node_plot02

click node_basic_nvg "https://github.com/delialia/bst/blob/master/visibility_algorithms.py"
click node_dc_nvg "https://github.com/delialia/bst/blob/master/visibility_algorithms.py"
click node_basic_hvg "https://github.com/delialia/bst/blob/master/visibility_algorithms.py"
click node_dc_hvg "https://github.com/delialia/bst/blob/master/visibility_algorithms.py"
click node_bst_visibility "https://github.com/delialia/bst/blob/master/node_class.py"
click node_bst_nodes "https://github.com/delialia/bst/blob/master/node_class.py"
click node_example "https://github.com/delialia/bst/blob/master/example.py"
click node_exp01 "https://github.com/delialia/bst/blob/master/run_exp01.py"
click node_exp02_finance "https://github.com/delialia/bst/blob/master/run_exp02_finance.py"
click node_exp02_speech "https://github.com/delialia/bst/blob/master/run_exp02_speech.py"
click node_exp03 "https://github.com/delialia/bst/blob/master/run_exp03.py"
click node_experiment_results "https://github.com/delialia/bst/tree/master/results"
click node_plot01 "https://github.com/delialia/bst/blob/master/plot_exp01_Figure04.py"
click node_plot02 "https://github.com/delialia/bst/blob/master/plot_exp02_Figure05.py"
click node_plot03 "https://github.com/delialia/bst/blob/master/plot_exp03_Figure06.py"
click node_sample_data "https://github.com/delialia/bst/tree/master/sample_data"

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_basic_nvg,node_dc_nvg,node_basic_hvg,node_dc_hvg,node_bst_visibility,node_bst_nodes,node_user toneBlue
class node_example,node_exp01,node_exp02_finance,node_exp02_speech,node_exp03 toneAmber
class node_experiment_results,node_plot01,node_plot02,node_plot03,node_sample_data toneMint
class node_series,node_finance_data,node_speech_data toneIndigo
```

## Components

### Graph algorithms

- [Basic NVG](https://github.com/delialia/bst/blob/master/visibility_algorithms.py): `visibility_algorithms.py`
- [Divide-conquer NVG](https://github.com/delialia/bst/blob/master/visibility_algorithms.py): `visibility_algorithms.py`
- [Basic HVG](https://github.com/delialia/bst/blob/master/visibility_algorithms.py): `visibility_algorithms.py`
- [Divide-conquer HVG](https://github.com/delialia/bst/blob/master/visibility_algorithms.py): `visibility_algorithms.py`
- [BST visibility](https://github.com/delialia/bst/blob/master/node_class.py): `node_class.py`
- [BST node operations](https://github.com/delialia/bst/blob/master/node_class.py): `node_class.py`

### Research experiments

- [Algorithm comparison example](https://github.com/delialia/bst/blob/master/example.py): `example.py`
- [Synthetic benchmarks](https://github.com/delialia/bst/blob/master/run_exp01.py): `run_exp01.py`
- [Finance benchmarks](https://github.com/delialia/bst/blob/master/run_exp02_finance.py): `run_exp02_finance.py`
- [Speech benchmarks](https://github.com/delialia/bst/blob/master/run_exp02_speech.py): `run_exp02_speech.py`
- [Online merge benchmark](https://github.com/delialia/bst/blob/master/run_exp03.py): `run_exp03.py`

### Results and plots

- [Experiment results](https://github.com/delialia/bst/tree/master/results): `results`
- [Synthetic result plots](https://github.com/delialia/bst/blob/master/plot_exp01_Figure04.py): `plot_exp01_Figure04.py`
- [Domain result plots](https://github.com/delialia/bst/blob/master/plot_exp02_Figure05.py): `plot_exp02_Figure05.py`
- [Merge result plot](https://github.com/delialia/bst/blob/master/plot_exp03_Figure06.py): `plot_exp03_Figure06.py`
- [Plot sample data](https://github.com/delialia/bst/tree/master/sample_data): `sample_data`

### Other components

- **Library user**
- **Time series**
- **Finance input data**
- **Speech input data**

## Connections

- Library user → Algorithm comparison example: runs example (evidence: `README.md`)
- Time series → Algorithm comparison example: provides input (evidence: `example.py`)
- Algorithm comparison example → Basic NVG: calls (evidence: `example.py`)
- Algorithm comparison example → Divide-conquer NVG: calls (evidence: `example.py`)
- Algorithm comparison example → Basic HVG: calls (evidence: `example.py`)
- Algorithm comparison example → Divide-conquer HVG: calls (evidence: `example.py`)
- Algorithm comparison example → BST visibility: calls (evidence: `example.py`)
- BST visibility → BST node operations: uses node methods (evidence: `node_class.py`)
- Synthetic benchmarks → Basic NVG: benchmarks (evidence: `run_exp01.py`)
- Synthetic benchmarks → Divide-conquer NVG: benchmarks (evidence: `run_exp01.py`)
- Synthetic benchmarks → Basic HVG: benchmarks (evidence: `run_exp01.py`)
- Synthetic benchmarks → Divide-conquer HVG: benchmarks (evidence: `run_exp01.py`)
- Synthetic benchmarks → BST visibility: benchmarks (evidence: `run_exp01.py`)
- Synthetic benchmarks → Experiment results: writes results (evidence: `run_exp01.py`)
- Finance benchmarks → Finance input data: reads (evidence: `run_exp02_finance.py`)
- Finance benchmarks → Basic NVG: benchmarks (evidence: `run_exp02_finance.py`)
- Finance benchmarks → Divide-conquer NVG: benchmarks (evidence: `run_exp02_finance.py`)
- Finance benchmarks → Basic HVG: benchmarks (evidence: `run_exp02_finance.py`)
- Finance benchmarks → Divide-conquer HVG: benchmarks (evidence: `run_exp02_finance.py`)
- Finance benchmarks → BST visibility: benchmarks (evidence: `run_exp02_finance.py`)
- Finance benchmarks → Experiment results: writes results (evidence: `run_exp02_finance.py`)
- Speech benchmarks → Speech input data: reads (evidence: `run_exp02_speech.py`)
- Speech benchmarks → Basic NVG: benchmarks (evidence: `run_exp02_speech.py`)
- Speech benchmarks → Divide-conquer NVG: benchmarks (evidence: `run_exp02_speech.py`)
- Speech benchmarks → Basic HVG: benchmarks (evidence: `run_exp02_speech.py`)
- Speech benchmarks → Divide-conquer HVG: benchmarks (evidence: `run_exp02_speech.py`)
- Speech benchmarks → BST visibility: benchmarks (evidence: `run_exp02_speech.py`)
- Speech benchmarks → Experiment results: writes results (evidence: `run_exp02_speech.py`)
- Online merge benchmark → BST visibility: builds trees (evidence: `run_exp03.py`)
- Online merge benchmark → Experiment results: writes results (evidence: `run_exp03.py`)
- Experiment results → Synthetic result plots: plots synthetic data (evidence: `plot_exp01_Figure04.py`)
- Experiment results → Domain result plots: plots benchmark data (evidence: `plot_exp02_Figure05.py`)
- Experiment results → Merge result plot: plots merge data (evidence: `plot_exp03_Figure06.py`)
- Plot sample data → Synthetic result plots: supplies series (evidence: `plot_exp01_Figure04.py`)
- Plot sample data → Domain result plots: supplies samples (evidence: `plot_exp02_Figure05.py`)
