Package to solve Steiner Tree and Steiner Forest Problems with the HiGHS solver
Project description
SteinerPy
A Python package for solving Steiner Tree and Steiner Forest Problems using the HiGHS solver and NetworkX graphs.
Installation
Install SteinerPy from PyPI:
pip install steinerpy
Or using uv:
uv add steinerpy
Requirements
- Python 3.8+
- NetworkX
- HiGHS Solver (via highspy)
Quick Start
import networkx as nx
from steinerpy import SteinerProblem
# Create a graph
G = nx.Graph()
G.add_edge('A', 'B', weight=1)
G.add_edge('B', 'C', weight=2)
G.add_edge('C', 'D', weight=1)
# Define terminal groups
terminal_groups = [['A', 'D']]
# Solve the Steiner problem
problem = SteinerProblem(G, terminal_groups)
solution = problem.get_solution()
print(f"Optimal cost: {solution.objective}")
print(f"Selected edges: {solution.selected_edges}")
Usage Examples
See the example.ipynb notebook for detailed usage examples.
Dependencies
networkx: For graph representation and manipulationhighspy: For optimization solving
If you use this package in your research, please cite:
@article{markhorst2025future,
title={Future-proof ship pipe routing: Navigating the energy transition},
author={Markhorst, Berend and Berkhout, Joost and Zocca, Alessandro and Pruyn, Jeroen and van der Mei, Rob},
journal={Ocean Engineering},
volume={319},
pages={120113},
year={2025},
publisher={Elsevier}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file steinerpy-0.1.3.tar.gz.
File metadata
- Download URL: steinerpy-0.1.3.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50c38b3e1df1a22e4dde10b42d0912e762f25ea16fa7a30645b7396cd7ed97db
|
|
| MD5 |
9fe912126e53479e11edbd057bfa9441
|
|
| BLAKE2b-256 |
c9d50ab5f21461fd117a4c9f6e389303514abb34e3c5509d1a9f838309fac182
|
File details
Details for the file steinerpy-0.1.3-py3-none-any.whl.
File metadata
- Download URL: steinerpy-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77c79efdf79181a46705fcb046511873f54fa5c4cf013cb715f51124516b7a4e
|
|
| MD5 |
4e2c1041ce54cba8e9e38d52a54f2932
|
|
| BLAKE2b-256 |
a7f1b67a78b3348fe8a37ba665d9bad8698e724d1b942c7dc67c908c964dbf44
|