A collection of Rust projects implementing efficient Single Source Shortest Path (SSSP) algorithms for graphs. This workspace includes a core library, WebAssembly bindings, and a web server with API.
1. sssp-lib - Core Library
The foundational Rust library providing SSSP algorithms using a bounded-memory shortest path approach. Suitable for large graphs with memory and computation constraints.
- Features: Efficient graph representation, Dijkstra-like algorithm with bounds, random graph generation for testing.
- Use Case: Backend processing, performance-critical applications.
- Installation:
cargo add sssp-lib - Documentation: sssp-lib README | crates.io | docs.rs
2. sssp-wasm - WebAssembly Bindings
JavaScript bindings for the SSSP library, compiled to WebAssembly. Enables running SSSP algorithms directly in the browser with near-native performance.
- Features: WASM compilation, JS API for graph operations and path calculation, interactive web demo.
- Use Case: Web applications, client-side graph processing, educational tools.
- Build:
wasm-pack build --target web - Documentation: sssp-wasm README
3. sssp-server - Web Server & API
A REST API server built with Axum, serving SSSP computations via HTTP endpoints. Includes static file serving for web interfaces.
- Features: RESTful API for path calculations, web-based graph visualization, CORS support.
- Use Case: Web services, API backends, demo applications.
- Run:
cargo run(from sssp-server directory) - API Endpoint:
POST /api/calculatefor path computation. - Documentation: sssp-server README
use sssp_lib::SSSPAlgorithm;
let mut algo = SSSPAlgorithm::new(5);
algo.graph.add_edge(0, 1, 1.0);
let distances = algo.run(0);
println!("{:?}", distances);cd sssp-server
cargo run
# Visit http://localhost:8000cd sssp-wasm
wasm-pack build --target web
# Use in web projects- sssp-lib: Pure Rust implementation with no external dependencies.
- sssp-wasm: Thin WASM wrapper around sssp-lib using
wasm-bindgen. - sssp-server: HTTP server using sssp-lib for computations, serves web UI.
Licensed under the Apache License, Version 2.0. See LICENSE for details.
