@mark1russell7/highways 0.4.2 → 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 +59 -2
- package/build/index.d.ts +2333 -193
- package/build/index.d.ts.map +1 -1
- package/build/index.js +13042 -2334
- package/build/index.js.map +1 -1
- package/package.json +12 -1
- package/src/bench/exact/index.ts +258 -0
- 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/measures/index.ts +1 -0
- package/src/bench/measures/lanes.ts +304 -0
- package/src/bench/measures/levels.ts +86 -2
- 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 +25 -5
- 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 +89 -1
- package/src/bench/screen/portfolio-pick.ts +20 -0
- package/src/bench/screen/screen.ts +78 -2
- package/src/bench/screen/set.ts +3 -2
- package/src/channels.ts +56 -0
- 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/diffusion/index.ts +103 -0
- package/src/highways/divided/index.ts +111 -0
- package/src/highways/edge-paths/index.ts +155 -0
- package/src/highways/fdeb/index.ts +193 -0
- package/src/highways/fixtures.test-util.ts +71 -0
- package/src/highways/flow-clusters/index.ts +143 -0
- package/src/highways/frechet/index.ts +232 -0
- package/src/highways/growth/index.ts +148 -0
- package/src/highways/hdbscan/index.ts +250 -0
- package/src/highways/hierarchy/index.ts +140 -0
- package/src/highways/hough/index.ts +182 -0
- package/src/highways/hub-arcs/index.ts +181 -0
- package/src/highways/index.ts +79 -0
- package/src/highways/kdeeb/index.ts +355 -0
- package/src/highways/lanes/index.ts +189 -0
- package/src/highways/link-communities/index.ts +189 -0
- package/src/highways/mesh/index.ts +209 -0
- package/src/highways/mingle/index.ts +171 -0
- package/src/highways/mlseb/index.ts +204 -0
- package/src/highways/nested/index.ts +143 -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/ridges/index.ts +328 -0
- package/src/highways/sbeb/index.ts +303 -0
- package/src/highways/scale-space/index.ts +135 -0
- package/src/highways/snap.ts +110 -0
- package/src/highways/soft-keys/index.ts +114 -0
- package/src/highways/spectral/index.ts +391 -0
- package/src/highways/spiral/index.ts +205 -0
- package/src/highways/territories/index.ts +150 -0
- package/src/highways/trace.ts +153 -0
- package/src/highways/traclus/index.ts +296 -0
- package/src/index.ts +2 -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/routers/shared.ts +56 -3
- package/src/strategies/builtins.ts +376 -1
- package/src/strategies/schemas.ts +460 -1
- package/src/visibility.ts +5 -0
|
@@ -1,17 +1,51 @@
|
|
|
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";
|
|
15
|
+
import type { DiffusionOptions } from "../highways/diffusion/index.ts";
|
|
16
|
+
import type { DividedOptions } from "../highways/divided/index.ts";
|
|
17
|
+
import type { EdgePathOptions } from "../highways/edge-paths/index.ts";
|
|
18
|
+
import type { FdebOptions } from "../highways/fdeb/index.ts";
|
|
19
|
+
import type { FlowClusterOptions } from "../highways/flow-clusters/index.ts";
|
|
6
20
|
import type { FlowFieldOptions } from "../highways/flow-field/index.ts";
|
|
21
|
+
import type { GrowthOptions } from "../highways/growth/index.ts";
|
|
7
22
|
import type { GroupSpine } from "../highways/grouped.ts";
|
|
23
|
+
import type { HdbscanOptions } from "../highways/hdbscan/index.ts";
|
|
24
|
+
import type { HierarchyOptions } from "../highways/hierarchy/index.ts";
|
|
25
|
+
import type { HoughOptions } from "../highways/hough/index.ts";
|
|
26
|
+
import type { HubArcOptions } from "../highways/hub-arcs/index.ts";
|
|
27
|
+
import type { KdeebOptions } from "../highways/kdeeb/index.ts";
|
|
28
|
+
import type { LanesOptions } from "../highways/lanes/index.ts";
|
|
8
29
|
import type { LevelHighwayOptions } from "../highways/level-links/index.ts";
|
|
30
|
+
import type { LinkCommunityOptions } from "../highways/link-communities/index.ts";
|
|
9
31
|
import type { MeetOptions } from "../highways/meet/index.ts";
|
|
32
|
+
import type { MeshOptions } from "../highways/mesh/index.ts";
|
|
33
|
+
import type { MingleOptions } from "../highways/mingle/index.ts";
|
|
34
|
+
import type { NestedOptions } from "../highways/nested/index.ts";
|
|
10
35
|
import type { OdCellOptions } from "../highways/od-cells/index.ts";
|
|
36
|
+
import type { PHubOptions } from "../highways/p-hub/index.ts";
|
|
11
37
|
import type { QuickBundlesOptions } from "../highways/quickbundles/index.ts";
|
|
38
|
+
import type { ResistanceOptions } from "../highways/resistance/index.ts";
|
|
39
|
+
import type { RidgeOptions } from "../highways/ridges/index.ts";
|
|
12
40
|
import type { RoadClassOptions } from "../highways/road-classes/index.ts";
|
|
41
|
+
import type { ScaleSpaceOptions } from "../highways/scale-space/index.ts";
|
|
13
42
|
import type { SelectOptions } from "../highways/select/index.ts";
|
|
43
|
+
import type { SoftKeyOptions } from "../highways/soft-keys/index.ts";
|
|
44
|
+
import type { SpectralOptions } from "../highways/spectral/index.ts";
|
|
45
|
+
import type { SpiralOptions } from "../highways/spiral/index.ts";
|
|
14
46
|
import type { StubOptions } from "../highways/stubs/index.ts";
|
|
47
|
+
import type { TerritoryOptions } from "../highways/territories/index.ts";
|
|
48
|
+
import type { TraclusOptions } from "../highways/traclus/index.ts";
|
|
15
49
|
import type { WeiszfeldOptions } from "../highways/weiszfeld/index.ts";
|
|
16
50
|
import type { WspdOptions } from "../highways/wspd/index.ts";
|
|
17
51
|
import type { ZipperOptions } from "../highways/zipper/index.ts";
|
|
@@ -23,7 +57,7 @@ import type { SectionOptions } from "../sections.ts";
|
|
|
23
57
|
import type { WayOptions } from "../ways.ts";
|
|
24
58
|
import type { RunOrder } from "../segments.ts";
|
|
25
59
|
import type { ClothoidStrategyOptions, HighwayStrategyOptions, LevelRoomPreset, RadiusOptions, RoomPreset, RouterPreset, SmoothStrategyOptions, TensionOptions } from "./builtins.ts";
|
|
26
|
-
import type { EnumOption, OptionSchema } from "./options.ts";
|
|
60
|
+
import type { EnumOption, NumberOption, OptionSchema } from "./options.ts";
|
|
27
61
|
|
|
28
62
|
// The declarations of the options of the built-in strategies. Each `default` is the value that the function uses without the option.
|
|
29
63
|
// The test of the defaults runs each strategy with `optionDefaults` and with no option, and compares the output.
|
|
@@ -121,6 +155,24 @@ export const SHARED_SCHEMA: OptionSchema<RouterPreset<SharedOptions>> = {
|
|
|
121
155
|
default: "span",
|
|
122
156
|
describe: "The order of the edges of a key: the longest first, the shortest first, the most edges between two sections first, or the input order (NAT-024).",
|
|
123
157
|
},
|
|
158
|
+
reuse: {
|
|
159
|
+
type: "number",
|
|
160
|
+
min: 0,
|
|
161
|
+
max: 2,
|
|
162
|
+
step: 0.25,
|
|
163
|
+
default: 0,
|
|
164
|
+
describe: "With a value above 0, each later pass routes the edges again, and the busy links of the pass before cost less (HWY-005).",
|
|
165
|
+
},
|
|
166
|
+
reuseExponent: { type: "number", min: 0.5, max: 2, step: 0.25, default: 1, describe: "The exponent of the pull of the busy links of the option `reuse`." },
|
|
167
|
+
capacity: {
|
|
168
|
+
type: "number",
|
|
169
|
+
min: 0,
|
|
170
|
+
max: 10,
|
|
171
|
+
step: 0.5,
|
|
172
|
+
default: 0,
|
|
173
|
+
describe: "With a value above 0, a link costs more for each lane that does not fit in the free space across it (HWY-016).",
|
|
174
|
+
},
|
|
175
|
+
laneWidth: { type: "number", min: 2, max: 8, step: 1, default: 4, describe: "The width of one lane, for the option `capacity`." },
|
|
124
176
|
merge: {
|
|
125
177
|
type: "enum",
|
|
126
178
|
values: ["corner", "snell"],
|
|
@@ -403,3 +455,410 @@ export const SELECT_SCHEMA: OptionSchema<SelectOptions> = {
|
|
|
403
455
|
lambda: { type: "number", min: 0, max: 4, step: 0.25, marks: [0.5, 1, 2], default: 1, describe: "The weight of the added length of the edges against the ink that a highway saves." },
|
|
404
456
|
swaps: { type: "integer", min: 0, max: 5, step: 1, default: 2, describe: "The number of passes of the local search with one swap." },
|
|
405
457
|
};
|
|
458
|
+
|
|
459
|
+
/** The declarations of the options of the highway strategy `mingle` (HWY-003). */
|
|
460
|
+
export const MINGLE_SCHEMA: OptionSchema<MingleOptions> = {
|
|
461
|
+
k: { type: "integer", min: 4, max: 16, step: 1, default: 8, describe: "Each bundle looks for a merge among this number of nearest bundles in 4D." },
|
|
462
|
+
maxTurn: { type: "number", min: 20, max: 60, step: 5, marks: [20, 40, 60], default: 40, describe: "The largest turn of an edge at a meeting point, in degrees." },
|
|
463
|
+
levels: { type: "integer", min: 1, max: 10, step: 1, default: 6, describe: "The number of levels of merges." },
|
|
464
|
+
weight: { type: "number", min: 0.5, max: 1, step: 0.05, default: 1, describe: "The weight of the trunk in the ink. With 1, the trunk costs its length one time." },
|
|
465
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A bundle with this number of edges or more gets highways." },
|
|
466
|
+
spine: { ...GROUP_SPINE, default: "trunk" },
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
/** The declarations of the options of the highway strategy `spiral` (HWY-017 with EDA-035). */
|
|
470
|
+
export const SPIRAL_SCHEMA: OptionSchema<SpiralOptions> = {
|
|
471
|
+
margin: WAY_SCHEMA.margin,
|
|
472
|
+
k: WAY_SCHEMA.k,
|
|
473
|
+
alpha: { type: "number", min: 10, max: 40, step: 5, marks: [15, 25, 35], default: 25, describe: "The spiral angle, in degrees: the largest angle between a branch and the line to the root." },
|
|
474
|
+
minTargets: { type: "integer", min: 3, max: 20, step: 1, default: 4, describe: "A node with this number of edges or more gets a spiral tree." },
|
|
475
|
+
arc: { type: "integer", min: 2, max: 8, step: 1, default: 4, describe: "The number of points of the arc of each branch." },
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
/** The declarations of the options of the highway strategy `flow-clusters` (HWY-023). */
|
|
479
|
+
export const FLOW_CLUSTER_SCHEMA: OptionSchema<FlowClusterOptions> = {
|
|
480
|
+
tau: { type: "number", min: 0.1, max: 0.6, step: 0.05, marks: [0.2, 0.3, 0.45], default: 0.3, describe: "Two clusters join while their distance is this share of the length of the shorter edge, or less." },
|
|
481
|
+
linkage: { type: "enum", values: ["average", "complete", "single"], default: "average", describe: "The distance of two clusters: the mean, the largest or the smallest distance of their edges." },
|
|
482
|
+
directed: { type: "boolean", default: false, describe: "With this option, the source of one edge only compares with the source of the other edge." },
|
|
483
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A cluster with this number of edges or more gets highways." },
|
|
484
|
+
spine: { ...GROUP_SPINE, default: "trunk" },
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
/** The declarations of the options of the highway strategy `traclus` (HWY-025). */
|
|
488
|
+
export const TRACLUS_SCHEMA: OptionSchema<TraclusOptions> = {
|
|
489
|
+
margin: WAY_SCHEMA.margin,
|
|
490
|
+
k: WAY_SCHEMA.k,
|
|
491
|
+
eps: { type: "number", min: 1, max: 6, step: 0.5, marks: [1, 2, 4], default: 2, describe: "Two segments are neighbours when their distance is this value or less, in units of the board." },
|
|
492
|
+
minLns: { type: "integer", min: 2, max: 16, step: 1, default: 3, describe: "A cluster has segments of this number of edges or more." },
|
|
493
|
+
wPerp: { type: "number", min: 0, max: 2, step: 0.25, default: 1, describe: "The weight of the perpendicular distance." },
|
|
494
|
+
wPar: { type: "number", min: 0, max: 2, step: 0.25, default: 1, describe: "The weight of the parallel distance." },
|
|
495
|
+
wTheta: { type: "number", min: 0, max: 2, step: 0.25, default: 1, describe: "The weight of the angle distance." },
|
|
496
|
+
mdl: { type: "number", min: 0.5, max: 2, step: 0.25, default: 1, describe: "A route keeps a corner when the cost without it is more than this value times the cost with it." },
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
/** The declarations of the options of the highway strategy `diffusion` (HWY-020). */
|
|
500
|
+
export const DIFFUSION_SCHEMA: OptionSchema<DiffusionOptions> = {
|
|
501
|
+
margin: WAY_SCHEMA.margin,
|
|
502
|
+
k: WAY_SCHEMA.k,
|
|
503
|
+
a: { type: "number", min: 0, max: 0.5, step: 0.05, default: 0.25, describe: "The share of the density that each step takes from the links next to a link." },
|
|
504
|
+
steps: { type: "integer", min: 0, max: 10, step: 1, default: 3, describe: "The number of steps of the diffusion." },
|
|
505
|
+
lambda: { type: "number", min: 0, max: 2, step: 0.25, marks: [0.5, 1, 2], default: 1, describe: "The weight of the density in the cost of a link." },
|
|
506
|
+
gamma: { type: "number", min: 0.5, max: 2, step: 0.25, default: 1, describe: "The power of the discount of a dense link." },
|
|
507
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
/** The declarations of the options of the highway strategy `nested` (HWY-052). */
|
|
511
|
+
export const NESTED_SCHEMA: OptionSchema<NestedOptions> = {
|
|
512
|
+
theta: QUICKBUNDLES_SCHEMA.theta,
|
|
513
|
+
ratio: { type: "number", min: 1.5, max: 4, step: 0.5, default: 2, describe: "The scale of each level is this value times the scale of the next closer level." },
|
|
514
|
+
levels: { type: "integer", min: 1, max: 6, step: 1, default: 3, describe: "The number of levels." },
|
|
515
|
+
level: { type: "integer", min: 0, max: 5, step: 1, default: 0, describe: "The level of the plan. Level 0 is the closest level." },
|
|
516
|
+
points: QUICKBUNDLES_SCHEMA.points,
|
|
517
|
+
line: QUICKBUNDLES_SCHEMA.line,
|
|
518
|
+
order: QUICKBUNDLES_SCHEMA.order,
|
|
519
|
+
minSize: QUICKBUNDLES_SCHEMA.minSize,
|
|
520
|
+
spine: GROUP_SPINE,
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
/** The declarations of the options of the highway strategy `lanes` (HWY-051). */
|
|
524
|
+
export const LANES_SCHEMA: OptionSchema<LanesOptions> = {
|
|
525
|
+
margin: WAY_SCHEMA.margin,
|
|
526
|
+
k: WAY_SCHEMA.k,
|
|
527
|
+
from: HIGHWAY_BASE,
|
|
528
|
+
laneGap: { type: "number", min: 2, max: 8, step: 1, default: 4, describe: "The gap between two lanes." },
|
|
529
|
+
maxWidth: { type: "number", min: 8, max: 64, step: 4, default: 32, describe: "The largest width of a highway." },
|
|
530
|
+
depth: { type: "integer", min: 0, max: 5, step: 1, default: 3, describe: "The number of times that a highway can split, one half after the other." },
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
/** The declarations of the options of the highway strategy `growth` (HWY-055). */
|
|
534
|
+
export const GROWTH_SCHEMA: OptionSchema<GrowthOptions> = {
|
|
535
|
+
margin: WAY_SCHEMA.margin,
|
|
536
|
+
k: WAY_SCHEMA.k,
|
|
537
|
+
order: { type: "enum", values: ["length", "input"], default: "length", describe: "The order of the edges: the longest first route first, or the order of the graph." },
|
|
538
|
+
share: { type: "number", min: 0.1, max: 1, step: 0.05, marks: [0.5], default: 0.5, describe: "The cost of the part on a spine, as a share of its length." },
|
|
539
|
+
stretch: { type: "number", min: 1, max: 2, step: 0.05, marks: [1.3], default: 1.3, describe: "An edge joins a highway only when its way along it is this value times its first route or shorter." },
|
|
540
|
+
extendLanes: { type: "integer", min: 2, max: 8, step: 1, default: 3, describe: "A spine end extends when this number of its lanes or more go on together." },
|
|
541
|
+
extendRadius: { type: "number", min: 0.5, max: 6, step: 0.5, default: 2, describe: "The lanes go on together when their ends are this distance from their center or nearer, in units of the board." },
|
|
542
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway with this number of edges or more stays in the plan." },
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
/** The declarations of the options of the highway strategy `edge-paths` (HWY-012). */
|
|
546
|
+
export const EDGE_PATH_SCHEMA: OptionSchema<EdgePathOptions> = {
|
|
547
|
+
margin: WAY_SCHEMA.margin,
|
|
548
|
+
k: WAY_SCHEMA.k,
|
|
549
|
+
distortion: { type: "number", min: 1.1, max: 4, step: 0.1, marks: [1.5, 2, 3], default: 2, describe: "An edge takes a path of other edges only when the path is this many times its own length or less." },
|
|
550
|
+
power: { type: "number", min: 1, max: 4, step: 0.5, default: 2, describe: "The weight of a link in the search is its length to this power." },
|
|
551
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A highway has this number of edges or more." },
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
/** The declarations of the options of the highway strategy `soft-keys` (HWY-019). */
|
|
555
|
+
export const SOFT_KEY_SCHEMA: OptionSchema<SoftKeyOptions> = {
|
|
556
|
+
rule: { type: "function", describe: "The rule that gives the key of each edge. Two different keys add the distance `lambda`." },
|
|
557
|
+
lambda: { type: "number", min: 0, max: 2, step: 0.05, marks: [0, 0.25, 1], default: 0.25, describe: "The distance that two different keys add. A very large value keeps the keys apart." },
|
|
558
|
+
tau: { type: "number", min: 0.1, max: 1.5, step: 0.05, marks: [0.3, 0.5, 1], default: 0.5, describe: "Two clusters join while their distance is this value or less." },
|
|
559
|
+
attributes: { type: "list", default: [], describe: "The names of number fields of `data` that add a distance." },
|
|
560
|
+
weight: { type: "number", min: 0, max: 2, step: 0.25, default: 1, describe: "The weight of each field of `attributes`." },
|
|
561
|
+
linkage: { type: "enum", values: ["average", "complete", "single"], default: "average", describe: "The distance of two clusters: the mean, the largest or the smallest distance of their edges." },
|
|
562
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A cluster with this number of edges or more gets highways." },
|
|
563
|
+
spine: { ...GROUP_SPINE, default: "shared" },
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
/** The declarations of the options of the highway strategy `hough` (HWY-024). */
|
|
567
|
+
export const HOUGH_SCHEMA: OptionSchema<HoughOptions> = {
|
|
568
|
+
margin: WAY_SCHEMA.margin,
|
|
569
|
+
k: WAY_SCHEMA.k,
|
|
570
|
+
dTheta: { type: "number", min: 2, max: 20, step: 1, marks: [4, 8, 12], default: 8, describe: "The width of the votes in the angle, in degrees." },
|
|
571
|
+
dRho: { type: "number", min: 4, max: 40, step: 2, marks: [8, 12, 24], default: 12, describe: "The width of the votes in the offset, in units of the board." },
|
|
572
|
+
minVotes: { type: "integer", min: 2, max: 16, step: 1, default: 3, describe: "A peak with fewer edges than this number is not a corridor." },
|
|
573
|
+
orthogonal: { type: "boolean", default: false, describe: "With this option, the peaks are only horizontal or vertical lines." },
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
/** The declarations of the options of the highway strategy `ridges` (HWY-032). */
|
|
577
|
+
export const RIDGE_SCHEMA: OptionSchema<RidgeOptions> = {
|
|
578
|
+
margin: WAY_SCHEMA.margin,
|
|
579
|
+
k: WAY_SCHEMA.k,
|
|
580
|
+
source: { type: "enum", values: ["lines", "routes"], default: "lines", describe: "The lines of the density: the straight lines of the edges, or their first routes." },
|
|
581
|
+
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." },
|
|
582
|
+
bandwidth: { type: "number", min: 4, max: 64, step: 2, marks: [8, 16, 32], default: 16, describe: "The width of the blur of the density, in units of the board." },
|
|
583
|
+
strength: { type: "number", min: 0, max: 1, step: 0.05, default: 0.15, describe: "A cell is part of a ridge only when its strength is this share of the largest strength or more." },
|
|
584
|
+
minLength: { type: "number", min: 10, max: 300, step: 10, marks: [30, 60, 120], default: 60, describe: "A ridge has this length or more, in units of the board." },
|
|
585
|
+
snap: { type: "number", min: 2, max: 64, step: 2, marks: [8, 16, 32], default: 16, describe: "An edge snaps to a ridge where it is this distance from the ridge or nearer." },
|
|
586
|
+
minSize: { type: "integer", min: 2, max: 16, step: 1, default: 2, describe: "A ridge with this number of edges or more gets a highway." },
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
/** The declarations of the options of the highway strategy `hdbscan` (HWY-028). */
|
|
590
|
+
export const HDBSCAN_SCHEMA: OptionSchema<HdbscanOptions> = {
|
|
591
|
+
minClusterSize: { type: "integer", min: 2, max: 16, step: 1, default: 3, describe: "A cluster has this number of edges or more." },
|
|
592
|
+
minSamples: { type: "integer", min: 1, max: 16, step: 1, default: 3, describe: "The core distance of an edge is the distance to its neighbour of this rank." },
|
|
593
|
+
distance: { type: "enum", values: ["compatibility", "flow"], default: "compatibility", describe: "The distance of two edges: 1 less their compatibility, or the flow distance of the ends." },
|
|
594
|
+
spine: { ...GROUP_SPINE, default: "trunk" },
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
/** The declarations of the options of the highway strategy `hub-arcs` (HWY-042). */
|
|
598
|
+
export const HUB_ARC_SCHEMA: OptionSchema<HubArcOptions> = {
|
|
599
|
+
q: { type: "integer", min: 0, max: 64, step: 1, marks: [4, 12, 32], default: 12, describe: "The largest number of arcs." },
|
|
600
|
+
alpha: { type: "number", min: 0, max: 1, step: 0.05, marks: [0.3, 0.5, 0.8], default: 0.5, describe: "The cost of a length on an arc against a length off the arcs." },
|
|
601
|
+
stretch: { type: "number", min: 1, max: 2, step: 0.05, marks: [1.25], default: 1.25, describe: "An edge rides an arc only when its way is this many times its first route or less." },
|
|
602
|
+
swaps: { type: "integer", min: 0, max: 5, step: 1, default: 1, describe: "The number of passes of the local search with one swap." },
|
|
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." },
|
|
604
|
+
generators: { type: "list", default: ["runs", "corridors", "road-classes"], describe: "The generators of the candidate arcs." },
|
|
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
|
+
};
|
package/src/visibility.ts
CHANGED
|
@@ -211,6 +211,11 @@ export class CornerGraph {
|
|
|
211
211
|
return n / 2;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
+
/** This method gives the corners that link to the corner `i`, in the order of their indexes. A corner that is not in the graph gives an empty list. */
|
|
215
|
+
neighbours(i: number): readonly number[] {
|
|
216
|
+
return this.#adj[i] ?? [];
|
|
217
|
+
}
|
|
218
|
+
|
|
214
219
|
/** This method gives the index of the corner nearest to `p`, seen or not, or -1 when the graph has no corner near it. */
|
|
215
220
|
nearest(p: Point): number {
|
|
216
221
|
for (let r = this.#cell; r <= this.#cell * 64; r *= 2) {
|