Skip to main content

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 PyPl Total Downloads

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 connect
    • seed: (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 connect

    • method: one of the methods SP, RSP, SPM, ASP, EXA (see their info in the Reference paper below)
      • Returns: an approximate Steiner tree made by the selected method

Readme file for parralel running of the exact algorithm exists in README_PARALLEL

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.
Link to Python SteinerNet repository.

For bug reports contact me at 🔗 LinkedIn

Metadata

Release files for steinernet 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for steinernet 0.2.0
File Size Uploaded
steinernet-0.2.0.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for steinernet 0.2.0
File Interpreter ABI Platform
steinernet-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.9 kB

Release files / steinernet-0.2.0.tar.gz

Download URL steinernet-0.2.0.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b08ba6dbc8fe8ddcbdc34eb6973e04ad8d73c455bbd46299f74c9a02a2b39589
BLAKE2b-256 checksum
How to use checksums
4182716090ac2d7d791718c072bd4b10523f3e74a7b50ddf155846646ef02c58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / steinernet-0.2.0-py3-none-any.whl

Download URL steinernet-0.2.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5175232bf7b2739101b5095f72a5bce3061a2ba355a1fd13d8584e8b34032ad0
BLAKE2b-256 checksum
How to use checksums
47843a7f8d30ac9cd90df14618b273fb88553f33e8cfe7774a1861a5df4297bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page