@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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// This file is generated by `scripts/portfolio-sets.ts` (`pnpm portfolio:sets`). Do not edit it. The test `sets.test.ts` checks that it is current.
|
|
2
|
+
// The records come from the CI runs 40631516113, 40644555345, 40644557536, 40644560237, 40644562652, 40644565132, 40644567956, 40644570455, 40644572910, 40644575649, 40644578541, 40644580965, 40644583603.
|
|
3
|
+
import type { PortfolioCap, PortfolioRule } from "./bands.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The greedy set of each rule, cap and size band, by the key `<rule>|<cap>|<band>`. The set of k strategies is the first k names.
|
|
7
|
+
* Each set comes from the train seeds (0 to 4) of its band. The base `shared` is not in a set: the portfolio always runs it first.
|
|
8
|
+
*/
|
|
9
|
+
export const PORTFOLIO_SETS: Readonly<Record<`${PortfolioRule}|${PortfolioCap}|${string}`, readonly string[]>> = {
|
|
10
|
+
"collection|1.1|n1-12": ["corners-side", "w2c:select+stretch", "trunks-gilbert-a05", "w3a:spiral-a15", "trunks-tree-bf08", "hw:zipper", "w2c:level-links+stretch-b1.1", "hw:stubs"],
|
|
11
|
+
"collection|1.1|n13-24": ["w3e:crossbars+stretch", "corners-side", "shared-p2", "w2c:zipper+stretch-b1.1", "trunks-tree-bf08", "hw:weiszfeld", "trunks-gilbert-a07", "hw:stubs"],
|
|
12
|
+
"collection|1.1|n25-40": ["w2a:shared-ways+breakeven", "w2b:weiszfeld-a1", "w2c:level-links+stretch-b1.1"],
|
|
13
|
+
"collection|1.25|n1-12": ["corners-side", "trunks-tree-bf06", "w3f:p-hub-a0.2", "hw:stubs", "hw:p-hub", "hw:spiral", "w2c:level-links+stretch", "w3f:spectral-c0.3"],
|
|
14
|
+
"collection|1.25|n13-24": ["w2a:shared-ways+stretch", "shared-p3", "trunks-gilbert-a07", "w3e:crossbars+stretch", "trunks-tree-bf06", "w3c:hdbscan+stretch", "shared-wind-p2-r1-e2", "hw:stubs"],
|
|
15
|
+
"collection|1.25|n25-40": ["w2a:shared-ways+stretch", "shared-p3", "shared-order-shortest", "w2b:weiszfeld-a1", "w3e:crossbars+stretch", "trunks-tree-bf08", "w2a:shared-ways+ambiguity", "w2b:weiszfeld-a0"],
|
|
16
|
+
"collection|1.5|n1-12": ["trunks-gilbert-a03", "w3e:areas-keys", "trunks-tree-bf02", "w3f:p-hub-a0.2", "w2b:zipper-a1", "w3a:spiral-a35", "w3f:spectral-c0.3", "w2c:level-links+stretch"],
|
|
17
|
+
"collection|1.5|n13-24": ["shared-wind-p2-r0.5", "trunks-gilbert-a03", "w3e:crossbars+stretch", "shared-wind-p2-r1-e2", "trunks-tree-bf06", "shared-flow-a06-p3", "shared-wind-p3-r1", "trunks-gilbert-a07"],
|
|
18
|
+
"collection|1.5|n25-40": ["shared-p3", "hw:lanes", "shared-wind-p2-r1-e2", "hw:crossbars", "shared-flow-a06-p3", "trunks-tree-bf06", "shared-wind-p2-r1", "shared-wind-p2-r2"],
|
|
19
|
+
"all|1.1|n1-12": ["w2b:zipper-p2", "hw:cubu", "w3d:kdeeb+stretch", "w3c:hough-wide", "w3d:kdeeb-routes", "hw:stubs", "hw:spiral", "w3b:growth-s0.7"],
|
|
20
|
+
"all|1.1|n13-24": ["w3e:frechet-e0.5", "w3a:diffusion-wide", "w2c:zipper+stretch-b1.1", "w3d:cubu+stretch", "w3a:spiral-a15", "w3d:kdeeb-routes", "hw:diffusion", "hw:mesh"],
|
|
21
|
+
"all|1.1|n25-40": ["w2c:zipper+stretch-b1.1", "w3a:spiral-a15", "w3d:mesh+stretch", "w3a:diffusion+stretch", "w3a:diffusion-wide", "w2c:road-classes-d0.3", "w3d:kdeeb-routes"],
|
|
22
|
+
"all|1.25|n1-12": ["w3d:kdeeb-routes", "w3e:mlseb+stretch", "hw:growth", "hw:level-links", "w3b:growth-input", "w3e:confluent+stretch", "w3d:kdeeb-nomask", "w3a:diffusion-g2"],
|
|
23
|
+
"all|1.25|n13-24": ["w3d:kdeeb-routes", "w3e:mlseb+stretch", "w3f:p-hub-a0.2", "w3a:spiral-n3", "w3a:diffusion-l3", "trunks-tree-bf06", "hw:cubu", "w3a:spiral-a35"],
|
|
24
|
+
"all|1.25|n25-40": ["w3d:kdeeb-routes", "hw:spiral", "hw:shared-ways-all", "w3a:diffusion-g2", "w3e:frechet+stretch", "hw:cubu"],
|
|
25
|
+
"all|1.5|n1-12": ["w3b:growth-s0.3", "w3e:mlseb-a0", "w3e:mlseb-routes", "w3c:edge-paths-k1.5", "w3f:territories-r2", "hw:mlseb", "hw:growth", "w3e:mlseb-parabola"],
|
|
26
|
+
"all|1.5|n13-24": ["hw:growth", "w3b:growth-input", "hw:mlseb", "w3e:mlseb+stretch", "w3b:growth-s0.3"],
|
|
27
|
+
"all|1.5|n25-40": ["hw:growth", "w3b:growth-s0.7", "w3b:growth-s0.3", "w3b:growth-t1.2", "w3b:growth-input"],
|
|
28
|
+
};
|
|
@@ -24,6 +24,26 @@ import { EDGE_PATH_DEFAULTS, edgePathPlan, type EdgePathOptions } from "../highw
|
|
|
24
24
|
import { HDBSCAN_DEFAULTS, hdbscanPlan, type HdbscanOptions } from "../highways/hdbscan/index.ts";
|
|
25
25
|
import { HOUGH_DEFAULTS, houghPlan, type HoughOptions } from "../highways/hough/index.ts";
|
|
26
26
|
import { HUB_ARC_DEFAULTS, hubArcPlan, type HubArcOptions } from "../highways/hub-arcs/index.ts";
|
|
27
|
+
import { DIVIDED_DEFAULTS, dividedPlan, type DividedOptions } from "../highways/divided/index.ts";
|
|
28
|
+
import { HIERARCHY_DEFAULTS, hierarchyPlan, type HierarchyOptions } from "../highways/hierarchy/index.ts";
|
|
29
|
+
import { FDEB_DEFAULTS, fdebPlan, type FdebOptions } from "../highways/fdeb/index.ts";
|
|
30
|
+
import { MESH_DEFAULTS, meshPlan, type MeshOptions } from "../highways/mesh/index.ts";
|
|
31
|
+
import { KDEEB_DEFAULTS, kdeebPlan, type KdeebOptions } from "../highways/kdeeb/index.ts";
|
|
32
|
+
import { CUBU_DEFAULTS, cubuPlan, type CubuOptions } from "../highways/cubu/index.ts";
|
|
33
|
+
import { MLSEB_DEFAULTS, mlsebPlan, type MlsebOptions } from "../highways/mlseb/index.ts";
|
|
34
|
+
import { SBEB_DEFAULTS, sbebPlan, type SbebOptions } from "../highways/sbeb/index.ts";
|
|
35
|
+
import { AREA_DEFAULTS, areaPlan, type AreaOptions } from "../highways/areas/index.ts";
|
|
36
|
+
import { CONFLUENT_DEFAULTS, confluentPlan, type ConfluentOptions } from "../highways/confluent/index.ts";
|
|
37
|
+
import { POWER_DEFAULTS, powerPlan, type PowerOptions } from "../highways/power/index.ts";
|
|
38
|
+
import { CROSSBAR_DEFAULTS, crossbarPlan, type CrossbarOptions } from "../highways/crossbars/index.ts";
|
|
39
|
+
import { FRECHET_DEFAULTS, frechetPlan, type FrechetOptions } from "../highways/frechet/index.ts";
|
|
40
|
+
import { SPECTRAL_DEFAULTS, spectralPlan, type SpectralOptions } from "../highways/spectral/index.ts";
|
|
41
|
+
import { RESISTANCE_DEFAULTS, resistancePlan, type ResistanceOptions } from "../highways/resistance/index.ts";
|
|
42
|
+
import { LINK_COMMUNITY_DEFAULTS, linkCommunityPlan, type LinkCommunityOptions } from "../highways/link-communities/index.ts";
|
|
43
|
+
import { TERRITORY_DEFAULTS, territoryPlan, type TerritoryOptions } from "../highways/territories/index.ts";
|
|
44
|
+
import { CONSENSUS_DEFAULTS, consensusPlan, type ConsensusOptions } from "../highways/consensus/index.ts";
|
|
45
|
+
import { P_HUB_DEFAULTS, pHubPlan, type PHubOptions } from "../highways/p-hub/index.ts";
|
|
46
|
+
import { SCALE_SPACE_DEFAULTS, scaleSpacePlan, type ScaleSpaceOptions } from "../highways/scale-space/index.ts";
|
|
27
47
|
import { RIDGE_DEFAULTS, ridgePlan, type RidgeOptions } from "../highways/ridges/index.ts";
|
|
28
48
|
import { SOFT_KEY_DEFAULTS, softKeyPlan, type SoftKeyOptions } from "../highways/soft-keys/index.ts";
|
|
29
49
|
import { FLOW_FIELD_DEFAULTS, flowFieldPlan, type FlowFieldOptions } from "../highways/flow-field/index.ts";
|
|
@@ -58,7 +78,8 @@ import { byCollection, trunksRouter, type TrunksOptions } from "../routers/trunk
|
|
|
58
78
|
import { buildSections, SECTION_DEFAULTS, type SectionOptions } from "../sections.ts";
|
|
59
79
|
import { createRegistry, defineStrategy, type AnyStrategy, type CurveInput, type LaneBoard, type Registry, type Strategy } from "./model.ts";
|
|
60
80
|
import type { OptionSchema } from "./options.ts";
|
|
61
|
-
import {
|
|
81
|
+
import { AREA_SCHEMA, CONFLUENT_SCHEMA, CROSSBAR_SCHEMA, FRECHET_SCHEMA, MLSEB_SCHEMA, POWER_SCHEMA, SBEB_SCHEMA } from "./schemas.ts";
|
|
82
|
+
import { CLOTHOID_SCHEMA, CORNERS_SCHEMA, CORRIDOR_SCHEMA, CONSENSUS_SCHEMA, CUBU_SCHEMA, CUT_SCHEMA, DIFFUSION_SCHEMA, DIVIDED_SCHEMA, EDGE_PATH_SCHEMA, FDEB_SCHEMA, FLOW_CLUSTER_SCHEMA, FLOW_FIELD_SCHEMA, GROWTH_SCHEMA, HDBSCAN_SCHEMA, HIERARCHY_SCHEMA, HIGHWAY_SCHEMA, HOUGH_SCHEMA, HUB_ARC_SCHEMA, KD_SCHEMA, KDEEB_SCHEMA, KEY_SCHEMA, LANES_SCHEMA, LEVEL_HIGHWAY_SCHEMA, LEVEL_ROOM_SCHEMA, LINK_COMMUNITY_SCHEMA, MEET_SCHEMA, MESH_SCHEMA, MINGLE_SCHEMA, NESTED_SCHEMA, OD_CELL_SCHEMA, P_HUB_SCHEMA, QUICKBUNDLES_SCHEMA, RADIUS_SCHEMA, RESISTANCE_SCHEMA, RIDGE_SCHEMA, ROAD_CLASS_SCHEMA, ROOM_SCHEMA, SCALE_SPACE_SCHEMA, SECTION_SCHEMA, SELECT_SCHEMA, SECTIONS_SCHEMA, SHARED_SCHEMA, SMOOTH_SCHEMA, SOFT_KEY_SCHEMA, SPECTRAL_SCHEMA, SPIRAL_SCHEMA, STUB_SCHEMA, TENSION_SCHEMA, TERRITORY_SCHEMA, TRACLUS_SCHEMA, TRUNKS_SCHEMA, WEISZFELD_SCHEMA, WSPD_SCHEMA, ZIPPER_SCHEMA } from "./schemas.ts";
|
|
62
83
|
|
|
63
84
|
/** The options of a router strategy: the options of its router, without the name and the limit of the benchmark. */
|
|
64
85
|
export type RouterPreset<O> = Omit<O, "name" | "maxNodes">;
|
|
@@ -417,6 +438,26 @@ export const highwayStrategies: {
|
|
|
417
438
|
readonly ridges: Strategy<"highway", RidgeOptions>;
|
|
418
439
|
readonly hdbscan: Strategy<"highway", HdbscanOptions>;
|
|
419
440
|
readonly "hub-arcs": Strategy<"highway", HubArcOptions>;
|
|
441
|
+
readonly divided: Strategy<"highway", DividedOptions>;
|
|
442
|
+
readonly hierarchy: Strategy<"highway", HierarchyOptions>;
|
|
443
|
+
readonly fdeb: Strategy<"highway", FdebOptions>;
|
|
444
|
+
readonly mesh: Strategy<"highway", MeshOptions>;
|
|
445
|
+
readonly kdeeb: Strategy<"highway", KdeebOptions>;
|
|
446
|
+
readonly cubu: Strategy<"highway", CubuOptions>;
|
|
447
|
+
readonly mlseb: Strategy<"highway", MlsebOptions>;
|
|
448
|
+
readonly sbeb: Strategy<"highway", SbebOptions>;
|
|
449
|
+
readonly areas: Strategy<"highway", AreaOptions>;
|
|
450
|
+
readonly confluent: Strategy<"highway", ConfluentOptions>;
|
|
451
|
+
readonly power: Strategy<"highway", PowerOptions>;
|
|
452
|
+
readonly crossbars: Strategy<"highway", CrossbarOptions>;
|
|
453
|
+
readonly frechet: Strategy<"highway", FrechetOptions>;
|
|
454
|
+
readonly spectral: Strategy<"highway", SpectralOptions>;
|
|
455
|
+
readonly resistance: Strategy<"highway", ResistanceOptions>;
|
|
456
|
+
readonly "link-communities": Strategy<"highway", LinkCommunityOptions>;
|
|
457
|
+
readonly territories: Strategy<"highway", TerritoryOptions>;
|
|
458
|
+
readonly consensus: Strategy<"highway", ConsensusOptions>;
|
|
459
|
+
readonly "p-hub": Strategy<"highway", PHubOptions>;
|
|
460
|
+
readonly "scale-space": Strategy<"highway", ScaleSpaceOptions>;
|
|
420
461
|
readonly "corridors+breakeven": Strategy<"highway", CorridorOptions & BreakEvenOptions>;
|
|
421
462
|
readonly "corridors+stretch": Strategy<"highway", CorridorOptions & StretchOptions>;
|
|
422
463
|
readonly "corridors+ambiguity": Strategy<"highway", CorridorOptions & AmbiguityGuardOptions>;
|
|
@@ -667,6 +708,186 @@ export const highwayStrategies: {
|
|
|
667
708
|
maxNodes: 10_000,
|
|
668
709
|
run: (input: HighwayInput, o: Readonly<HubArcOptions>) => hubArcPlan(input, o),
|
|
669
710
|
}),
|
|
711
|
+
divided: defineStrategy({
|
|
712
|
+
step: "highway",
|
|
713
|
+
name: "divided",
|
|
714
|
+
describe: "Divided edge bundling (HWY-011). Each highway of two-way traffic splits into two carriageways at an offset, one for each direction.",
|
|
715
|
+
defaults: { ...DIVIDED_DEFAULTS } as DividedOptions,
|
|
716
|
+
schema: DIVIDED_SCHEMA,
|
|
717
|
+
maxNodes: 10_000,
|
|
718
|
+
run: (input: HighwayInput, o: Readonly<DividedOptions>) => dividedPlan(input, o),
|
|
719
|
+
}),
|
|
720
|
+
hierarchy: defineStrategy({
|
|
721
|
+
step: "highway",
|
|
722
|
+
name: "hierarchy",
|
|
723
|
+
describe: "Hierarchical edge bundling (HWY-001). Each edge goes near the hubs of the sections between its two leaves, and the shared stretches become highways.",
|
|
724
|
+
defaults: { ...HIERARCHY_DEFAULTS } as HierarchyOptions,
|
|
725
|
+
schema: HIERARCHY_SCHEMA,
|
|
726
|
+
maxNodes: 10_000,
|
|
727
|
+
run: (input: HighwayInput, o: Readonly<HierarchyOptions>) => hierarchyPlan(input, o),
|
|
728
|
+
}),
|
|
729
|
+
fdeb: defineStrategy({
|
|
730
|
+
step: "highway",
|
|
731
|
+
name: "fdeb",
|
|
732
|
+
describe: "Force-directed edge bundling with a field of the boxes (HWY-002 with RULE-002). The bundled points snap back to legal ways.",
|
|
733
|
+
defaults: { ...FDEB_DEFAULTS } as FdebOptions,
|
|
734
|
+
schema: FDEB_SCHEMA,
|
|
735
|
+
maxNodes: 10_000,
|
|
736
|
+
run: (input: HighwayInput, o: Readonly<FdebOptions>) => fdebPlan(input, o),
|
|
737
|
+
}),
|
|
738
|
+
mesh: defineStrategy({
|
|
739
|
+
step: "highway",
|
|
740
|
+
name: "mesh",
|
|
741
|
+
describe: "A control mesh (HWY-004). The crossings of the edges with the mesh form clusters, and the edges of a cluster share its point.",
|
|
742
|
+
defaults: { ...MESH_DEFAULTS } as MeshOptions,
|
|
743
|
+
schema: MESH_SCHEMA,
|
|
744
|
+
maxNodes: 10_000,
|
|
745
|
+
run: (input: HighwayInput, o: Readonly<MeshOptions>) => meshPlan(input, o),
|
|
746
|
+
}),
|
|
747
|
+
kdeeb: defineStrategy({
|
|
748
|
+
step: "highway",
|
|
749
|
+
name: "kdeeb",
|
|
750
|
+
describe: "Density bundling with a mask of the free space (RULE-028 with HWY-006). The edges move up the density, and the ridges become highways.",
|
|
751
|
+
defaults: { ...KDEEB_DEFAULTS } as KdeebOptions,
|
|
752
|
+
schema: KDEEB_SCHEMA,
|
|
753
|
+
maxNodes: 10_000,
|
|
754
|
+
run: (input: HighwayInput, o: Readonly<KdeebOptions>) => kdeebPlan(input, o),
|
|
755
|
+
}),
|
|
756
|
+
cubu: defineStrategy({
|
|
757
|
+
step: "highway",
|
|
758
|
+
name: "cubu",
|
|
759
|
+
describe: "Fast density bundling (HWY-007). The steps of `kdeeb` with a separable blur or a Fourier transform of the counts of the cells.",
|
|
760
|
+
defaults: { ...CUBU_DEFAULTS } as CubuOptions,
|
|
761
|
+
schema: CUBU_SCHEMA,
|
|
762
|
+
maxNodes: 10_000,
|
|
763
|
+
run: (input: HighwayInput, o: Readonly<CubuOptions>) => cubuPlan(input, o),
|
|
764
|
+
}),
|
|
765
|
+
mlseb: defineStrategy({
|
|
766
|
+
step: "highway",
|
|
767
|
+
name: "mlseb",
|
|
768
|
+
describe: "Moving least squares bundling (HWY-008). Each point of an edge moves to a local fit of the near edges, and the bundled points snap back to legal ways.",
|
|
769
|
+
defaults: { ...MLSEB_DEFAULTS } as MlsebOptions,
|
|
770
|
+
schema: MLSEB_SCHEMA,
|
|
771
|
+
maxNodes: 10_000,
|
|
772
|
+
run: (input: HighwayInput, o: Readonly<MlsebOptions>) => mlsebPlan(input, o),
|
|
773
|
+
}),
|
|
774
|
+
sbeb: defineStrategy({
|
|
775
|
+
step: "highway",
|
|
776
|
+
name: "sbeb",
|
|
777
|
+
describe: "Skeleton-based edge bundling (HWY-009). The edges of a group move toward the skeleton of their shape, and the bundled points snap back to legal ways.",
|
|
778
|
+
defaults: { ...SBEB_DEFAULTS } as SbebOptions,
|
|
779
|
+
schema: SBEB_SCHEMA,
|
|
780
|
+
maxNodes: 10_000,
|
|
781
|
+
run: (input: HighwayInput, o: Readonly<SbebOptions>) => sbebPlan(input, o),
|
|
782
|
+
}),
|
|
783
|
+
areas: defineStrategy({
|
|
784
|
+
step: "highway",
|
|
785
|
+
name: "areas",
|
|
786
|
+
describe: "Image-based edge bundles (HWY-010). Each group of edges is one shaded area around the longest path of the skeleton of its shape.",
|
|
787
|
+
defaults: { ...AREA_DEFAULTS } as AreaOptions,
|
|
788
|
+
schema: AREA_SCHEMA,
|
|
789
|
+
maxNodes: 10_000,
|
|
790
|
+
run: (input: HighwayInput, o: Readonly<AreaOptions>) => areaPlan(input, o),
|
|
791
|
+
}),
|
|
792
|
+
confluent: defineStrategy({
|
|
793
|
+
step: "highway",
|
|
794
|
+
name: "confluent",
|
|
795
|
+
describe: "Confluent drawings (HWY-013). Each biclique of a greedy search is one track, with a merge junction and a split junction.",
|
|
796
|
+
defaults: { ...CONFLUENT_DEFAULTS } as ConfluentOptions,
|
|
797
|
+
schema: CONFLUENT_SCHEMA,
|
|
798
|
+
maxNodes: 10_000,
|
|
799
|
+
run: (input: HighwayInput, o: Readonly<ConfluentOptions>) => confluentPlan(input, o),
|
|
800
|
+
}),
|
|
801
|
+
power: defineStrategy({
|
|
802
|
+
step: "highway",
|
|
803
|
+
name: "power",
|
|
804
|
+
describe: "Edge compression with modules and power graphs (HWY-014). The edges between two modules are one power edge, and a large power edge is a highway.",
|
|
805
|
+
defaults: { ...POWER_DEFAULTS } as PowerOptions,
|
|
806
|
+
schema: POWER_SCHEMA,
|
|
807
|
+
maxNodes: 10_000,
|
|
808
|
+
run: (input: HighwayInput, o: Readonly<PowerOptions>) => powerPlan(input, o),
|
|
809
|
+
}),
|
|
810
|
+
crossbars: defineStrategy({
|
|
811
|
+
step: "highway",
|
|
812
|
+
name: "crossbars",
|
|
813
|
+
describe: "Bundled crossings (HWY-022). Two sets of edges that cross near one place cross as two bundles, at one place.",
|
|
814
|
+
defaults: { ...CROSSBAR_DEFAULTS } as CrossbarOptions,
|
|
815
|
+
schema: CROSSBAR_SCHEMA,
|
|
816
|
+
maxNodes: 10_000,
|
|
817
|
+
run: (input: HighwayInput, o: Readonly<CrossbarOptions>) => crossbarPlan(input, o),
|
|
818
|
+
}),
|
|
819
|
+
frechet: defineStrategy({
|
|
820
|
+
step: "highway",
|
|
821
|
+
name: "frechet",
|
|
822
|
+
describe: "Subtrajectory clusters by the discrete Fréchet distance (HWY-027). The parts of the first routes that stay near one reference part become highways.",
|
|
823
|
+
defaults: { ...FRECHET_DEFAULTS } as FrechetOptions,
|
|
824
|
+
schema: FRECHET_SCHEMA,
|
|
825
|
+
maxNodes: 10_000,
|
|
826
|
+
run: (input: HighwayInput, o: Readonly<FrechetOptions>) => frechetPlan(input, o),
|
|
827
|
+
}),
|
|
828
|
+
spectral: defineStrategy({
|
|
829
|
+
step: "highway",
|
|
830
|
+
name: "spectral",
|
|
831
|
+
describe: "Spectral clustering of the compatibility graph of the edges (HWY-029). The largest eigengap gives the number of clusters, and each cluster gets highways.",
|
|
832
|
+
defaults: { ...SPECTRAL_DEFAULTS } as SpectralOptions,
|
|
833
|
+
schema: SPECTRAL_SCHEMA,
|
|
834
|
+
maxNodes: 10_000,
|
|
835
|
+
run: (input: HighwayInput, o: Readonly<SpectralOptions>) => spectralPlan(input, o),
|
|
836
|
+
}),
|
|
837
|
+
resistance: defineStrategy({
|
|
838
|
+
step: "highway",
|
|
839
|
+
name: "resistance",
|
|
840
|
+
describe: "Spectral bundling with the effective resistance (HWY-021). A pair of two bridges of the graph gets a lower weight, then the clusters of `spectral` apply.",
|
|
841
|
+
defaults: { ...RESISTANCE_DEFAULTS } as ResistanceOptions,
|
|
842
|
+
schema: RESISTANCE_SCHEMA,
|
|
843
|
+
maxNodes: 10_000,
|
|
844
|
+
run: (input: HighwayInput, o: Readonly<ResistanceOptions>) => resistancePlan(input, o),
|
|
845
|
+
}),
|
|
846
|
+
"link-communities": defineStrategy({
|
|
847
|
+
step: "highway",
|
|
848
|
+
name: "link-communities",
|
|
849
|
+
describe: "Link communities on the line graph (HWY-030). The edges with a common node and similar neighbours form communities, and each community gets highways.",
|
|
850
|
+
defaults: { ...LINK_COMMUNITY_DEFAULTS } as LinkCommunityOptions,
|
|
851
|
+
schema: LINK_COMMUNITY_SCHEMA,
|
|
852
|
+
maxNodes: 10_000,
|
|
853
|
+
run: (input: HighwayInput, o: Readonly<LinkCommunityOptions>) => linkCommunityPlan(input, o),
|
|
854
|
+
}),
|
|
855
|
+
territories: defineStrategy({
|
|
856
|
+
step: "highway",
|
|
857
|
+
name: "territories",
|
|
858
|
+
describe: "Territory aggregation of flows (HWY-033). The plugs and bends form cells, and the strong flows between two neighbour cells become highways.",
|
|
859
|
+
defaults: { ...TERRITORY_DEFAULTS } as TerritoryOptions,
|
|
860
|
+
schema: TERRITORY_SCHEMA,
|
|
861
|
+
maxNodes: 10_000,
|
|
862
|
+
run: (input: HighwayInput, o: Readonly<TerritoryOptions>) => territoryPlan(input, o),
|
|
863
|
+
}),
|
|
864
|
+
consensus: defineStrategy({
|
|
865
|
+
step: "highway",
|
|
866
|
+
name: "consensus",
|
|
867
|
+
describe: "A consensus of clusterings (HWY-035). The finders vote on the pairs of edges, and the pairs that most finders agree on form the highways.",
|
|
868
|
+
defaults: { ...CONSENSUS_DEFAULTS } as ConsensusOptions,
|
|
869
|
+
schema: CONSENSUS_SCHEMA,
|
|
870
|
+
maxNodes: 10_000,
|
|
871
|
+
run: (input: HighwayInput, o: Readonly<ConsensusOptions>) => consensusPlan(input, o),
|
|
872
|
+
}),
|
|
873
|
+
"p-hub": defineStrategy({
|
|
874
|
+
step: "highway",
|
|
875
|
+
name: "p-hub",
|
|
876
|
+
describe: "Hub location with the p-hub median (HWY-041). The p-median of the plugs gives the hubs, and the links between two hubs become highways.",
|
|
877
|
+
defaults: { ...P_HUB_DEFAULTS } as PHubOptions,
|
|
878
|
+
schema: P_HUB_SCHEMA,
|
|
879
|
+
maxNodes: 10_000,
|
|
880
|
+
run: (input: HighwayInput, o: Readonly<PHubOptions>) => pHubPlan(input, o),
|
|
881
|
+
}),
|
|
882
|
+
"scale-space": defineStrategy({
|
|
883
|
+
step: "highway",
|
|
884
|
+
name: "scale-space",
|
|
885
|
+
describe: "A scale space with persistence (HWY-053). The clusters of edges that live over a long range of scales get highways at the scale of the plan.",
|
|
886
|
+
defaults: { ...SCALE_SPACE_DEFAULTS } as ScaleSpaceOptions,
|
|
887
|
+
schema: SCALE_SPACE_SCHEMA,
|
|
888
|
+
maxNodes: 10_000,
|
|
889
|
+
run: (input: HighwayInput, o: Readonly<ScaleSpaceOptions>) => scaleSpacePlan(input, o),
|
|
890
|
+
}),
|
|
670
891
|
"corridors+breakeven": gateStrategy(corridors, breakEvenGate),
|
|
671
892
|
"corridors+stretch": gateStrategy(corridors, stretchGate),
|
|
672
893
|
"corridors+ambiguity": gateStrategy(corridors, ambiguityGate),
|
|
@@ -1,30 +1,50 @@
|
|
|
1
|
+
import type { AreaOptions } from "../highways/areas/index.ts";
|
|
2
|
+
import type { ConfluentOptions, GroupScope } from "../highways/confluent/index.ts";
|
|
3
|
+
import type { CrossbarOptions } from "../highways/crossbars/index.ts";
|
|
4
|
+
import type { FrechetOptions } from "../highways/frechet/index.ts";
|
|
5
|
+
import type { MlsebOptions } from "../highways/mlseb/index.ts";
|
|
6
|
+
import type { PowerOptions } from "../highways/power/index.ts";
|
|
7
|
+
import type { SbebOptions } from "../highways/sbeb/index.ts";
|
|
1
8
|
import type { CutOptions } from "../groups/cut/index.ts";
|
|
2
9
|
import type { KdOptions } from "../groups/kd/index.ts";
|
|
3
10
|
import type { KeyOptions } from "../groups/keys/index.ts";
|
|
4
11
|
import type { HighwayBase } from "../highways/base.ts";
|
|
5
12
|
import type { CorridorOptions } from "../highways/corridors/index.ts";
|
|
13
|
+
import type { ConsensusOptions } from "../highways/consensus/index.ts";
|
|
14
|
+
import type { CubuOptions } from "../highways/cubu/index.ts";
|
|
6
15
|
import type { DiffusionOptions } from "../highways/diffusion/index.ts";
|
|
16
|
+
import type { DividedOptions } from "../highways/divided/index.ts";
|
|
7
17
|
import type { EdgePathOptions } from "../highways/edge-paths/index.ts";
|
|
18
|
+
import type { FdebOptions } from "../highways/fdeb/index.ts";
|
|
8
19
|
import type { FlowClusterOptions } from "../highways/flow-clusters/index.ts";
|
|
9
20
|
import type { FlowFieldOptions } from "../highways/flow-field/index.ts";
|
|
10
21
|
import type { GrowthOptions } from "../highways/growth/index.ts";
|
|
11
22
|
import type { GroupSpine } from "../highways/grouped.ts";
|
|
12
23
|
import type { HdbscanOptions } from "../highways/hdbscan/index.ts";
|
|
24
|
+
import type { HierarchyOptions } from "../highways/hierarchy/index.ts";
|
|
13
25
|
import type { HoughOptions } from "../highways/hough/index.ts";
|
|
14
26
|
import type { HubArcOptions } from "../highways/hub-arcs/index.ts";
|
|
27
|
+
import type { KdeebOptions } from "../highways/kdeeb/index.ts";
|
|
15
28
|
import type { LanesOptions } from "../highways/lanes/index.ts";
|
|
16
29
|
import type { LevelHighwayOptions } from "../highways/level-links/index.ts";
|
|
30
|
+
import type { LinkCommunityOptions } from "../highways/link-communities/index.ts";
|
|
17
31
|
import type { MeetOptions } from "../highways/meet/index.ts";
|
|
32
|
+
import type { MeshOptions } from "../highways/mesh/index.ts";
|
|
18
33
|
import type { MingleOptions } from "../highways/mingle/index.ts";
|
|
19
34
|
import type { NestedOptions } from "../highways/nested/index.ts";
|
|
20
35
|
import type { OdCellOptions } from "../highways/od-cells/index.ts";
|
|
36
|
+
import type { PHubOptions } from "../highways/p-hub/index.ts";
|
|
21
37
|
import type { QuickBundlesOptions } from "../highways/quickbundles/index.ts";
|
|
38
|
+
import type { ResistanceOptions } from "../highways/resistance/index.ts";
|
|
22
39
|
import type { RidgeOptions } from "../highways/ridges/index.ts";
|
|
23
40
|
import type { RoadClassOptions } from "../highways/road-classes/index.ts";
|
|
41
|
+
import type { ScaleSpaceOptions } from "../highways/scale-space/index.ts";
|
|
24
42
|
import type { SelectOptions } from "../highways/select/index.ts";
|
|
25
43
|
import type { SoftKeyOptions } from "../highways/soft-keys/index.ts";
|
|
44
|
+
import type { SpectralOptions } from "../highways/spectral/index.ts";
|
|
26
45
|
import type { SpiralOptions } from "../highways/spiral/index.ts";
|
|
27
46
|
import type { StubOptions } from "../highways/stubs/index.ts";
|
|
47
|
+
import type { TerritoryOptions } from "../highways/territories/index.ts";
|
|
28
48
|
import type { TraclusOptions } from "../highways/traclus/index.ts";
|
|
29
49
|
import type { WeiszfeldOptions } from "../highways/weiszfeld/index.ts";
|
|
30
50
|
import type { WspdOptions } from "../highways/wspd/index.ts";
|
|
@@ -37,7 +57,7 @@ import type { SectionOptions } from "../sections.ts";
|
|
|
37
57
|
import type { WayOptions } from "../ways.ts";
|
|
38
58
|
import type { RunOrder } from "../segments.ts";
|
|
39
59
|
import type { ClothoidStrategyOptions, HighwayStrategyOptions, LevelRoomPreset, RadiusOptions, RoomPreset, RouterPreset, SmoothStrategyOptions, TensionOptions } from "./builtins.ts";
|
|
40
|
-
import type { EnumOption, OptionSchema } from "./options.ts";
|
|
60
|
+
import type { EnumOption, NumberOption, OptionSchema } from "./options.ts";
|
|
41
61
|
|
|
42
62
|
// The declarations of the options of the built-in strategies. Each `default` is the value that the function uses without the option.
|
|
43
63
|
// The test of the defaults runs each strategy with `optionDefaults` and with no option, and compares the output.
|
|
@@ -583,3 +603,262 @@ export const HUB_ARC_SCHEMA: OptionSchema<HubArcOptions> = {
|
|
|
583
603
|
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "An arc with fewer edges than this number is not a highway." },
|
|
584
604
|
generators: { type: "list", default: ["runs", "corridors", "road-classes"], describe: "The generators of the candidate arcs." },
|
|
585
605
|
};
|
|
606
|
+
|
|
607
|
+
/** The declarations of the options of the highway strategy `divided` (HWY-011). */
|
|
608
|
+
export const DIVIDED_SCHEMA: OptionSchema<DividedOptions> = {
|
|
609
|
+
margin: WAY_SCHEMA.margin,
|
|
610
|
+
k: WAY_SCHEMA.k,
|
|
611
|
+
from: HIGHWAY_BASE,
|
|
612
|
+
rule: { type: "enum", values: ["right", "left"], default: "right", describe: "The side of the road of the traffic of each direction." },
|
|
613
|
+
gap: { type: "number", min: 0, max: 4, step: 0.5, marks: [1, 2], default: 1, describe: "The gap between the two carriageways, in lanes." },
|
|
614
|
+
laneWidth: { type: "number", min: 1, max: 12, step: 1, marks: [4], default: 4, describe: "The width of one lane, in units of the board." },
|
|
615
|
+
minSize: { type: "integer", min: 1, max: 16, step: 1, default: 2, describe: "A highway divides only when each direction has this number of edges or more." },
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
/** The declarations of the options of the highway strategy `hierarchy` (HWY-001). */
|
|
619
|
+
export const HIERARCHY_SCHEMA: OptionSchema<HierarchyOptions> = {
|
|
620
|
+
margin: WAY_SCHEMA.margin,
|
|
621
|
+
k: WAY_SCHEMA.k,
|
|
622
|
+
group: { type: "enum", values: ["quadtree", "kd", "cut"], default: "quadtree", describe: "The tree of sections that gives the hubs." },
|
|
623
|
+
cap: { type: "integer", min: 1, max: 32, step: 1, marks: [4, 8, 16], default: 8, describe: "A section with more nodes splits." },
|
|
624
|
+
beta: { type: "number", min: 0, max: 1, step: 0.05, marks: [0.5, 0.85], default: 0.85, describe: "The pull of the hubs. The value 0 gives the straight line, and 1 goes through each hub." },
|
|
625
|
+
hubs: {
|
|
626
|
+
type: "integer",
|
|
627
|
+
min: 0,
|
|
628
|
+
max: 8,
|
|
629
|
+
step: 1,
|
|
630
|
+
special: [Infinity],
|
|
631
|
+
default: Infinity,
|
|
632
|
+
describe: "The largest number of hubs on each side of the lowest common section. `Infinity` uses each hub.",
|
|
633
|
+
},
|
|
634
|
+
snap: { type: "number", min: 0, max: 32, step: 2, marks: [8, 16], default: 8, describe: "The side of the grid that the hubs snap to, in units of the board." },
|
|
635
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
/** The declarations of the options of the highway strategy `fdeb` (HWY-002 with RULE-002). */
|
|
639
|
+
export const FDEB_SCHEMA: OptionSchema<FdebOptions> = {
|
|
640
|
+
margin: WAY_SCHEMA.margin,
|
|
641
|
+
k: WAY_SCHEMA.k,
|
|
642
|
+
compatibility: { type: "number", min: 0.05, max: 1, step: 0.05, marks: [0.4, 0.6, 0.8], default: 0.6, describe: "Two edges attract each other when their compatibility is this value or more." },
|
|
643
|
+
spring: { type: "number", min: 0, max: 0.5, step: 0.05, default: 0.1, describe: "The spring constant that keeps each edge smooth." },
|
|
644
|
+
cycles: { type: "integer", min: 0, max: 7, step: 1, default: 5, describe: "The number of cycles. Each cycle doubles the points of each edge." },
|
|
645
|
+
iterations: { type: "integer", min: 0, max: 200, step: 10, marks: [50], default: 50, describe: "The number of steps of the first cycle." },
|
|
646
|
+
repulsion: { type: "number", min: 0, max: 4, step: 0.25, marks: [0, 1], default: 1, describe: "The weight of the push of the boxes. The value 0 turns it off." },
|
|
647
|
+
pullLimit: {
|
|
648
|
+
type: "number",
|
|
649
|
+
min: 1,
|
|
650
|
+
max: 3,
|
|
651
|
+
step: 0.05,
|
|
652
|
+
special: [Infinity],
|
|
653
|
+
marks: [1.25, 1.5, Infinity],
|
|
654
|
+
default: 1.25,
|
|
655
|
+
describe: "An edge longer than this value times its straight line gets no pull. `Infinity` sets no budget.",
|
|
656
|
+
},
|
|
657
|
+
snap: { type: "number", min: 0, max: 32, step: 2, marks: [8, 16], default: 8, describe: "The side of the grid that the points of the edges snap to, in units of the board." },
|
|
658
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
/** The declarations of the options of the highway strategy `mesh` (HWY-004). */
|
|
662
|
+
export const MESH_SCHEMA: OptionSchema<MeshOptions> = {
|
|
663
|
+
margin: WAY_SCHEMA.margin,
|
|
664
|
+
k: WAY_SCHEMA.k,
|
|
665
|
+
cell: { type: "number", min: 1, max: 16, step: 0.5, marks: [2, 4, 8], default: 4, describe: "The side of a cell of the mesh, in units of the boxes." },
|
|
666
|
+
capacity: { type: "integer", min: 1, max: 32, step: 1, marks: [4, 8, 16], default: 8, describe: "A cluster of crossings has at most about this number of edges." },
|
|
667
|
+
merge: { type: "number", min: 0, max: 4, step: 0.25, marks: [1], default: 1, describe: "Two clusters nearer than this value, in units of the boxes, become one." },
|
|
668
|
+
angle: { type: "number", min: 0, max: 90, step: 5, marks: [30, 45], default: 45, describe: "A line crosses a segment of the mesh only within this angle in degrees to the main direction." },
|
|
669
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
/** The declarations of the options of the highway strategy `kdeeb` (RULE-028 with HWY-006). */
|
|
673
|
+
export const KDEEB_SCHEMA: OptionSchema<KdeebOptions> = {
|
|
674
|
+
margin: WAY_SCHEMA.margin,
|
|
675
|
+
k: WAY_SCHEMA.k,
|
|
676
|
+
source: { type: "enum", values: ["lines", "routes"], default: "lines", describe: "The lines of the first density: the straight lines of the edges, or their first routes." },
|
|
677
|
+
cell: { type: "number", min: 2, max: 32, step: 1, marks: [4, 8, 16], default: 8, describe: "The size of a cell of the density image, in units of the board." },
|
|
678
|
+
bandwidth: { type: "number", min: 4, max: 64, step: 2, marks: [12, 24, 48], default: 24, describe: "The width of the kernel at the first step, in units of the board." },
|
|
679
|
+
decay: { type: "number", min: 0.3, max: 1, step: 0.05, marks: [0.7], default: 0.7, describe: "Each step multiplies the width of the kernel by this value." },
|
|
680
|
+
steps: { type: "integer", min: 0, max: 30, step: 1, marks: [10], default: 10, describe: "The number of steps." },
|
|
681
|
+
smoothing: { type: "number", min: 0, max: 1, step: 0.05, marks: [0.5], default: 0.5, describe: "The share of the smoothing of each polyline after each step." },
|
|
682
|
+
mask: { type: "boolean", default: true, describe: "With `true`, the density is 0 in the boxes, so no ridge forms over a box." },
|
|
683
|
+
snap: { type: "number", min: 0, max: 32, step: 2, marks: [8, 16], default: 8, describe: "The side of the grid that the points of the edges snap to, in units of the board." },
|
|
684
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
/** The declarations of the options of the highway strategy `cubu` (HWY-007). */
|
|
688
|
+
export const CUBU_SCHEMA: OptionSchema<CubuOptions> = {
|
|
689
|
+
...KDEEB_SCHEMA,
|
|
690
|
+
kernel: { type: "enum", values: ["separable", "fft"], default: "separable", describe: "The blur of the counts of the cells: a separable kernel (CUBu) or a Fourier transform (FFTEB)." },
|
|
691
|
+
resample: { type: "number", min: 0, max: 32, step: 2, marks: [0, 8], default: 8, describe: "The spacing of the sample points after each step, in units of the board. The value 0 keeps the points." },
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
/** The declarations of the options of the highway strategy `mlseb` (HWY-008). */
|
|
695
|
+
export const MLSEB_SCHEMA: OptionSchema<MlsebOptions> = {
|
|
696
|
+
margin: WAY_SCHEMA.margin,
|
|
697
|
+
k: WAY_SCHEMA.k,
|
|
698
|
+
source: { type: "enum", values: ["lines", "routes"], default: "lines", describe: "The first lines of the edges: their straight lines, or their first routes." },
|
|
699
|
+
radius: { type: "number", min: 0.25, max: 8, step: 0.25, marks: [1, 2, 4], default: 2, describe: "The radius of the fit at the first step, as a multiple of the median short side of the boxes." },
|
|
700
|
+
decay: { type: "number", min: 0.3, max: 1, step: 0.05, marks: [0.8], default: 0.8, describe: "Each step multiplies the radius by this value." },
|
|
701
|
+
steps: { type: "integer", min: 0, max: 20, step: 1, marks: [6], default: 6, describe: "The number of steps." },
|
|
702
|
+
fit: { type: "enum", values: ["line", "parabola"], default: "line", describe: "The local fit of the moving least squares: a line, or a parabola along the line." },
|
|
703
|
+
angleWeight: { type: "number", min: 0, max: 4, step: 0.25, marks: [0, 1], default: 1, describe: "The weight of the angle in the weight of a near point. The value 0 uses only the distance." },
|
|
704
|
+
spacing: { type: "number", min: 2, max: 32, step: 1, marks: [8, 16], default: 8, describe: "The distance between two sample points of a line, in units of the board." },
|
|
705
|
+
snap: { type: "number", min: 0, max: 32, step: 2, marks: [8, 16], default: 8, describe: "The side of the grid that the points of the edges snap to, in units of the board." },
|
|
706
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
707
|
+
};
|
|
708
|
+
|
|
709
|
+
/** The declarations of the options of the highway strategy `sbeb` (HWY-009). */
|
|
710
|
+
export const SBEB_SCHEMA: OptionSchema<SbebOptions> = {
|
|
711
|
+
margin: WAY_SCHEMA.margin,
|
|
712
|
+
k: WAY_SCHEMA.k,
|
|
713
|
+
group: { type: "enum", values: ["quickbundles", "keys"], default: "quickbundles", describe: "The clusterer of the groups: `quickbundles`, or the key of each edge." },
|
|
714
|
+
source: { type: "enum", values: ["lines", "routes"], default: "lines", describe: "The lines of the edges that make the shape: their straight lines, or their first routes." },
|
|
715
|
+
radius: { type: "number", min: 0.25, max: 8, step: 0.25, marks: [1, 1.5, 3], default: 1.5, describe: "The radius of the shape of a group, as a multiple of the median short side of the boxes." },
|
|
716
|
+
attraction: { type: "number", min: 0, max: 1, step: 0.05, marks: [0.5], default: 0.5, describe: "The share of the move of each point to its target at each step." },
|
|
717
|
+
steps: { type: "integer", min: 0, max: 20, step: 1, marks: [4], default: 4, describe: "The number of steps." },
|
|
718
|
+
smoothing: { type: "number", min: 0, max: 1, step: 0.05, marks: [0.5], default: 0.5, describe: "The share of the smoothing of each polyline after each step." },
|
|
719
|
+
target: { type: "enum", values: ["skeleton", "mean"], default: "skeleton", describe: "The target of the points: the skeleton of the shape, or the mean line of the group." },
|
|
720
|
+
cell: { type: "number", min: 1, max: 16, step: 1, marks: [4, 8], default: 4, describe: "The side of a cell of the image of the shape, in units of the board." },
|
|
721
|
+
snap: { type: "number", min: 0, max: 32, step: 2, marks: [8, 16], default: 8, describe: "The side of the grid that the points of the edges snap to, in units of the board." },
|
|
722
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
/** The declarations of the options of the highway strategy `areas` (HWY-010). */
|
|
726
|
+
export const AREA_SCHEMA: OptionSchema<AreaOptions> = {
|
|
727
|
+
margin: WAY_SCHEMA.margin,
|
|
728
|
+
k: WAY_SCHEMA.k,
|
|
729
|
+
group: SBEB_SCHEMA.group,
|
|
730
|
+
source: SBEB_SCHEMA.source,
|
|
731
|
+
radius: SBEB_SCHEMA.radius,
|
|
732
|
+
width: { type: "enum", values: ["spread", "count"], default: "spread", describe: "The half width of an area: the spread of the edges of the group, or the number of its lanes." },
|
|
733
|
+
laneWidth: { type: "number", min: 1, max: 12, step: 1, marks: [4], default: 4, describe: "The width of one lane for the rule `count`, in units of the board." },
|
|
734
|
+
cell: SBEB_SCHEMA.cell,
|
|
735
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
/** The declaration of the limit of the legs of a trunk for the strategies `confluent` and `power`. */
|
|
739
|
+
const LEG_MAX: NumberOption = {
|
|
740
|
+
type: "number",
|
|
741
|
+
min: 0.1,
|
|
742
|
+
max: 1,
|
|
743
|
+
step: 0.05,
|
|
744
|
+
special: [Infinity],
|
|
745
|
+
marks: [0.3, 1, Infinity],
|
|
746
|
+
default: 1,
|
|
747
|
+
describe: "An edge rides the trunk only when each of its legs is this share of the trunk or shorter. `Infinity` sets no limit.",
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
/** The declaration of the edges that one group holds for the strategies `confluent` and `power`. */
|
|
751
|
+
const GROUP_SCOPE: EnumOption<GroupScope> = {
|
|
752
|
+
type: "enum",
|
|
753
|
+
values: ["collection", "all"],
|
|
754
|
+
default: "all",
|
|
755
|
+
describe: "The edges of one group: the edges of one collection, or each edge.",
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
/** The declarations of the options of the highway strategy `confluent` (HWY-013). */
|
|
759
|
+
export const CONFLUENT_SCHEMA: OptionSchema<ConfluentOptions> = {
|
|
760
|
+
margin: WAY_SCHEMA.margin,
|
|
761
|
+
k: WAY_SCHEMA.k,
|
|
762
|
+
minBiclique: { type: "integer", min: 2, max: 32, step: 1, marks: [4, 6, 9], default: 4, describe: "A biclique becomes a track when the product of the sizes of its two sets is this value or more." },
|
|
763
|
+
scope: GROUP_SCOPE,
|
|
764
|
+
spine: { ...GROUP_SPINE, default: "trunk" },
|
|
765
|
+
legMax: LEG_MAX,
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
/** The declarations of the options of the highway strategy `power` (HWY-014). */
|
|
769
|
+
export const POWER_SCHEMA: OptionSchema<PowerOptions> = {
|
|
770
|
+
margin: WAY_SCHEMA.margin,
|
|
771
|
+
k: WAY_SCHEMA.k,
|
|
772
|
+
modules: { type: "enum", values: ["exact", "near"], default: "exact", describe: "The rule of a module: the same neighbours, or near neighbours by the Jaccard index." },
|
|
773
|
+
jaccard: { type: "number", min: 0.3, max: 1, step: 0.05, marks: [0.6, 0.8], default: 0.8, describe: "With the rule `near`, a node joins a module at this Jaccard index or more." },
|
|
774
|
+
minSaved: { type: "integer", min: 1, max: 16, step: 1, marks: [1, 2, 4], default: 2, describe: "A power edge becomes a highway when it saves this number of edges or more." },
|
|
775
|
+
scope: GROUP_SCOPE,
|
|
776
|
+
spine: { ...GROUP_SPINE, default: "trunk" },
|
|
777
|
+
legMax: LEG_MAX,
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
/** The declarations of the options of the highway strategy `crossbars` (HWY-022). */
|
|
781
|
+
export const CROSSBAR_SCHEMA: OptionSchema<CrossbarOptions> = {
|
|
782
|
+
margin: WAY_SCHEMA.margin,
|
|
783
|
+
k: WAY_SCHEMA.k,
|
|
784
|
+
from: HIGHWAY_BASE,
|
|
785
|
+
tolerance: { type: "number", min: 0, max: 45, step: 1, marks: [5, 15, 30], default: 15, describe: "Two segments are parallel when the angle between them is this value or less, in degrees." },
|
|
786
|
+
minBar: { type: "integer", min: 1, max: 8, step: 1, marks: [2, 3], default: 2, describe: "Each side of a crossbar has this number of edges or more." },
|
|
787
|
+
reach: { type: "number", min: 0.5, max: 8, step: 0.5, marks: [2, 3, 4], default: 3, describe: "The crossings of one crossbar are this distance or nearer to its first crossing, as a multiple of the median short side of the boxes." },
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
/** The declarations of the options of the highway strategy `frechet` (HWY-027). */
|
|
791
|
+
export const FRECHET_SCHEMA: OptionSchema<FrechetOptions> = {
|
|
792
|
+
margin: WAY_SCHEMA.margin,
|
|
793
|
+
k: WAY_SCHEMA.k,
|
|
794
|
+
eps: { type: "number", min: 0.1, max: 4, step: 0.1, marks: [0.5, 1, 2], default: 1, describe: "The largest discrete Fréchet distance in a bundle, as a multiple of the median short side of the boxes." },
|
|
795
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A bundle has this number of edges or more." },
|
|
796
|
+
minLength: { type: "number", min: 0.5, max: 16, step: 0.5, marks: [2, 4], default: 2, describe: "The reference part of a bundle is this length or longer, as a multiple of the median short side of the boxes." },
|
|
797
|
+
step: { type: "number", min: 0.1, max: 2, step: 0.1, marks: [0.5], default: 0.5, describe: "The distance between two samples of a route, as a multiple of the median short side of the boxes." },
|
|
798
|
+
stride: { type: "integer", min: 1, max: 8, step: 1, marks: [1, 2, 4], default: 2, describe: "A search starts at each sample of this number along each route." },
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
/** The declarations of the options of the highway strategy `spectral` (HWY-029). */
|
|
802
|
+
export const SPECTRAL_SCHEMA: OptionSchema<SpectralOptions> = {
|
|
803
|
+
c0: { type: "number", min: 0.05, max: 0.95, step: 0.05, marks: [0.3, 0.5, 0.7], default: 0.5, describe: "Two edges are a pair of the graph only when their compatibility is this value or more." },
|
|
804
|
+
clusters: { type: "integer", min: 0, max: 32, step: 1, default: 0, describe: "The number of clusters of each part of the graph. The value 0 lets the largest eigengap choose it." },
|
|
805
|
+
kMax: { type: "integer", min: 2, max: 32, step: 1, marks: [8, 16], default: 16, describe: "The eigengap chooses at most this number of clusters in each part of the graph." },
|
|
806
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A cluster with this number of edges or more gets highways." },
|
|
807
|
+
spine: { ...GROUP_SPINE, default: "trunk" },
|
|
808
|
+
};
|
|
809
|
+
|
|
810
|
+
/** The declarations of the options of the highway strategy `resistance` (HWY-021). */
|
|
811
|
+
export const RESISTANCE_SCHEMA: OptionSchema<ResistanceOptions> = {
|
|
812
|
+
...SPECTRAL_SCHEMA,
|
|
813
|
+
projections: { type: "integer", min: 1, max: 64, step: 1, marks: [8, 16, 32], default: 16, describe: "The number of random projections of the estimate of the resistance." },
|
|
814
|
+
weight: { type: "number", min: 0, max: 1, step: 0.05, marks: [0.5, 1], default: 0.5, describe: "The weight of the resistance. A pair gets the weight `C (1 - weight R_e R_f)`." },
|
|
815
|
+
sparsify: { type: "boolean", default: false, describe: "With `true`, an edge with a resistance of 0.99 or more (a bridge) gets no pair." },
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
/** The declarations of the options of the highway strategy `link-communities` (HWY-030). */
|
|
819
|
+
export const LINK_COMMUNITY_SCHEMA: OptionSchema<LinkCommunityOptions> = {
|
|
820
|
+
threshold: { type: "number", min: 0, max: 1, step: 0.05, marks: [0, 0.3, 0.5], default: 0, describe: "The cut of the tree of the edges. The value 0 cuts at the best partition density." },
|
|
821
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A community with this number of edges or more gets highways, after the check of the geometry." },
|
|
822
|
+
spread: { type: "number", min: 1, max: 20, step: 1, marks: [3, 6, 12], default: 6, describe: "The largest distance of an end of an edge to the Weber point of its end of the community, in units of the board." },
|
|
823
|
+
spine: GROUP_SPINE,
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
/** The declarations of the options of the highway strategy `territories` (HWY-033). */
|
|
827
|
+
export const TERRITORY_SCHEMA: OptionSchema<TerritoryOptions> = {
|
|
828
|
+
radius: { type: "number", min: 1, max: 20, step: 0.5, marks: [2, 4, 8], default: 4, describe: "The radius of a group of points, in units of the board." },
|
|
829
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A flow between two cells becomes a highway when this number of edges or more cross it." },
|
|
830
|
+
points: { type: "enum", values: ["plugs", "bends", "both"], default: "both", describe: "The characteristic points: the plugs, the bends of the first routes, or both." },
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
/** The declarations of the options of the highway strategy `consensus` (HWY-035). */
|
|
834
|
+
export const CONSENSUS_SCHEMA: OptionSchema<ConsensusOptions> = {
|
|
835
|
+
members: { type: "list", default: ["corridors", "quickbundles", "wspd", "road-classes"], describe: "The finders that vote." },
|
|
836
|
+
cut: { type: "number", min: 0.1, max: 0.9, step: 0.05, marks: [0.3, 0.5, 0.7], default: 0.5, describe: "Two clusters join while their distance `1 - A` is below this value." },
|
|
837
|
+
linkage: { type: "enum", values: ["average", "single"], default: "average", describe: "The linkage of the clusters: the mean distance of the pairs, or the nearest pair." },
|
|
838
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A cluster with this number of edges or more gets highways." },
|
|
839
|
+
spine: GROUP_SPINE,
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
/** The declarations of the options of the highway strategy `p-hub` (HWY-041). */
|
|
843
|
+
export const P_HUB_SCHEMA: OptionSchema<PHubOptions> = {
|
|
844
|
+
p: { type: "integer", min: 0, max: 32, step: 1, marks: [0, 4, 8], default: 0, describe: "The number of hubs. The value 0 gives the root of the number of nodes, rounded." },
|
|
845
|
+
alpha: { type: "number", min: 0, max: 1, step: 0.05, marks: [0.2, 0.5, 0.8], default: 0.5, describe: "The cost of a length on a link between two hubs against a length off the links." },
|
|
846
|
+
allocation: { type: "enum", values: ["single", "multiple"], default: "single", describe: "The allocation: each node to its nearest hub, or each edge to its best pair of hubs." },
|
|
847
|
+
candidates: { type: "enum", values: ["corners", "sections"], default: "corners", describe: "The candidate points of the hubs: the corners of the corner graph, or the centres of the sections." },
|
|
848
|
+
detour: { type: "number", min: 1, max: 3, step: 0.05, marks: [1.25, 1.5], default: 1.25, describe: "An edge rides a link only when its way through the two hubs is this many times its first route or less." },
|
|
849
|
+
swaps: { type: "integer", min: 0, max: 4, step: 1, default: 1, describe: "The number of passes of the local search with one swap of a hub." },
|
|
850
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A link with fewer edges than this number is not a highway." },
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
/** The declarations of the options of the highway strategy `scale-space` (HWY-053). */
|
|
854
|
+
export const SCALE_SPACE_SCHEMA: OptionSchema<ScaleSpaceOptions> = {
|
|
855
|
+
theta: { type: "number", min: 0.5, max: 6, step: 0.5, marks: [1.5, 3], default: 1.5, describe: "The first scale, in units of the board." },
|
|
856
|
+
ratio: { type: "number", min: 1.1, max: 3, step: 0.1, marks: [1.5, 2], default: Math.SQRT2, describe: "The scale of each next scale is this value times the scale before it." },
|
|
857
|
+
scales: { type: "integer", min: 2, max: 16, step: 1, marks: [4, 8], default: 8, describe: "The number of scales." },
|
|
858
|
+
level: { type: "integer", min: 0, max: 15, step: 1, marks: [2, 4, 6], default: 2, describe: "The scale of the plan, from 0 (the first scale)." },
|
|
859
|
+
p0: { type: "number", min: 0, max: 3, step: 0.1, marks: [0.3, 0.6, 1.2], default: 0.6, describe: "A cluster gets highways only when its persistence (the log of the ratio of its last scale to its first scale) is this value or more." },
|
|
860
|
+
points: { type: "integer", min: 6, max: 24, step: 2, default: 12, describe: "The number of points of each line after the resampling." },
|
|
861
|
+
line: { type: "enum", values: ["routes", "lines"], default: "routes", describe: "The line of each edge: its first route, or the straight line between its plugs." },
|
|
862
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A cluster with this number of edges or more gets highways." },
|
|
863
|
+
spine: GROUP_SPINE,
|
|
864
|
+
};
|