@mark1russell7/highways 0.4.1 → 0.4.2

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.
Files changed (36) hide show
  1. package/README.md +27 -1
  2. package/build/index.d.ts +642 -1
  3. package/build/index.d.ts.map +1 -1
  4. package/build/index.js +5189 -2609
  5. package/build/index.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/bench/measures/highways.ts +93 -0
  8. package/src/bench/measures/index.ts +1 -0
  9. package/src/bench/screen/measures.ts +5 -0
  10. package/src/bench/screen/screen.ts +14 -0
  11. package/src/highways/base.ts +126 -0
  12. package/src/highways/flow-field/index.ts +49 -0
  13. package/src/highways/gates/ambiguity/index.ts +110 -0
  14. package/src/highways/gates/breakeven/index.ts +62 -0
  15. package/src/highways/gates/hysteresis/index.ts +48 -0
  16. package/src/highways/gates/ids/index.ts +59 -0
  17. package/src/highways/gates/index.ts +6 -0
  18. package/src/highways/gates/model.ts +129 -0
  19. package/src/highways/gates/stretch/index.ts +39 -0
  20. package/src/highways/grouped.ts +123 -0
  21. package/src/highways/index.ts +15 -0
  22. package/src/highways/level-links/index.ts +114 -0
  23. package/src/highways/meet/index.ts +84 -0
  24. package/src/highways/model.ts +5 -0
  25. package/src/highways/od-cells/index.ts +50 -0
  26. package/src/highways/quickbundles/index.ts +117 -0
  27. package/src/highways/road-classes/index.ts +74 -0
  28. package/src/highways/router.ts +1 -1
  29. package/src/highways/select/index.ts +162 -0
  30. package/src/highways/stretches.ts +141 -0
  31. package/src/highways/stubs/index.ts +117 -0
  32. package/src/highways/weiszfeld/index.ts +105 -0
  33. package/src/highways/wspd/index.ts +130 -0
  34. package/src/highways/zipper/index.ts +168 -0
  35. package/src/strategies/builtins.ts +149 -7
  36. package/src/strategies/schemas.ts +120 -0
package/README.md CHANGED
@@ -344,7 +344,7 @@ The steps of the pipeline that vary have strategies. Each step has one interface
344
344
  |---|---|---|---|
345
345
  | `group` | `Graph` | `Section`: the tree of groups of the router `sections` | `quadtree`, `keys`, `kd`, `cut` |
346
346
  | `router` | `Graph` | `Result` | `straight`, `plugs`, `corners`, `corners-smooth`, `trunks`, `shared`, `shared-all`, `sections`, `sections-tree` |
347
- | `highway` | `HighwayInput`: the graph, and optionally the first routes of a router | `HighwayPlan`: the highways as data | `keys`, `shared-ways`, `corridors` |
347
+ | `highway` | `HighwayInput`: the graph, optionally the first routes of a router, and optionally the plan before an edit | `HighwayPlan`: the highways as data | `keys`, `shared-ways`, `corridors`, `meet`, `weiszfeld`, `stubs`, `zipper`, `level-links`, `quickbundles`, `road-classes`, `flow-field`, `wspd`, `od-cells`, `select`, `corridors+breakeven`, `corridors+stretch`, `corridors+ambiguity`, `corridors+hysteresis`, `corridors+ids` |
348
348
  | `curve` | `CurveInput`: the points, the normals of the plugs, the free space and the lane on its board | `CurveSegment[]` | `straight`, `rounded`, `spline`, `arc`, `smooth`, `clothoid`, `highway` |
349
349
  | `room` | `RoomInput`: the boxes and the links of a board, and the tree of sections for `levels` | `Gap[]` | `routes`, `lines`, `levels` |
350
350
 
@@ -373,10 +373,36 @@ The step `highway` decides which edges share a way. It gives a plan, not routes.
373
373
  | `keys` | The trunks and the runs of the router `trunks`. `planOfResult` reads them. The router does not change. |
374
374
  | `shared-ways` | The runs of the router `shared`. `planOfResult` reads them. The router does not change. |
375
375
  | `corridors` | The corridor signatures of HWY-031. The links of the first routes get a MinHash signature, and each cluster of ways gives a highway. |
376
+ | `meet` | The merge points and split points of HWY-050. Each member joins its spine where its first route meets the spine, and leaves where they part. |
377
+ | `weiszfeld` | The meeting points of HWY-043. Each highway gets the merge and split points with the least ink, with the weight `k^alpha` on the trunk. |
378
+ | `stubs` | The stubs of HWY-015. The ends on one side of a box that go in near directions share one plug and one short stub. |
379
+ | `zipper` | The axon zipper of NAT-022. Two near, nearly parallel legs zip into one line when the shared length pays for the jogs. |
380
+ | `level-links` | The level links of HWY-056. The edges between two items of a zoom level ride the link of the level. |
381
+ | `quickbundles` | The QuickBundles of HWY-026. One pass puts each edge in the nearest cluster of resampled lines. Each cluster gets highways. |
382
+ | `road-classes` | The road classes of HWY-034. The links that most ways use become main roads. A second pass routes the edges onto them. |
383
+ | `flow-field` | The flow field of EDA-046. The edges into one side of a box merge like streams on shortest ways to one root. |
384
+ | `wspd` | The well-separated pairs of HWY-018. The edges between the two sets of one pair share one highway. |
385
+ | `od-cells` | The origin and destination cells of EDA-033. The edges between two cells of a zoom level share one trunk. |
386
+ | `select` | The candidate selection of HWY-045. Some strategies propose highways, and a greedy pass with swaps keeps the best set. |
376
387
 
377
388
  The strategy `corridors` joins two ways when they share a long length. The length is `BREAK_EVEN` times the lane width or more, and the share `rho` of the shorter way or more.
389
+ The strategies `meet`, `weiszfeld`, `stubs`, `zipper` and `level-links` change the plan of the option `from`: `shared-ways` (the default), `corridors` or `none`.
378
390
  The routers `trunks` and `shared` keep their own code. A test pins their output, so the strategies `keys` and `shared-ways` read the same decision.
379
391
 
392
+ A gate keeps, drops or changes the highways of a plan. `gateStrategy(strategy, gate)` puts a gate after a highway strategy, with the name `<strategy>+<gate>`.
393
+ The new strategy has the options of both. The keys of the options of a gate are not keys of the strategy before it. Gates can follow gates.
394
+
395
+ | Gate | Rule |
396
+ |---|---|
397
+ | `breakeven` (HWY-047) | An edge stays on its highways only when its share of the shared ink is larger than its detour. The option `shareAlpha` sets the cost `n^shareAlpha` of a stretch for `n` edges. |
398
+ | `stretch` (HWY-048) | An edge stays only when its route is at most `budget` times its route alone, plus `pad`. |
399
+ | `ambiguity` (HWY-049) | Each highway keeps its largest group of edges whose end nodes have an ambiguity of `maxAmbiguity` or less. The ambiguity is the share of the pairs of end nodes without an edge. |
400
+ | `hysteresis` (HWY-046) | A new highway needs `kOn` edges. A highway of the plan before the edit stays while it has `kOff` edges. |
401
+ | `ids` (HWY-054) | Each highway takes the id of the highway of the plan before the edit with the most common edges. The routes do not change. |
402
+
403
+ The gates `hysteresis` and `ids` read `HighwayInput.previous`: the graph and the plan before an edit. Without it, `hysteresis` uses the limit `kOn` and `ids` changes nothing.
404
+ The functions `keepMembers`, `edgeLengths`, `matchHighways`, `jaccard` and `commonEdges` help a new gate.
405
+
380
406
  A registry is data. No import changes it. The benchmark and the site take their lists from `STRATEGIES`, so a new built-in strategy gets its rows and its button with no other edit. A consumer makes its own registry:
381
407
 
382
408
  ```ts