bmssp 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,11 +32,15 @@ with every building block shipped, tested, and released individually:
|
|
|
32
32
|
| `BMSSP(l, B, S)` — Algorithm 3, the main recursion ([#43](https://github.com/Sirivasv/bmssp-js/issues/43)) | `src/bmssp.mjs` | ✅ done — **1.0.0** |
|
|
33
33
|
|
|
34
34
|
> **Honest note:** the paper's win is asymptotic, and this repo optimizes for correctness
|
|
35
|
-
> and readability, not raw speed.
|
|
36
|
-
>
|
|
37
|
-
> Dijkstra
|
|
38
|
-
>
|
|
39
|
-
>
|
|
35
|
+
> and readability, not raw speed. Measured head-to-head (algorithm time only, graph
|
|
36
|
+
> loading excluded — see [benchmarks/HEAD-TO-HEAD.md](benchmarks/HEAD-TO-HEAD.md)):
|
|
37
|
+
> Dijkstra still wins on wall-clock at every practical size, though the gap narrows as
|
|
38
|
+
> sparse graphs grow (2.5× at 50k nodes → 1.57× at 2M). But in the paper's own metric —
|
|
39
|
+
> **comparisons between path lengths** — BMSSP does **fewer comparisons than Dijkstra
|
|
40
|
+
> from about n = 1M on sparse graphs** (0.91× at n = 2M), and the advantage grows with
|
|
41
|
+
> size: the "sorting barrier" is measurably broken; what remains is JS constant factors.
|
|
42
|
+
> Where inputs violate the paper's distinct-path-lengths assumption (e.g. zero-weight
|
|
43
|
+
> edges), documented tie guards keep the results correct
|
|
40
44
|
> ([#163](https://github.com/Sirivasv/bmssp-js/issues/163) tracks a principled tie-break).
|
|
41
45
|
|
|
42
46
|
## How it works (in two ideas)
|
|
@@ -49,7 +53,9 @@ with every building block shipped, tested, and released individually:
|
|
|
49
53
|
ordered *between* blocks but unsorted *within* them — enough to repeatedly pull the next
|
|
50
54
|
closest batch without paying the Θ(log n)-per-vertex "sorting barrier."
|
|
51
55
|
|
|
52
|
-
The
|
|
56
|
+
The wall-clock crossover point is astronomically large, but the asymptotics are real: in
|
|
57
|
+
measured comparison counts this implementation already beats Dijkstra past ~1M nodes on
|
|
58
|
+
sparse graphs ([benchmarks/HEAD-TO-HEAD.md](benchmarks/HEAD-TO-HEAD.md)). This repo
|
|
53
59
|
optimizes for a **correct, readable, well-tested** implementation, validated line-by-line
|
|
54
60
|
against a Dijkstra oracle — not for raw speed.
|
|
55
61
|
|
|
@@ -106,8 +112,19 @@ npm run lint # Prettier + ESLint
|
|
|
106
112
|
npm run bench # seeded micro-benchmarks (see benchmarks/README.md)
|
|
107
113
|
```
|
|
108
114
|
|
|
115
|
+
The measured BMSSP-vs-Dijkstra head-to-head — wall-clock and comparison counts, with
|
|
116
|
+
methodology — lives in [benchmarks/HEAD-TO-HEAD.md](benchmarks/HEAD-TO-HEAD.md)
|
|
117
|
+
([#170](https://github.com/Sirivasv/bmssp-js/issues/170) tracks harness integration).
|
|
118
|
+
|
|
109
119
|
The test suite's core contract: for every node, BMSSP's distances must equal the Dijkstra
|
|
110
|
-
oracle's — including on `test/roadNet-CA.txt`, a real road network from SNAP.
|
|
120
|
+
oracle's — including on `test/roadNet-CA.txt`, a real road network from SNAP. A seeded
|
|
121
|
+
property/fuzz suite (`test/fuzz.test.mjs`) hammers that contract across eight graph shapes
|
|
122
|
+
(sparse/dense random, grids, chains, stars, DAGs, disconnected forests, multigraphs),
|
|
123
|
+
extreme weight regimes (all-zero, mixed zero/huge, exact floats), and direct multi-source
|
|
124
|
+
bounded calls checked against per-source oracles. It runs in `npm test` by default; crank
|
|
125
|
+
the volume with the `FUZZ_ROUNDS` multiplier (e.g. `FUZZ_ROUNDS=25 npm test -- test/fuzz.test.mjs`
|
|
126
|
+
checks several thousand graphs in a few seconds). Failures always report the seed that
|
|
127
|
+
produced them.
|
|
111
128
|
|
|
112
129
|
## Roadmap
|
|
113
130
|
|