Seeded shortest-path queries over two real road networks from the 9th DIMACS Implementation Challenge, answered by knotkit/graph’s dijkstra over injected storage layouts and measured against a hand-written Dijkstra that shares no algorithm code with it.
On the New York network, dijkstra from one source takes 79.0 ms on compressed-sparse-row against 27.1 ms hand-written (2.7–3.3× on search rows)
knotkit/graph : Provides breadth-first search, Dijkstra, topological order, and connected components over integer-vertex graphs, stored as adjacency lists, compressed sparse rows, or an adjacency matrix
knotkit/heap : Provides binary and k-ary min/max heaps plus indexed priority queues, ordered by caller-supplied comparators
{"v":1,"box":[250.3785,140.4708,926.0781,445.4349],"x":{"s":"linear","lim":[0,32250],"inv":false,"g":0,"t":"Vertices settled while filling the distance table","tk":[[0,"0"],[5000,"5,000"],[10000,"10,000"],[15000,"15,000"],[20000,"20,000"],[25000,"25,000"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":0,"tk":[[2,"Point-to-point, per pair"],[1,"Full search, per stop"],[0,"Multi-target, per stop"]]},"ti":"Settled vertex visits","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[5803,2],"p":[371.96,200.54],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[20118,1],"p":[671.89,292.95],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[2197,0],"p":[296.41,385.37],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#111111"}],"lg":[]}
0
5,000
10,000
15,000
20,000
25,000
Vertices settled while filling the distance table
Point-to-point, per pair
Full search, per stop
Multi-target, per stop
5,803
20,118
2,197
6 stops in Rome: multi-target search settles 9.2× fewer vertices than full search
Settled vertex visits
{"v":1,"box":[996.3003,140.4708,1672,445.4349],"x":{"s":"linear","lim":[0,38.7],"inv":false,"g":1,"t":"Dijkstra runs: 6 per stop, not 30 per pair","tk":[[0,"0"],[10,"10"],[20,"20"],[30,"30"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":1,"tk":[[2,""],[1,""],[0,""]]},"ti":"Searches","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[30,2],"p":[1520.1,200.54],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[6,1],"p":[1101.06,292.95],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[6,0],"p":[1101.06,385.37],"r":6.09},{"k":"annotation","c":"#1d5fa6"}],"lg":[]}
0
10
20
30
Dijkstra runs: 6 per stop, not 30 per pair
30
6
6
Searches
{"v":1,"box":[250.3785,209.9153,680,519.3827],"x":{"s":"linear","lim":[0,32250],"inv":false,"g":0,"t":"Vertices settled while filling the distance table","tk":[[0,"0"],[5000,"5,000"],[10000,"10,000"],[15000,"15,000"],[20000,"20,000"],[25000,"25,000"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":0,"tk":[[2,"Point-to-point, per pair"],[1,"Full search, per stop"],[0,"Multi-target, per stop"]]},"ti":"Settled vertex visits","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[5803,2],"p":[327.68,270.87],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[20118,1],"p":[518.38,364.65],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[2197,0],"p":[279.65,458.43],"r":6.09},{"k":"annotation","c":"#1d5fa6"},{"k":"annotation","c":"#111111"}],"lg":[]}
0
5,000
10,000
15,000
20,000
25,000
Vertices settled while filling the distance table
Point-to-point, per pair
Full search, per stop
Multi-target, per stop
5,803
20,118
2,197
6 stops in Rome: multi-target search
settles 9.2× fewer vertices than full
search
Settled vertex visits
{"v":1,"box":[250.3785,673.5674,680,983.0349],"x":{"s":"linear","lim":[0,38.7],"inv":false,"g":1,"t":"Dijkstra runs: 6 per stop, not 30 per pair","tk":[[0,"0"],[10,"10"],[20,"20"],[30,"30"]]},"y":{"s":"linear","lim":[-0.65,2.65],"inv":false,"g":1,"tk":[[2,"Point-to-point, per pair"],[1,"Full search, per stop"],[0,"Multi-target, per stop"]]},"ti":"Searches","a":[{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[30,2],"p":[583.42,734.52],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#5c5c57","s":"xy","d":[6,1],"p":[316.99,828.3],"r":6.09},{"k":"annotation","c":"#2b2b28"},{"k":"segments","c":"#8c8c84"},{"k":"scatter","c":"#1d5fa6","s":"xy","d":[6,0],"p":[316.99,922.08],"r":6.09},{"k":"annotation","c":"#1d5fa6"}],"lg":[]}
0
10
20
30
Dijkstra runs: 6 per stop, not 30 per pair
Point-to-point, per pair
Full search, per stop
Multi-target, per stop
30
6
6
Searches
{"v":1,"box":[62.2274,94.1597,1043,437.3555],"x":{"s":"linear","lim":[-1.1829,44.1829],"inv":false,"g":0,"t":"Road along the shortest path from vertex 1425 to 789","tk":[[1,"1"],[10,"10"],[20,"20"],[30,"30"],[42,"42"]]},"y":{"s":"linear","lim":[0,5.27516],"inv":false,"g":0,"tk":[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5.048,"5.05"]]},"ti":"24.7 km in 42 roads; the 5 longest, in blue, cover half of it","a":[{"k":"bar","c":"#5b6b7c","s":"x","d":[1,0.03,2,0.213,3,0.047,4,0.262,5,0.018,6,0.13,7,0.068,8,0.487,9,0.381,10,0.25,11,0.015,12,0.177,13,0.17,14,0.277,15,0.037,16,0.404,17,0.314,18,0.083,19,0.717,20,0.094,21,0.235,22,0.554,23,1.075,24,0.099,25,0.579,26,0.487,27,0.1,28,0.457,29,1.269,30,0.495,31,0.278,32,0.243,34,0.07,36,0.017,37,0.131,40,0.5,42,0.429],"p":[109.42,435.4,131.04,423.5,152.66,434.3,174.28,420.31,195.9,436.18,217.52,428.9,239.14,432.93,260.75,405.67,282.37,412.57,303.99,421.09,325.61,436.38,347.23,425.84,368.85,426.3,390.47,419.33,412.09,434.95,433.71,411.07,455.33,416.93,476.95,431.96,498.57,390.71,520.18,431.24,541.8,422.07,563.42,401.31,585.04,367.42,606.66,430.91,628.28,399.69,649.9,405.67,671.52,430.85,693.14,407.62,714.76,354.8,736.38,405.15,758,419.27,779.62,421.55,822.85,432.8,866.09,436.25,887.71,428.83,952.57,404.83,995.81,409.45]},{"k":"bar","c":"#1d5fa6","s":"x","d":[33,1.98,35,1.547,38,2.273,39,2.612,41,5.048],"p":[801.23,308.54,844.47,336.71,909.33,289.48,930.95,267.42,974.19,108.94]},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#fffff8"},{"k":"annotation","c":"#5c5c57"}],"lg":[]}
1
10
20
30
42
Road along the shortest path from vertex 1425 to 789
0
1
2
3
4
5.05
Road length (km)
24.7 km in 42 roads; the 5 longest, in blue, cover half of it
{"v":1,"box":[62.2274,122.3921,595,437.3555],"x":{"s":"linear","lim":[-1.1829,44.1829],"inv":false,"g":0,"t":"Road along the shortest path from vertex 1425 to 789","tk":[[1,"1"],[10,"10"],[20,"20"],[30,"30"],[42,"42"]]},"y":{"s":"linear","lim":[0,5.27516],"inv":false,"g":0,"tk":[[0,"0"],[1,"1"],[2,"2"],[3,"3"],[4,"4"],[5.048,"5.05"]]},"ti":"24.7 km in 42 roads; the 5 longest, in\nblue, cover half of it","a":[{"k":"bar","c":"#5b6b7c","s":"x","d":[1,0.03,2,0.213,3,0.047,4,0.262,5,0.018,6,0.13,7,0.068,8,0.487,9,0.381,10,0.25,11,0.015,12,0.177,13,0.17,14,0.277,15,0.037,16,0.404,17,0.314,18,0.083,19,0.717,20,0.094,21,0.235,22,0.554,23,1.075,24,0.099,25,0.579,26,0.487,27,0.1,28,0.457,29,1.269,30,0.495,31,0.278,32,0.243,34,0.07,36,0.017,37,0.131,40,0.5,42,0.429],"p":[87.86,435.56,99.61,424.64,111.35,434.55,123.1,421.71,134.84,436.28,146.58,429.59,158.33,433.3,170.07,408.28,181.81,414.61,193.56,422.43,205.3,436.46,217.05,426.79,228.79,427.21,240.53,420.82,252.28,435.15,264.02,413.23,275.77,418.61,287.51,432.4,299.25,394.55,311,431.74,322.74,423.32,334.49,404.28,346.23,373.17,357.97,431.44,369.72,402.79,381.46,408.28,393.21,431.38,404.95,410.07,416.69,361.59,428.44,407.8,440.18,420.76,451.92,422.85,475.41,433.18,498.9,436.34,510.64,429.53,545.88,407.5,569.36,411.74]},{"k":"bar","c":"#1d5fa6","s":"x","d":[33,1.98,35,1.547,38,2.273,39,2.612,41,5.048],"p":[463.67,319.14,487.16,344.99,522.39,301.64,534.13,281.4,557.62,135.96]},{"k":"segments","c":"#8c8c84"},{"k":"segments","c":"#fffff8"},{"k":"annotation","c":"#5c5c57"}],"lg":[]}
1
10
20
30
42
Road along the shortest path from vertex 1425 to 789
0
1
2
3
4
5.05
Road length (km)
24.7 km in 42 roads; the 5 longest, in
blue, cover half of it
Rome round trip 1425 → 1602 → 1811 → 1773 → 1674 → 1369 → 1425 covers 57 roads and 8276 m. All three strategies agree on every ordered leg. The multi-target search settles 2197 vertex visits, versus 5803 pairwise and 20118 full-source. Hover or focus a chart for exact values. Drawn by demo.ts at build time, from the fixtures the benchmark uses; it reproduces the README figure.
git clone https://github.com/jkomyno/knotkit.git && cd knotkit && bun install
bun run demo:problem:road-network
problems/road-network/README.md states the fixture, the seed, and the result table.