A SteinerTree library implementing several huristic and exact steiner methods.
Project description
SteinerNet
The Steiner Tree Approach refers to a method used in graph theory and network design to find the most efficient way to connect a set of points (nodes), potentially using extra intermediate points (called Steiner points) to minimize the total connection cost.
This the python eqiuivalent to SteinerNet in R. Released 10 years later on date the R version was released.
Installation 
To install:
pip install steinernet
You can install the package locally using pip:
pip install .
Or, for development:
pip install -e .
Requirements
- Python 3.7+
- networkx
Usage
import networkx as nx
from steinernet import SteinerNet
# Create a sample graph
G = nx.cycle_graph(6)
terminals = [0, 2, 4]
# Initialize SteinerNet
sn = SteinerNet(G)
# Compute a Steiner tree using the random walk method
T = sn.steinertree(terminals,'ASP', repeats=1, optimize=True)
# Visualize the result
import matplotlib.pyplot as plt
nx.draw(T, with_labels=True)
plt.show()
Turorial
Check the Tutorial on tutorial file
Documentation
-
SteinerNet(graph)graph: networkx.Graph, the input undirected graph (optionally weighted)- Returns: SteinerNet object
-
SteinerNet.random_walk_tree(terminals, seed=None)terminals: list of node indices to connectseed: (optional) random seed for reproducibility- Returns: networkx.Graph, a random graph
-
SteinerNet.steinertree(terminals, method, repeats=1, optimize=True)
-
terminals: list of node indices to connectmethod: one of the methodsSP,RSP,SPM,ASP,EXA(see their info in the Reference paper below)-
- Returns: an approximate Steiner tree made by the selected method
Reference
Afshin Sadeghi and Holger Froehlich, "Steiner tree methods for optimal sub-network identification: an empirical study", BMC Bioinformatics 2013 14:144, doi:10.1186/1471-2105-14-144
License
This project is open source under the Apache 2.0 License. You basically can use it in any commercial or research project.
Citation
To use this package in your work, cite this article as:
@article{sadeghi2013steiner,
title={Steiner tree methods for optimal sub-network identification: an empirical study},
author={Sadeghi, Afshin and Fr{\"o}hlich, Holger},
journal={BMC bioinformatics},
volume={14},
pages={1--19},
year={2013},
publisher={Springer},
doi = {https://doi.org/10.1186/1471-2105-14-144}
}
Link to R steinerNet repository.
For bug reports contact me at 🔗 LinkedIn
Project details
Release history Release notifications | RSS feed
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 steinernet-0.1.6.tar.gz.
File metadata
- Download URL: steinernet-0.1.6.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76a07909d301bd33af08e5b59324f46f2b0cb12a0161508c33a5efe22d110e53
|
|
| MD5 |
31543815fb8767c2e6eadfb090406035
|
|
| BLAKE2b-256 |
d328cb29346850dcb0e36786a53bedf7f09e2f291a9fafa8f3c52a3a792d79bf
|
File details
Details for the file steinernet-0.1.6-py3-none-any.whl.
File metadata
- Download URL: steinernet-0.1.6-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd35bd1af16e6ca2411d07ed4658b2d6e3104cf59fe688e359c26e39940e68f5
|
|
| MD5 |
196c1e41c8bf0ebf2d6372a93f5581e5
|
|
| BLAKE2b-256 |
37165affdfd062b66cb26d77eeaf934a6785a62da868401daac8fdfa46e8cc42
|