@mark1russell7/highways 0.5.0 → 0.5.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 +43 -2
- package/build/index.d.ts +1472 -63
- package/build/index.d.ts.map +1 -1
- package/build/index.js +10007 -3406
- package/build/index.js.map +1 -1
- package/package.json +11 -2
- package/src/bench/exact/index.ts +72 -11
- package/src/bench/exact/optima-exact-v1-bounds.json +14409 -0
- package/src/bench/exact/optima-exact-v1.json +4809 -0
- package/src/bench/exact/solve.ts +129 -0
- package/src/bench/screen/activation.ts +3 -0
- package/src/bench/screen/bounds.ts +140 -0
- package/src/bench/screen/compare.ts +26 -0
- package/src/bench/screen/exact-set.ts +100 -0
- package/src/bench/screen/exercise.ts +290 -0
- package/src/bench/screen/forms.ts +14 -0
- package/src/bench/screen/gap.ts +316 -0
- package/src/bench/screen/hash.ts +7 -76
- package/src/bench/screen/index.ts +6 -0
- package/src/bench/screen/measures.ts +71 -1
- package/src/bench/screen/portfolio-pick.ts +20 -0
- package/src/bench/screen/screen.ts +50 -2
- package/src/bench/screen/set.ts +3 -2
- package/src/highways/areas/index.ts +160 -0
- package/src/highways/confluent/index.ts +154 -0
- package/src/highways/confluent/k23.test-util.ts +8 -0
- package/src/highways/consensus/index.ts +129 -0
- package/src/highways/crossbars/index.ts +184 -0
- package/src/highways/cubu/index.ts +26 -0
- package/src/highways/divided/index.ts +111 -0
- package/src/highways/fdeb/index.ts +193 -0
- package/src/highways/frechet/index.ts +232 -0
- package/src/highways/hierarchy/index.ts +140 -0
- package/src/highways/index.ts +64 -0
- package/src/highways/kdeeb/index.ts +355 -0
- package/src/highways/link-communities/index.ts +189 -0
- package/src/highways/mesh/index.ts +209 -0
- package/src/highways/mlseb/index.ts +204 -0
- package/src/highways/p-hub/index.ts +248 -0
- package/src/highways/power/index.ts +117 -0
- package/src/highways/resistance/index.ts +159 -0
- package/src/highways/sbeb/index.ts +303 -0
- package/src/highways/scale-space/index.ts +135 -0
- package/src/highways/spectral/index.ts +391 -0
- package/src/highways/territories/index.ts +150 -0
- package/src/highways/trace.ts +153 -0
- package/src/index.ts +1 -0
- package/src/portfolio/bands.ts +33 -0
- package/src/portfolio/fit.ts +29 -0
- package/src/portfolio/index.ts +6 -0
- package/src/portfolio/key.ts +98 -0
- package/src/portfolio/members.ts +171 -0
- package/src/portfolio/router.ts +133 -0
- package/src/portfolio/sets.ts +28 -0
- package/src/strategies/builtins.ts +222 -1
- package/src/strategies/schemas.ts +280 -1
package/README.md
CHANGED
|
@@ -346,7 +346,7 @@ The steps of the pipeline that vary have strategies. Each step has one interface
|
|
|
346
346
|
|---|---|---|---|
|
|
347
347
|
| `group` | `Graph` | `Section`: the tree of groups of the router `sections` | `quadtree`, `keys`, `kd`, `cut` |
|
|
348
348
|
| `router` | `Graph` | `Result` | `straight`, `plugs`, `corners`, `corners-smooth`, `trunks`, `shared`, `shared-all`, `sections`, `sections-tree` |
|
|
349
|
-
| `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`, `mingle`, `spiral`, `flow-clusters`, `traclus`, `diffusion`, `nested`, `lanes`, `growth`, `edge-paths`, `soft-keys`, `hough`, `ridges`, `hdbscan`, `hub-arcs`, `corridors+breakeven`, `corridors+stretch`, `corridors+ambiguity`, `corridors+hysteresis`, `corridors+ids` |
|
|
349
|
+
| `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`, `mingle`, `spiral`, `flow-clusters`, `traclus`, `diffusion`, `nested`, `lanes`, `growth`, `edge-paths`, `soft-keys`, `hough`, `ridges`, `hdbscan`, `hub-arcs`, `divided`, `hierarchy`, `fdeb`, `mesh`, `kdeeb`, `cubu`, `mlseb`, `sbeb`, `areas`, `confluent`, `power`, `crossbars`, `frechet`, `spectral`, `resistance`, `link-communities`, `territories`, `consensus`, `p-hub`, `scale-space`, `corridors+breakeven`, `corridors+stretch`, `corridors+ambiguity`, `corridors+hysteresis`, `corridors+ids` |
|
|
350
350
|
| `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` |
|
|
351
351
|
| `room` | `RoomInput`: the boxes and the links of a board, and the tree of sections for `levels` | `Gap[]` | `routes`, `lines`, `levels` |
|
|
352
352
|
|
|
@@ -400,9 +400,29 @@ The step `highway` decides which edges share a way. It gives a plan, not routes.
|
|
|
400
400
|
| `ridges` | The density ridges of HWY-032. The ridges of the blurred density of the edges become highways. |
|
|
401
401
|
| `hdbscan` | The density clusters of HWY-028 (HDBSCAN). The clusters of edges that live over a long range of densities become highways. |
|
|
402
402
|
| `hub-arcs` | The hub arc location of HWY-042. A greedy pass with swaps chooses at most `q` arcs, and each edge rides its best arc. |
|
|
403
|
+
| `divided` | The divided edge bundling of HWY-011. Each highway of two-way traffic splits into two carriageways, one for each direction. |
|
|
404
|
+
| `hierarchy` | The hierarchical edge bundling of HWY-001. Each edge goes near the hubs of the sections between its two leaves. |
|
|
405
|
+
| `fdeb` | The force-directed edge bundling of HWY-002 with the box field of RULE-002. The bundled points snap back to legal ways. |
|
|
406
|
+
| `mesh` | The control mesh of HWY-004. The crossings of the edges with the mesh form clusters, and a cluster shares one point. |
|
|
407
|
+
| `kdeeb` | The density bundling of RULE-028 with HWY-006. The edges move up a density that is 0 in the boxes. |
|
|
408
|
+
| `cubu` | The fast density bundling of HWY-007. The steps of `kdeeb` with a separable blur or a Fourier transform. |
|
|
409
|
+
| `mlseb` | The moving least squares bundling of HWY-008. Each point moves to a local fit of the near edges, and snaps back to a legal way. |
|
|
410
|
+
| `sbeb` | The skeleton-based edge bundling of HWY-009. The edges of a group move toward the skeleton of their shape. |
|
|
411
|
+
| `areas` | The image-based edge bundles of HWY-010. Each group of edges is one area around the longest path of its skeleton. |
|
|
412
|
+
| `confluent` | The confluent drawings of HWY-013. Each biclique of a greedy search is one track with two junctions. |
|
|
413
|
+
| `power` | The power graphs of HWY-014. The edges between two modules of nodes are one power edge, and one highway. |
|
|
414
|
+
| `crossbars` | The bundled crossings of HWY-022. Two sets of edges that cross near one place cross as two bundles. |
|
|
415
|
+
| `frechet` | The subtrajectory clusters of HWY-027. The parts of the first routes near one reference part, by the discrete Fréchet distance, become highways. |
|
|
416
|
+
| `spectral` | The spectral clusters of HWY-029. The largest eigengap of the compatibility graph of the edges gives the number of clusters. |
|
|
417
|
+
| `resistance` | The spectral bundling of HWY-021. The effective resistance of each edge lowers the weight of a pair of two bridges. |
|
|
418
|
+
| `link-communities` | The link communities of HWY-030. The edges with a common node and similar neighbours form one community. |
|
|
419
|
+
| `territories` | The territories of HWY-033. The plugs and the bends form cells, and the strong flows between two cells become highways. |
|
|
420
|
+
| `consensus` | The consensus of HWY-035. The finders vote on the pairs of edges, and the pairs that most finders agree on stay. |
|
|
421
|
+
| `p-hub` | The p-hub median of HWY-041. The p-median of the plugs gives the hubs, and the links between two hubs become highways. |
|
|
422
|
+
| `scale-space` | The scale space of HWY-053. Only the clusters that live over a long range of scales get highways. |
|
|
403
423
|
|
|
404
424
|
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.
|
|
405
|
-
The strategies `meet`, `weiszfeld`, `stubs`, `zipper`, `level-links` and `
|
|
425
|
+
The strategies `meet`, `weiszfeld`, `stubs`, `zipper`, `level-links`, `lanes`, `divided` and `crossbars` change the plan of the option `from`: `shared-ways` (the default), `corridors` or `none`.
|
|
406
426
|
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.
|
|
407
427
|
|
|
408
428
|
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>`.
|
|
@@ -465,6 +485,27 @@ const shared = stableOrderStrategy(routerStrategies.shared);
|
|
|
465
485
|
const result = repairStrategy(shared).run(graph); // The router `shared+stable+repair`.
|
|
466
486
|
```
|
|
467
487
|
|
|
488
|
+
### The portfolio router
|
|
489
|
+
|
|
490
|
+
The router `portfolio` is opt-in. It is not in `STRATEGIES`, so the default outputs do not change. [`PORTFOLIO.md`](../../docs/research/PORTFOLIO.md#the-portfolio-router-portfolio-api) gives its tables.
|
|
491
|
+
|
|
492
|
+
- `routePortfolio(graph, options?)` runs the router `shared` first, then more members for the size band of the graph. It gives the output with the fewest guard breaks, then the most ink saved (B1).
|
|
493
|
+
- The options are `rule` (`collection` or `all`), `cap` (1.1, 1.25 or 1.5), `k` (3, 5 or 8), `budgetMs` and `maxMembers`.
|
|
494
|
+
- Without `k`, the members are the fit of the band. Each member has a node limit, so the default is deterministic. Above 40 nodes, the fit is `shared` alone.
|
|
495
|
+
- With `k`, the members are the first `k` names of the greedy set of the band.
|
|
496
|
+
- A member passes the guard when it has no more breaks of each hard rule than `shared`. It also has no edge with a stretch above the cap. Under the rule `collection`, it also has no shared segment with edges of two collections. The base `shared` always passes.
|
|
497
|
+
- `budgetMs` is an opt-in ceiling. A cut by the budget makes the output depend on the speed of the machine.
|
|
498
|
+
- `budgetMs` is a soft limit between members. The router examines it only before each member, so a slow member runs to its end. With `budgetMs: 50`, the median on large boards was 142 to 239 ms.
|
|
499
|
+
- The router picks with `selectBest` of `@mark1russell7/layout-contract`, the one run-time dependency of the core.
|
|
500
|
+
- The result has the output, the winner, the trace of the pick and the move count `move.pick`.
|
|
501
|
+
- `portfolioRouter(options?)` gives a `Router`, and `portfolioStrategy` is the router strategy. Add `portfolioStrategy` to a registry of your own to race it.
|
|
502
|
+
|
|
503
|
+
```ts
|
|
504
|
+
import { routePortfolio } from "@mark1russell7/highways";
|
|
505
|
+
|
|
506
|
+
const { result, winner } = routePortfolio(graph, { rule: "all", cap: 1.25, k: 5, budgetMs: 50 });
|
|
507
|
+
```
|
|
508
|
+
|
|
468
509
|
### Declarations of the options
|
|
469
510
|
|
|
470
511
|
Each strategy declares its options in `schema`. A declaration tells the type, the range, the step and the meaning of one option. Tools make controls and sweeps from these declarations, with no other data.
|