Uh oh!
There was an error while loading. Please reload this page.
feat: add BMSSP single-source shortest paths - #788
Open
tachsin wants to merge 1 commit into
Open
Conversation
Adds sssp / sssp_all following Duan et al. (arXiv:2504.17033), with the same successor-function API as Dijkstra. Distances match Dijkstra on finite reachable graphs. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the SSSP algorithm from Duan, Mao, Mao, Shu, Yin 2025 for #730.
The paper's BMSSP recursion (
FindPivots, base-case Dijkstra, bounded multi-source calls) is wired to the same successor-function model asdijkstra/dijkstra_all:sssp_all(start, successors) -> HashMap<N, (N, C)>sssp(start, successors, success) -> Option<(Vec<N>, C)>build_pathworks on thesssp_allmap.What this is not
BTreeMap, and the reachable implicit graph is materialized first.ssspcomputes all distances, then picks a cheapest successful node. Usedijkstrawhen the successor graph is unbounded or you only need one target.A linear repair pass at the end fixes nodes left stale when many paths share a length. The paper assumes unique path lengths; unit-cost grids do not.
Test plan
cargo test --test ssspdijkstra_allon the small tree, random graphs, and a gridsssppath to a goal matchesdijkstraon a finite graphCloses#730
Made with Cursor