https://github.com/pratikpakhale/kmb-cpu
Steiner Tree Problem (STP) KMB algorithm implementation in C++ and Python. Used OpenMP for faster calculation.
https://github.com/pratikpakhale/kmb-cpu
cpp openmp python steiner-tree-problem stp
Last synced: 9 days ago
JSON representation
Steiner Tree Problem (STP) KMB algorithm implementation in C++ and Python. Used OpenMP for faster calculation.
- Host: GitHub
- URL: https://github.com/pratikpakhale/kmb-cpu
- Owner: pratikpakhale
- Created: 2024-02-10T11:35:56.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-28T18:28:08.000Z (about 2 years ago)
- Last Synced: 2026-06-07T15:27:04.434Z (about 1 month ago)
- Topics: cpp, openmp, python, steiner-tree-problem, stp
- Language: C++
- Homepage:
- Size: 160 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KMB algorithm for Steiner Trees
## Run
### Python
```bash
cd python
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python main.py
```
### C++
```bash
cd cpp
cmake .
make
```
### To run KMB algorithm with `instance050` as input from `instances/` folder:
```bash
./cpp/build/kmb < instances/instance050.gr -o
```
### Flags
- `-o` to run in outer parallel mode
- `-i` to run in inner parallel mode
- `-b` to run in both parallel mode
- `-s` to run in sequential mode
### Run original research code
```bash
./cpp/build/og < instances/instance050.gr
```
## KMB Algorithm
```code
Input: G = (V, E, W), L ⊆ V
// S1
G1(L, E1= ∅);
// S2
for u ∈ L do
for v ∈ L do
Path(u,v) = shortest_path(u, v);
W1(u,v) = |Path(u,v)|;
G1.add_edge(u,v);
end for
end for
// S3
T1 = minimum_spanning_tree(G1);
// S4
G2 = ∅;
for (u,v) ∈ E1(T1) do
G2 = G2 ∪ Path(u,v);
end for
// S5
T2 = minimum_spanning_tree(G2);
Output: T2
```
### KMB Algorithm Visualization

### Steiner Tree

## Stats
[Processor Information](./processor_info.txt)
### Generate Results Data `results/`
Modify the `stats.sh` file as per requirements
```bash
cd cpp/
chmod +x ./stats.sh
./stats.sh
```
eg `./stats.sh kmb test.csv 1 10 -o`
This will create a `test.csv` file in `results/` which will contain results of instances from 1 to 10. The flag `-o` meaning the kmb algorithm will run in outer parallel mode
### Parallel Execution Performance

### Our vs Original | Accuracy

### Our vs Original | Time

## References
Pace Challenge 2018: [STP](https://pacechallenge.org/2018/)
ACM Research Paper : [Accelerating Computation of Steiner Trees on GPUs
](https://dl.acm.org/doi/abs/10.1007/s10766-021-00723-0)