Fast single-source shortest paths for grid and pipeline networks using BMSSP algorithm
Project description
BMSSP: Fast Single-Source Shortest Paths
A Python package providing fast single-source shortest path (SSSP) computation using the BMSSP algorithm, with a high-performance Rust backend.
Status
Beta (v0.1.0) - This package is ready for use. The API is stable, but we welcome feedback and contributions.
Features
- Fast SSSP computation using BMSSP algorithm
- Optimized for large sparse graphs (hundreds of thousands to millions of edges)
- Support for dynamic weights and edge outages
- Clean Python API with NumPy integration
- Rust backend for maximum performance
- Support for both f32 and f64 precision
- Predecessor tracking for path reconstruction
Installation
Note: This package is not yet available on PyPI. For detailed installation instructions, see the Installation Guide.
Quick Installation
# Install Rust toolchain first
brew install rust # or use rustup
# Clone repository and install
cd bmssp-py/python
maturin develop
Quick Start
import numpy as np
from bmssp import Graph, sssp
# Create a graph from edges
n = 4
edges = np.array([[0, 1], [1, 2], [0, 2], [2, 3]], dtype=np.int64)
weights = np.array([1.0, 2.0, 1.5, 1.0], dtype=np.float32)
graph, _ = Graph.from_edges(n, edges, weights=weights)
# Compute shortest paths from vertex 0
result = sssp(graph, weights, source=0)
print(result.dist) # Distances from source to each vertex
# With path reconstruction
result = sssp(graph, weights, source=0, return_predecessors=True)
from bmssp import reconstruct_path
path = reconstruct_path(result.pred, target=3)
print(f"Path: {path}")
Performance Highlights
- Optimized for large sparse graphs: Handles hundreds of thousands to millions of edges efficiently
- Fast repeated computations: Ideal for scenario analysis with many SSSP calls
- Dynamic weight updates: Update weights without rebuilding graph topology
- Rust backend: High-performance implementation with minimal Python overhead
For detailed performance information, see the Performance Guide.
Example: Grid Network Optimization
See python/examples/grid_pipeline.py for a complete example demonstrating:
- Building grid networks
- Applying load flows and congestion models
- Handling outages
- Recomputing paths
Documentation
- Installation Guide - Detailed installation instructions
- Tutorial - Step-by-step guide with examples
- API Reference - Complete API documentation
- Performance Guide - Performance characteristics and optimization tips
- Algorithm Description - BMSSP algorithm overview
Development
For development setup, install the Rust toolchain and use maturin develop from the python/ directory.
Citation
If you use this implementation in your research, please cite the original paper:
Ran Duan, Jiayi Mao, Xiao Mao, Xinkai Shu, Longhui Yin. "Breaking the Sorting Barrier for Directed Single-Source Shortest Paths." arXiv preprint arXiv:2504.17033 (2025).
https://arxiv.org/abs/2504.17033
License
Licensed under the MIT License. See LICENSE for details.
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 Distributions
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 bmssp_rs-0.1.0.tar.gz.
File metadata
- Download URL: bmssp_rs-0.1.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62b7518c752af25649acbe1abb43ed8e591408ded0947f06e42fda959f71033d
|
|
| MD5 |
391deb7d8535d024612c44256a06045a
|
|
| BLAKE2b-256 |
4aa18ae18e70884200e14e45a0a1b0324f3d196b2791d99d3c14652e17534c1d
|
Provenance
The following attestation bundles were made for bmssp_rs-0.1.0.tar.gz:
Publisher:
release.yml on tripp-smith/bmssp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bmssp_rs-0.1.0.tar.gz -
Subject digest:
62b7518c752af25649acbe1abb43ed8e591408ded0947f06e42fda959f71033d - Sigstore transparency entry: 820769837
- Sigstore integration time:
-
Permalink:
tripp-smith/bmssp-py@b11201f22c1a157fadb8ef84db7d9cd2567186c1 -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/tripp-smith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b11201f22c1a157fadb8ef84db7d9cd2567186c1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bmssp_rs-0.1.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: bmssp_rs-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 162.9 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a0145199c14aac878597ef9134f5827442d4c145b970feceecb9d59abe2eb4e
|
|
| MD5 |
280304c48b81d71c3f08f2212fcc75af
|
|
| BLAKE2b-256 |
4facbb3b52dc0054501b45c531714b528dc54fc0b4402c2eff5eef0b7b7a671b
|
Provenance
The following attestation bundles were made for bmssp_rs-0.1.0-cp38-abi3-win_amd64.whl:
Publisher:
release.yml on tripp-smith/bmssp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bmssp_rs-0.1.0-cp38-abi3-win_amd64.whl -
Subject digest:
2a0145199c14aac878597ef9134f5827442d4c145b970feceecb9d59abe2eb4e - Sigstore transparency entry: 820750564
- Sigstore integration time:
-
Permalink:
tripp-smith/bmssp-py@a6453d12a3b9146697240aeb0b6533c461d2a2e2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/tripp-smith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a6453d12a3b9146697240aeb0b6533c461d2a2e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bmssp_rs-0.1.0-cp38-abi3-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: bmssp_rs-0.1.0-cp38-abi3-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 314.7 kB
- Tags: CPython 3.8+, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c0e13052e23a7143e0986ea82bd79683f7b584c50e0ef5ef359da75a38a848e
|
|
| MD5 |
52f12fb281fdc52bfeb520ae2d78a79c
|
|
| BLAKE2b-256 |
d12e8fcfa37bfc3dbe251ebe352e8f29d3ea65e30d2cc42c656996e25ca5311d
|
Provenance
The following attestation bundles were made for bmssp_rs-0.1.0-cp38-abi3-manylinux_2_34_x86_64.whl:
Publisher:
release.yml on tripp-smith/bmssp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bmssp_rs-0.1.0-cp38-abi3-manylinux_2_34_x86_64.whl -
Subject digest:
9c0e13052e23a7143e0986ea82bd79683f7b584c50e0ef5ef359da75a38a848e - Sigstore transparency entry: 820750575
- Sigstore integration time:
-
Permalink:
tripp-smith/bmssp-py@a6453d12a3b9146697240aeb0b6533c461d2a2e2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/tripp-smith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a6453d12a3b9146697240aeb0b6533c461d2a2e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bmssp_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: bmssp_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 266.0 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e190c682196ec528538d16b5837210762c990857f81f9e70f0539c748afffec5
|
|
| MD5 |
e98a3f17a668bec27d530a79de2fd87c
|
|
| BLAKE2b-256 |
45e572d2c344266ac91770330519d5a46739fce757d6b6b575a5b31891f17ee3
|
Provenance
The following attestation bundles were made for bmssp_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on tripp-smith/bmssp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bmssp_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
e190c682196ec528538d16b5837210762c990857f81f9e70f0539c748afffec5 - Sigstore transparency entry: 820750571
- Sigstore integration time:
-
Permalink:
tripp-smith/bmssp-py@a6453d12a3b9146697240aeb0b6533c461d2a2e2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/tripp-smith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a6453d12a3b9146697240aeb0b6533c461d2a2e2 -
Trigger Event:
push
-
Statement type: