# Road network routing

> 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.

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.

## Result

> 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)

## Modules

* [`knotkit/graph`](/modules/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`](/modules/heap/): Provides binary and k-ary min/max heaps plus indexed priority queues, ordered by caller-supplied comparators

## Figures

* 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`](https://github.com/jkomyno/knotkit/blob/main/problems/road-network/demo.ts) at build time, from the fixtures the benchmark uses; it reproduces the README figure.

## Reproduce

```bash
git clone https://github.com/jkomyno/knotkit.git && cd knotkit && bun install
bun run demo:problem:road-network
```

[`problems/road-network/README.md`](https://github.com/jkomyno/knotkit/blob/main/problems/road-network/README.md) states the fixture, the seed, and the result table.
