# kios-research/leakdb architecture

> Architecture diagram of the GitHub repository kios-research/leakdb, 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/kios-research/leakdb
- Repository: https://github.com/kios-research/leakdb

## Overview

LeakDB is a water-distribution leakage benchmark: users can run MATLAB detection algorithms on Hanoi scenarios and evaluate their outputs, while Python generators create additional scenarios with synthetic demands, leaks, and simulation measurements. The graph keeps generation separate from the documented MATLAB example workflow. The README establishes the UI workflow, but `main.m` and the detection/scoring implementations were not sampled, so their detailed call wiring is uncertain.

Main entry points: [`CCWI-WDSA2018/Dataset_Generator/leakDataset.py`](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator/leakDataset.py) (Python scenario generator), [`CCWI-WDSA2018/Dataset_Generator_Py3/leakDataset.py`](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator_Py3/leakDataset.py) (Python 3 generator), [`CCWI-WDSA2018/main.m`](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/main.m) (MATLAB interface), [`CCWI-WDSA2018/Detection Algorithms/MNF/algorithmMNF.m`](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/MNF/algorithmMNF.m) (MNF detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["MATLAB Evaluation"]
  node_main["MATLAB interface<br/>[main.m]"]
  node_scoring["Scoring function"]
  node_score["Evaluation result"]
end

subgraph group_generation["Scenario Generation"]
  node_pygen["Python scenario generator<br/>[leakDataset.py]"]
  node_py3gen["Python 3 generator<br/>[leakDataset.py]"]
  node_demand["Demand patterns<br/>[demandGenerator.py]"]
  node_simulator["WNTR simulator"]
end

subgraph group_detection["Leak Detection"]
  node_mnf["MNF detector<br/>[algorithmMNF.m]"]
  node_mnflabels["MNF labels<br/>[createLabelsMNF.m]"]
  node_mnfpaths["MNF scenario paths<br/>[getPathsZip.m]"]
  node_nulldetect["NULL labels<br/>[createLabelsNULL.m]"]
  node_randdetect["RAND labels<br/>[createLabelsRAND.m]"]
end

subgraph group_benchmark["Benchmark Data"]
  node_network["Network inputs"]
  node_scenarios["Scenario measurements"]
  node_truth["Scenario labels"]
end

node_user(("Benchmark user"))

node_user -->|"runs"| node_main
node_main -->|"selects detector"| node_mnf
node_main -->|"selects detector"| node_nulldetect
node_main -->|"selects detector"| node_randdetect
node_main -->|"evaluates results"| node_scoring
node_scoring -->|"reads labels"| node_truth
node_scoring -->|"produces score"| node_score
node_mnf -->|"creates labels"| node_mnflabels
node_mnf -->|"gets paths"| node_mnfpaths
node_mnf -->|"reads scenarios"| node_scenarios
node_pygen -->|"loads network"| node_network
node_py3gen -->|"loads network"| node_network
node_pygen -->|"generates demands"| node_demand
node_py3gen -->|"generates demands"| node_demand
node_pygen -->|"runs simulation"| node_simulator
node_py3gen -->|"runs simulation"| node_simulator
node_pygen -->|"writes measurements"| node_scenarios
node_pygen -->|"writes labels"| node_truth
node_py3gen -->|"writes measurements"| node_scenarios
node_py3gen -->|"writes labels"| node_truth

click node_main "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/main.m"
click node_scoring "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Scoring%20Function/scoring_algorithm.m"
click node_mnf "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/MNF/algorithmMNF.m"
click node_mnflabels "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/MNF/createLabelsMNF.m"
click node_mnfpaths "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/MNF/getPathsZip.m"
click node_nulldetect "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/NULL/createLabelsNULL.m"
click node_randdetect "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/RAND/createLabelsRAND.m"
click node_pygen "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator/leakDataset.py"
click node_py3gen "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator_Py3/leakDataset.py"
click node_demand "https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator_Py3/demandGenerator.py"
click node_network "https://github.com/kios-research/leakdb/tree/master/CCWI-WDSA2018/Dataset_Generator_Py3/networks"
click node_scenarios "https://github.com/kios-research/leakdb/tree/master/CCWI-WDSA2018/Benchmarks"
click node_truth "https://github.com/kios-research/leakdb/tree/master/CCWI-WDSA2018/Detection%20Algorithm%20Results"

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_main,node_scoring,node_score,node_user toneBlue
class node_pygen,node_py3gen,node_demand,node_simulator toneAmber
class node_mnf,node_mnflabels,node_mnfpaths,node_nulldetect,node_randdetect toneMint
class node_network,node_scenarios,node_truth toneRose
```

## Components

### MATLAB Evaluation

- [MATLAB interface](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/main.m): `CCWI-WDSA2018/main.m`
- [Scoring function](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Scoring%20Function/scoring_algorithm.m): `CCWI-WDSA2018/Scoring Function/scoring_algorithm.m`
- **Evaluation result**

### Scenario Generation

- [Python scenario generator](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator/leakDataset.py): `CCWI-WDSA2018/Dataset_Generator/leakDataset.py`
- [Python 3 generator](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator_Py3/leakDataset.py): `CCWI-WDSA2018/Dataset_Generator_Py3/leakDataset.py`
- [Demand patterns](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Dataset_Generator_Py3/demandGenerator.py): `CCWI-WDSA2018/Dataset_Generator_Py3/demandGenerator.py`
- **WNTR simulator**

### Leak Detection

- [MNF detector](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/MNF/algorithmMNF.m): `CCWI-WDSA2018/Detection Algorithms/MNF/algorithmMNF.m`
- [MNF labels](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/MNF/createLabelsMNF.m): `CCWI-WDSA2018/Detection Algorithms/MNF/createLabelsMNF.m`
- [MNF scenario paths](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/MNF/getPathsZip.m): `CCWI-WDSA2018/Detection Algorithms/MNF/getPathsZip.m`
- [NULL labels](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/NULL/createLabelsNULL.m): `CCWI-WDSA2018/Detection Algorithms/NULL/createLabelsNULL.m`
- [RAND labels](https://github.com/kios-research/leakdb/blob/master/CCWI-WDSA2018/Detection%20Algorithms/RAND/createLabelsRAND.m): `CCWI-WDSA2018/Detection Algorithms/RAND/createLabelsRAND.m`

### Benchmark Data

- [Network inputs](https://github.com/kios-research/leakdb/tree/master/CCWI-WDSA2018/Dataset_Generator_Py3/networks): `CCWI-WDSA2018/Dataset_Generator_Py3/networks`
- [Scenario measurements](https://github.com/kios-research/leakdb/tree/master/CCWI-WDSA2018/Benchmarks): `CCWI-WDSA2018/Benchmarks`
- [Scenario labels](https://github.com/kios-research/leakdb/tree/master/CCWI-WDSA2018/Detection%20Algorithm%20Results): `CCWI-WDSA2018/Detection Algorithm Results`

### Other components

- **Benchmark user**

## Connections

- Benchmark user → MATLAB interface: runs
- MATLAB interface → MNF detector: selects detector
- MATLAB interface → NULL labels: selects detector
- MATLAB interface → RAND labels: selects detector
- MATLAB interface → Scoring function: evaluates results
- Scoring function → Scenario labels: reads labels
- Scoring function → Evaluation result: produces score
- MNF detector → MNF labels: creates labels
- MNF detector → MNF scenario paths: gets paths
- MNF detector → Scenario measurements: reads scenarios
- Python scenario generator → Network inputs: loads network
- Python 3 generator → Network inputs: loads network
- Python scenario generator → Demand patterns: generates demands
- Python 3 generator → Demand patterns: generates demands
- Python scenario generator → WNTR simulator: runs simulation
- Python 3 generator → WNTR simulator: runs simulation
- Python scenario generator → Scenario measurements: writes measurements
- Python scenario generator → Scenario labels: writes labels
- Python 3 generator → Scenario measurements: writes measurements
- Python 3 generator → Scenario labels: writes labels
