@mark1russell7/highways 0.4.1 → 0.5.0
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 -1
- package/build/index.d.ts +1377 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8202 -1515
- package/build/index.js.map +1 -1
- package/package.json +3 -1
- package/src/bench/exact/index.ts +197 -0
- package/src/bench/measures/highways.ts +93 -0
- package/src/bench/measures/index.ts +2 -0
- package/src/bench/measures/lanes.ts +304 -0
- package/src/bench/measures/levels.ts +86 -2
- package/src/bench/screen/forms.ts +11 -5
- package/src/bench/screen/measures.ts +23 -0
- package/src/bench/screen/screen.ts +42 -0
- package/src/channels.ts +56 -0
- package/src/highways/base.ts +126 -0
- package/src/highways/diffusion/index.ts +103 -0
- package/src/highways/edge-paths/index.ts +155 -0
- package/src/highways/fixtures.test-util.ts +71 -0
- package/src/highways/flow-clusters/index.ts +143 -0
- package/src/highways/flow-field/index.ts +49 -0
- package/src/highways/gates/ambiguity/index.ts +110 -0
- package/src/highways/gates/breakeven/index.ts +62 -0
- package/src/highways/gates/hysteresis/index.ts +48 -0
- package/src/highways/gates/ids/index.ts +59 -0
- package/src/highways/gates/index.ts +6 -0
- package/src/highways/gates/model.ts +129 -0
- package/src/highways/gates/stretch/index.ts +39 -0
- package/src/highways/grouped.ts +123 -0
- package/src/highways/growth/index.ts +148 -0
- package/src/highways/hdbscan/index.ts +250 -0
- package/src/highways/hough/index.ts +182 -0
- package/src/highways/hub-arcs/index.ts +181 -0
- package/src/highways/index.ts +30 -0
- package/src/highways/lanes/index.ts +189 -0
- package/src/highways/level-links/index.ts +114 -0
- package/src/highways/meet/index.ts +84 -0
- package/src/highways/mingle/index.ts +171 -0
- package/src/highways/model.ts +5 -0
- package/src/highways/nested/index.ts +143 -0
- package/src/highways/od-cells/index.ts +50 -0
- package/src/highways/quickbundles/index.ts +117 -0
- package/src/highways/ridges/index.ts +328 -0
- package/src/highways/road-classes/index.ts +74 -0
- package/src/highways/router.ts +1 -1
- package/src/highways/select/index.ts +162 -0
- package/src/highways/snap.ts +110 -0
- package/src/highways/soft-keys/index.ts +114 -0
- package/src/highways/spiral/index.ts +205 -0
- package/src/highways/stretches.ts +141 -0
- package/src/highways/stubs/index.ts +117 -0
- package/src/highways/traclus/index.ts +296 -0
- package/src/highways/weiszfeld/index.ts +105 -0
- package/src/highways/wspd/index.ts +130 -0
- package/src/highways/zipper/index.ts +168 -0
- package/src/index.ts +1 -0
- package/src/routers/shared.ts +56 -3
- package/src/strategies/builtins.ts +303 -7
- package/src/strategies/schemas.ts +300 -0
- package/src/visibility.ts +5 -0
package/build/index.d.ts
CHANGED
|
@@ -734,6 +734,8 @@ export declare class CornerGraph {
|
|
|
734
734
|
constructor(nodes: readonly Node[], obstacles: Obstacles, options: CornerGraphOptions);
|
|
735
735
|
/** This method gives the number of links of the graph. */
|
|
736
736
|
get linkCount(): number;
|
|
737
|
+
/** 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. */
|
|
738
|
+
neighbours(i: number): readonly number[];
|
|
737
739
|
/** This method gives the index of the corner nearest to `p`, seen or not, or -1 when the graph has no corner near it. */
|
|
738
740
|
nearest(p: Point): number;
|
|
739
741
|
/** This method gives at most `k` corners that `p` can see, nearest first. The corner `self` does not count. */
|
|
@@ -783,6 +785,19 @@ export declare class SoftGraph {
|
|
|
783
785
|
*/
|
|
784
786
|
path(from: Point, to: Point, cost: (n: Node) => number): Point[];
|
|
785
787
|
}
|
|
788
|
+
/** The largest distance that `channelWidth` looks on each side of a link. A wider channel counts as this width on that side. */
|
|
789
|
+
export declare const CHANNEL_REACH = 64;
|
|
790
|
+
/**
|
|
791
|
+
* This function gives the distance from `p` along the unit direction `d` to the box, or `Infinity` when the ray does not meet the box.
|
|
792
|
+
* A point inside the box gives 0. The function uses the slab test.
|
|
793
|
+
*/
|
|
794
|
+
export declare function rayToBox(p: Point, d: Point, box: Box): number;
|
|
795
|
+
/**
|
|
796
|
+
* This function gives the width of the channel of the link from `a` to `b`. The width is the free space between the nearest boxes on the two sides.
|
|
797
|
+
* It measures the width at five points of the link, and gives the smallest. Each side counts up to `reach`.
|
|
798
|
+
* A link of length 0 gives the free space across the x axis at its point.
|
|
799
|
+
*/
|
|
800
|
+
export declare function channelWidth(obstacles: Obstacles, a: Point, b: Point, reach?: number): number;
|
|
786
801
|
/** The options of a way finder. */
|
|
787
802
|
export interface WayOptions {
|
|
788
803
|
/** The distance from a box to the corners of the graph. The default is 5. */
|
|
@@ -1043,6 +1058,20 @@ interface SharedOptions extends WayOptions {
|
|
|
1043
1058
|
* With `snell`, the route meets the run at the angle `acos(d)`, with `d` the cost share of the run for the route (NAT-035).
|
|
1044
1059
|
*/
|
|
1045
1060
|
readonly merge?: ShareMerge;
|
|
1061
|
+
/**
|
|
1062
|
+
* The pull of the busy links of the pass before (HWY-005, Winding Roads). With a value above 0 and two passes or more, each later pass routes each edge again from no ways.
|
|
1063
|
+
* A link then costs `len / (1 + reuse * u)^reuseExponent`, with `u` the edges of the key on it in the pass before. The default is 0: the later passes are rip-up passes.
|
|
1064
|
+
*/
|
|
1065
|
+
readonly reuse?: number;
|
|
1066
|
+
/** The exponent of the pull of `reuse`. The default is 1. */
|
|
1067
|
+
readonly reuseExponent?: number;
|
|
1068
|
+
/**
|
|
1069
|
+
* The cost of a lane that does not fit in its channel (HWY-016). One more edge on a link with `f` edges of the key costs `capacity * max(0, (f + 1) * laneWidth - width)` more.
|
|
1070
|
+
* `width` is the free space across the link (`channelWidth`). The default is 0: the router does not read the channels.
|
|
1071
|
+
*/
|
|
1072
|
+
readonly capacity?: number;
|
|
1073
|
+
/** The width of one lane, for `capacity`. The default is 4. */
|
|
1074
|
+
readonly laneWidth?: number;
|
|
1046
1075
|
/** The benchmark skips a fixture with more nodes. */
|
|
1047
1076
|
readonly maxNodes?: number;
|
|
1048
1077
|
}
|
|
@@ -1083,6 +1112,14 @@ interface HighwayInput {
|
|
|
1083
1112
|
* The strategy `corridors` makes the ways of the corner graph, as the router `corners` finds them.
|
|
1084
1113
|
*/
|
|
1085
1114
|
readonly routes?: Result;
|
|
1115
|
+
/**
|
|
1116
|
+
* This value is the graph before an edit and the plan of the same strategy on it. A strategy that keeps its highways stable over edits reads it.
|
|
1117
|
+
* The gates `hysteresis` (HWY-046) and `ids` (HWY-054) read it. The other strategies ignore it.
|
|
1118
|
+
*/
|
|
1119
|
+
readonly previous?: {
|
|
1120
|
+
readonly graph: Graph;
|
|
1121
|
+
readonly plan: HighwayPlan;
|
|
1122
|
+
};
|
|
1086
1123
|
}
|
|
1087
1124
|
/**
|
|
1088
1125
|
* One edge of a highway. The edge joins the spine at the merge point and leaves it at the split point.
|
|
@@ -2611,6 +2648,16 @@ export declare function positionStability(levels: readonly Level[]): number;
|
|
|
2611
2648
|
* A result without such a level gives 1. The cost is `n log n`, with a sample above 1500 items.
|
|
2612
2649
|
*/
|
|
2613
2650
|
export declare function orderStability(graph: Graph, levels: readonly Level[]): number;
|
|
2651
|
+
/**
|
|
2652
|
+
* This function gives the link agreement of the levels with groups (Z9 of MEAS0).
|
|
2653
|
+
* `la = mean over links of hausdorff(link, routes of its edges outside the two items) / u`, with `u` the argument `unit`.
|
|
2654
|
+
* The edges of a link are the edges between a node of one item and a node of the other item, in either direction.
|
|
2655
|
+
*
|
|
2656
|
+
* The function samples each polyline at points `u / 4` apart, with at most 64 points for each polyline. It keeps the points outside the boxes of the two items.
|
|
2657
|
+
* A link without such points on both sides does not count. It gives `undefined` when no link counts.
|
|
2658
|
+
* The value has no unit, and lower is better. The cost is quadratic in the points of each link.
|
|
2659
|
+
*/
|
|
2660
|
+
export declare function linkAgreement(graph: Graph, levels: readonly Level[], routes: readonly Route[], unit: number): number | undefined;
|
|
2614
2661
|
/** A grouping of the nodes: a map from the id of each node to the id of its group. */
|
|
2615
2662
|
export type Grouping = ReadonlyMap<string, string>;
|
|
2616
2663
|
/** This function gives the grouping of one level: each node goes to the id of its item. */
|
|
@@ -2742,6 +2789,129 @@ export interface OrderFragilityOptions {
|
|
|
2742
2789
|
* The cost is `orders` extra runs of the router.
|
|
2743
2790
|
*/
|
|
2744
2791
|
export declare function orderFragility(graph: Graph, route: (graph: Graph) => Result, options?: OrderFragilityOptions): OrderFragility;
|
|
2792
|
+
/**
|
|
2793
|
+
* This function gives the churn of the highways over one edit (Z10 for highways, from HWY-046). Two edges are a pair when they share a highway.
|
|
2794
|
+
* The churn is the share of the pairs that come or go: `|P ∆ P'| / |P ∪ P'|`. Only the edges of `edges` count, for example the edges of both graphs.
|
|
2795
|
+
* Two plans without pairs give 0. The scale is 0 to 1, and lower is better.
|
|
2796
|
+
*/
|
|
2797
|
+
export declare function highwayChurn(before: HighwayPlan, after: HighwayPlan, edges: ReadonlySet<string>): number;
|
|
2798
|
+
/** The match of the highways over one edit. */
|
|
2799
|
+
export interface HighwayIdKeep {
|
|
2800
|
+
/** The number of new highways with a match in the old plan: a Jaccard index of their edges of 0.5 or more. */
|
|
2801
|
+
readonly matched: number;
|
|
2802
|
+
/** The number of matched highways that keep the id of their match. */
|
|
2803
|
+
readonly kept: number;
|
|
2804
|
+
/** `kept / matched`, or `NaN` without a match. The scale is 0 to 1, and higher is better. */
|
|
2805
|
+
readonly share: number;
|
|
2806
|
+
}
|
|
2807
|
+
/**
|
|
2808
|
+
* This function tells how many highways keep their id over one edit (HWY-054). It matches the new highways with the old ones by `matchHighways`, with the index 0.5.
|
|
2809
|
+
* A matched highway keeps its id when its id is the id of its match. Only the edges of `edges` count.
|
|
2810
|
+
*/
|
|
2811
|
+
export declare function highwayIdKeep(before: HighwayPlan, after: HighwayPlan, edges: ReadonlySet<string>): HighwayIdKeep;
|
|
2812
|
+
/** The stability of a highway strategy over a seeded sequence of edits. Each value is the mean over the edits. */
|
|
2813
|
+
export interface HighwayEdits {
|
|
2814
|
+
/** The mean Fréchet distance of the routes over one edit, in units of the board (Z10). */
|
|
2815
|
+
readonly mean: number;
|
|
2816
|
+
/** The share of the routes that move over one edit (Z10). */
|
|
2817
|
+
readonly moved: number;
|
|
2818
|
+
/** The churn of the highways over one edit (`highwayChurn`). */
|
|
2819
|
+
readonly churn: number;
|
|
2820
|
+
/** The share of the matched highways that keep their id over one edit (`highwayIdKeep`), or `NaN` without a match. */
|
|
2821
|
+
readonly ids: number;
|
|
2822
|
+
}
|
|
2823
|
+
/**
|
|
2824
|
+
* This function measures a highway strategy over a sequence of `edits` seeded edits. Each edit is the small change of `changeGraph` with the seed `seed + i`.
|
|
2825
|
+
* The strategy gets the graph and its plan before the edit as `previous`, so a strategy with memory can keep its highways.
|
|
2826
|
+
* `follow` routes each plan with the way options of the strategy. The same graph, strategy, options and seed give the same values.
|
|
2827
|
+
*/
|
|
2828
|
+
export declare function highwayEdits(graph: Graph, strategy: Strategy<"highway", object>, options: object | undefined, edits: number, seed?: number): HighwayEdits;
|
|
2829
|
+
/**
|
|
2830
|
+
* The lane width of the lane measures, in units of the board. The room bench opens the lanes at the same width (`spacing` of `measureBoard`).
|
|
2831
|
+
* R12 also uses it as the smallest correct distance between two parallel legs.
|
|
2832
|
+
*/
|
|
2833
|
+
export declare const MEASURE_LANE_WIDTH = 4;
|
|
2834
|
+
/** The routes of a result with each shared segment open: one lane for each edge. */
|
|
2835
|
+
export interface OpenLanes {
|
|
2836
|
+
/** The segments of the result. The shared segments are the runs and the trunks of the bundles. */
|
|
2837
|
+
readonly graph: SegmentGraph;
|
|
2838
|
+
/** The lane route of each edge, from `laneRoutes`. Without a shared segment, the lane routes are the routes. */
|
|
2839
|
+
readonly lanes: readonly Route[];
|
|
2840
|
+
/** The distance between two lanes. */
|
|
2841
|
+
readonly width: number;
|
|
2842
|
+
}
|
|
2843
|
+
/** This function opens each shared segment of a result: each edge of a run or of a trunk gets its own lane, `width` apart. */
|
|
2844
|
+
export declare function openLanes(result: Result, width?: number): OpenLanes;
|
|
2845
|
+
/**
|
|
2846
|
+
* This function gives the lane separation of the routes (R12 of MEAS0): the share of the ink that runs too near a parallel leg of other edges.
|
|
2847
|
+
*
|
|
2848
|
+
* A leg is a drawn segment of `S`, and a leg that several routes share counts one time, as in B1. Two legs are near when four things are true.
|
|
2849
|
+
* The sets of their edges are different. They are within `maxAngle` degrees of parallel. Their projections overlap. Their distance is less than `near`.
|
|
2850
|
+
*
|
|
2851
|
+
* `ns = Σ_s length(the part of s that the projections of its near legs cover) / ink(S)`. Each part counts one time, so the scale is 0 to 1.
|
|
2852
|
+
* Lower is better. Routes without ink give 0. A grid of buckets finds the near legs, so the cost is `n log n` for an even density.
|
|
2853
|
+
*/
|
|
2854
|
+
export declare function routeSeparation(routes: readonly Route[], near?: number, maxAngle?: number): number;
|
|
2855
|
+
/**
|
|
2856
|
+
* This function gives the orthogonality of the routes (R14 of MEAS0): `orth = Σ L(legs within maxAngle degrees of an axis) / Σ_e L(r_e)`.
|
|
2857
|
+
* Each route counts its own legs, also on a shared segment. The scale is 0 to 1, and higher is better for an orthogonal style.
|
|
2858
|
+
* Routes without length give 1. The cost is linear.
|
|
2859
|
+
*/
|
|
2860
|
+
export declare function orthogonality(routes: readonly Route[], maxAngle?: number): number;
|
|
2861
|
+
/**
|
|
2862
|
+
* This function counts the lane crossings of the segments of a result (B5 of MEAS0): the pairs of edges whose lane order flips.
|
|
2863
|
+
* Along the route of each edge `e`, it takes the shared segments in order. On each one, another edge `f` is on the left or on the right of `e`, in the way of `e`.
|
|
2864
|
+
*
|
|
2865
|
+
* A pair `(e, f)` counts one time when the side of `f` changes from one shared segment of both edges to the next one.
|
|
2866
|
+
* Lower is better. A result without shared segments gives 0. The cost is the sum of the squares of the edge counts of the shared segments.
|
|
2867
|
+
*/
|
|
2868
|
+
export declare function laneCrossings(graph: SegmentGraph): number;
|
|
2869
|
+
/**
|
|
2870
|
+
* This function gives the occupied area of the routes (B7 of MEAS0): `moa = cells that S touches / cells that the straight lines touch`.
|
|
2871
|
+
* The cells are squares of side `unit` from the origin, and `unit` is `u` of the board (`boardUnit`). The straight line of an edge joins the two ends of its route.
|
|
2872
|
+
* The scale is a ratio, and lower is better. Routes without a straight line give 1. The cost is linear in the cells.
|
|
2873
|
+
*/
|
|
2874
|
+
export declare function occupiedArea(routes: readonly Route[], unit: number): number;
|
|
2875
|
+
/** The run profile of a result (B8 of MEAS0). */
|
|
2876
|
+
export interface RunProfile {
|
|
2877
|
+
/** The number of shared segments: the runs and the trunks of the bundles with two edges or more. */
|
|
2878
|
+
readonly runs: number;
|
|
2879
|
+
/** The median of the edges of each shared segment. It is 0 without a shared segment. */
|
|
2880
|
+
readonly median: number;
|
|
2881
|
+
/** The most edges of one shared segment. It is 0 without a shared segment. */
|
|
2882
|
+
readonly max: number;
|
|
2883
|
+
}
|
|
2884
|
+
/** This function gives the run profile of a result (B8 of MEAS0): the shared segments, and the median and the most edges of each. The cost is linear. */
|
|
2885
|
+
export declare function runProfile(graph: SegmentGraph): RunProfile;
|
|
2886
|
+
/** The lane fidelity of a result (B9 of MEAS0). */
|
|
2887
|
+
export interface LaneFidelity {
|
|
2888
|
+
/** The median of `lf(e)` over the edges with a shared segment. */
|
|
2889
|
+
readonly median: number;
|
|
2890
|
+
/** The largest `lf(e)`. */
|
|
2891
|
+
readonly max: number;
|
|
2892
|
+
/** The number of edges with a shared segment. */
|
|
2893
|
+
readonly edges: number;
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* This function gives the lane fidelity (B9 of MEAS0): `lf(e) = frechet(lane(e), r_e) / (width · k / 2)` for each edge `e` with a shared segment.
|
|
2897
|
+
* `lane(e)` is the lane route of `openLanes`, `r_e` is the route, and `k` is the edge count of the widest shared segment of `e`.
|
|
2898
|
+
* `frechet` is the discrete Fréchet distance of the points. A value of 1 or less is correct, and lower is better.
|
|
2899
|
+
* It gives `undefined` when no edge has a shared segment. The cost is quadratic in the points of each route.
|
|
2900
|
+
*/
|
|
2901
|
+
export declare function laneFidelity(routes: readonly Route[], open: OpenLanes): LaneFidelity | undefined;
|
|
2902
|
+
/**
|
|
2903
|
+
* This function counts the lane routes that go through a box that is not one of their ends (M4 of MEAS0).
|
|
2904
|
+
* It is the count `laneThrough` of the room bench (`measureBoard`), for the lanes of any result. Lower is better. The cost is `n log n`.
|
|
2905
|
+
*/
|
|
2906
|
+
export declare function lanesThrough(graph: Graph, open: OpenLanes): number;
|
|
2907
|
+
/**
|
|
2908
|
+
* This function gives the area of a result (M1 of MEAS0) for a router: the growth of the board that the open lanes need.
|
|
2909
|
+
* The value is the area of the bounding box of the boxes and the lane routes. The function divides it by the area of the bounding box of the boxes.
|
|
2910
|
+
*
|
|
2911
|
+
* It is the room form `area(open) / area(packed)` with the boxes as they are. The scale is a ratio of 1 or more, and lower is better.
|
|
2912
|
+
* A board without area gives 1. The cost is linear.
|
|
2913
|
+
*/
|
|
2914
|
+
export declare function laneArea(graph: Graph, open: OpenLanes): number;
|
|
2745
2915
|
/** The names of the proposed hard rules of MEAS0. The suite counts them. It does not apply them as rules yet. */
|
|
2746
2916
|
export declare const PROPOSED_RULES: readonly string[];
|
|
2747
2917
|
/** The options of `runSuite`. */
|
|
@@ -3011,6 +3181,589 @@ export declare function minHash(keys: Iterable<string>, count: number): number[]
|
|
|
3011
3181
|
* The edges of the cluster that are not on the spine make the next highway, while `minSize` of them remain.
|
|
3012
3182
|
*/
|
|
3013
3183
|
export declare function corridorPlan(input: HighwayInput, o: Readonly<CorridorOptions>): HighwayPlan;
|
|
3184
|
+
/**
|
|
3185
|
+
* A gate: a rule that keeps, drops or changes the highways of a plan. `gateStrategy` puts a gate after a highway strategy.
|
|
3186
|
+
* A gate does not move a spine. It takes members out of a highway, drops a highway or changes the id of a highway.
|
|
3187
|
+
*/
|
|
3188
|
+
interface Gate<G extends object> {
|
|
3189
|
+
/** The name of the gate. The strategy of a gate has the name `<strategy>+<gate>`. */
|
|
3190
|
+
readonly name: string;
|
|
3191
|
+
/** One or two sentences that tell what the gate does. */
|
|
3192
|
+
readonly describe: string;
|
|
3193
|
+
/** The values of the options of the gate. Their keys must not be keys of the options of the strategy before the gate. */
|
|
3194
|
+
readonly defaults: G;
|
|
3195
|
+
readonly schema: OptionSchema<G>;
|
|
3196
|
+
/** This function gives the plan after the gate. `way` holds the options of the way finder of the strategy. */
|
|
3197
|
+
apply(input: HighwayInput, plan: HighwayPlan, options: Readonly<G>, way: WayOptions): HighwayPlan;
|
|
3198
|
+
}
|
|
3199
|
+
/**
|
|
3200
|
+
* This function puts a gate after a highway strategy. The new strategy has the name `<strategy>+<gate>`, and the options of both.
|
|
3201
|
+
* The strategy gets its own options, and the gate gets the plan of the strategy and the options of the gate.
|
|
3202
|
+
* Thus a gate can follow each plan, for example `corridors+breakeven` or `shared-ways+stretch`. Gates can follow gates.
|
|
3203
|
+
*/
|
|
3204
|
+
export declare function gateStrategy<O extends object, G extends object>(strategy: Strategy<"highway", O>, gate: Gate<G>): Strategy<"highway", O & G>;
|
|
3205
|
+
/**
|
|
3206
|
+
* This function gives the plan with only the members that `keep` accepts. A highway with fewer than two members goes away.
|
|
3207
|
+
* The lanes keep their order, and each highway keeps its id, its key and its spine.
|
|
3208
|
+
*/
|
|
3209
|
+
export declare function keepMembers(plan: HighwayPlan, keep: (h: Highway, m: HighwayMember) => boolean): HighwayPlan;
|
|
3210
|
+
/** The lengths of the route of one edge of a plan. */
|
|
3211
|
+
interface EdgeLengths {
|
|
3212
|
+
/** The length of the route along the plan, after `follow`. */
|
|
3213
|
+
readonly route: number;
|
|
3214
|
+
/** The length of the route without a highway: the route of the router `corners`. */
|
|
3215
|
+
readonly alone: number;
|
|
3216
|
+
}
|
|
3217
|
+
/**
|
|
3218
|
+
* This function gives the length of the route of each edge of a plan, along the plan and alone. `follow` routes each edge of a plan on its own.
|
|
3219
|
+
* Thus the route of an edge does not change when another edge leaves the plan.
|
|
3220
|
+
*/
|
|
3221
|
+
export declare function edgeLengths(graph: Graph, plan: HighwayPlan, way: WayOptions): Map<string, EdgeLengths>;
|
|
3222
|
+
/** This function gives the ids of the edges that both graphs have. */
|
|
3223
|
+
export declare function commonEdges(a: Graph, b: Graph): Set<string>;
|
|
3224
|
+
/** This function gives the Jaccard index of two sets of edges: the common edges over all edges. Two empty sets give 0. */
|
|
3225
|
+
export declare function jaccard(a: ReadonlySet<string>, b: ReadonlySet<string>): number;
|
|
3226
|
+
/**
|
|
3227
|
+
* This function matches the highways of a plan with the highways of an earlier plan. It pairs the highways with the largest Jaccard index of their edges first.
|
|
3228
|
+
* A pair needs an index of `min` or more. Each highway is in one pair at most. The result maps the index of a new highway to the index of its old highway.
|
|
3229
|
+
* Only the edges of `edges` count, when this set is present: for example the edges of both graphs.
|
|
3230
|
+
*/
|
|
3231
|
+
export declare function matchHighways(before: HighwayPlan, after: HighwayPlan, min: number, edges?: ReadonlySet<string>): Map<number, number>;
|
|
3232
|
+
/** The options of the gate `ambiguity` (HWY-049). */
|
|
3233
|
+
interface AmbiguityGuardOptions {
|
|
3234
|
+
/** Two groups of edges merge only when the merge adds this share of false pairs, or less. The default is 0.5. */
|
|
3235
|
+
readonly maxAmbiguity: number;
|
|
3236
|
+
/** With `node`, the default, two groups merge only when they share an end node. With `any`, only `maxAmbiguity` decides. */
|
|
3237
|
+
readonly link: "node" | "any";
|
|
3238
|
+
}
|
|
3239
|
+
/** The default options of the gate `ambiguity`. */
|
|
3240
|
+
export declare const AMBIGUITY_GUARD_DEFAULTS: Readonly<AmbiguityGuardOptions>;
|
|
3241
|
+
/**
|
|
3242
|
+
* This function gives the ambiguity of a set of nodes: the share of the pairs of distinct nodes without an edge between them.
|
|
3243
|
+
* The nodes are the ends of the edges of one highway. A set with fewer than two nodes gives 0.
|
|
3244
|
+
*/
|
|
3245
|
+
export declare function nodeAmbiguity(nodes: ReadonlySet<string>, adj: ReadonlyMap<string, ReadonlySet<string>>): number;
|
|
3246
|
+
/**
|
|
3247
|
+
* This function applies the ambiguity guard of HWY-049 to a plan. A highway joins edges that belong together.
|
|
3248
|
+
*
|
|
3249
|
+
* Two nodes are a false pair when their edges share a highway and no edge joins them. The ambiguity of a group of edges is the share of false pairs among the pairs of its end nodes.
|
|
3250
|
+
* In each highway, each edge starts as a group. Two groups merge only when `amb(A ∪ B) - max(amb A, amb B)` is at most `maxAmbiguity`.
|
|
3251
|
+
* With the link `node`, they also must share an end node. The merge with the smallest rise comes first.
|
|
3252
|
+
*
|
|
3253
|
+
* The largest group stays on the highway. The other edges leave it and go alone.
|
|
3254
|
+
*/
|
|
3255
|
+
export declare function ambiguityPlan(input: HighwayInput, plan: HighwayPlan, options: Readonly<AmbiguityGuardOptions>): HighwayPlan;
|
|
3256
|
+
/** The gate `ambiguity` (HWY-049): the ambiguity guard. A highway does not join edges whose end nodes have no edges between them. */
|
|
3257
|
+
export declare const ambiguityGate: Gate<AmbiguityGuardOptions>;
|
|
3258
|
+
/** The options of the gate `breakeven` (HWY-047). */
|
|
3259
|
+
interface BreakEvenOptions {
|
|
3260
|
+
/**
|
|
3261
|
+
* The exponent of the cost law: a stretch with `n` edges costs `n^shareAlpha` times its length. Each edge pays the share `n^(shareAlpha - 1)`.
|
|
3262
|
+
* With 0, a shared stretch is one line, as the ink of B1 counts it. The default is 0.5, as the break-even floor of `corridors`.
|
|
3263
|
+
*/
|
|
3264
|
+
readonly shareAlpha: number;
|
|
3265
|
+
}
|
|
3266
|
+
/** The default options of the gate `breakeven`. */
|
|
3267
|
+
export declare const BREAK_EVEN_DEFAULTS: Readonly<BreakEvenOptions>;
|
|
3268
|
+
/**
|
|
3269
|
+
* This function applies the break-even law of HWY-047 to a plan. An edge stays on its highways only when sharing saves ink.
|
|
3270
|
+
*
|
|
3271
|
+
* The edge pays `n^(shareAlpha - 1)` of each shared stretch, with `n` the members of the highway. Thus it saves `(1 - n^(shareAlpha - 1)) L` on a stretch of the length `L`.
|
|
3272
|
+
* It adds the length of its route along the plan less the length of its route alone. An edge stays when the saving is as large as the added length.
|
|
3273
|
+
* For two parallel edges at the gap `d`, this rule gives the break-even overlap `d √((2 + t) / (2 - t))` with `t = 2^shareAlpha`.
|
|
3274
|
+
*
|
|
3275
|
+
* An edge that does not save ink leaves each of its highways. Then the other members of those highways save less, so the test repeats until no edge leaves.
|
|
3276
|
+
*/
|
|
3277
|
+
export declare function breakEvenPlan(input: HighwayInput, plan: HighwayPlan, options: Readonly<BreakEvenOptions>, way?: WayOptions): HighwayPlan;
|
|
3278
|
+
/** The gate `breakeven` (HWY-047): an edge stays on a highway only when sharing saves ink. */
|
|
3279
|
+
export declare const breakEvenGate: Gate<BreakEvenOptions>;
|
|
3280
|
+
/** The options of the gate `hysteresis` (HWY-046). */
|
|
3281
|
+
interface HysteresisOptions {
|
|
3282
|
+
/** A new highway needs this number of edges or more. The default is 3. */
|
|
3283
|
+
readonly kOn: number;
|
|
3284
|
+
/** A highway of the earlier plan stays while it has this number of edges or more. The default is 2. */
|
|
3285
|
+
readonly kOff: number;
|
|
3286
|
+
}
|
|
3287
|
+
/** The default options of the gate `hysteresis`. */
|
|
3288
|
+
export declare const HYSTERESIS_DEFAULTS: Readonly<HysteresisOptions>;
|
|
3289
|
+
/** Two highways of two plans are the same highway when the Jaccard index of their edges is this value or more. */
|
|
3290
|
+
export declare const SAME_HIGHWAY = .5;
|
|
3291
|
+
/**
|
|
3292
|
+
* This function applies the count threshold with hysteresis of HWY-046 to a plan.
|
|
3293
|
+
* A highway with `kOn` edges or more stays. A highway with fewer than `kOff` edges goes away.
|
|
3294
|
+
* A highway between the two limits stays only when it was in the earlier plan, `input.previous`.
|
|
3295
|
+
* The highway of the earlier plan with the most common edges is its match, with a Jaccard index of `SAME_HIGHWAY` or more.
|
|
3296
|
+
*
|
|
3297
|
+
* Thus an edit that adds or removes one edge near the limit does not make a highway come and go. Without an earlier plan, the limit is `kOn`.
|
|
3298
|
+
*/
|
|
3299
|
+
export declare function hysteresisPlan(input: HighwayInput, plan: HighwayPlan, options: Readonly<HysteresisOptions>): HighwayPlan;
|
|
3300
|
+
/** The gate `hysteresis` (HWY-046): a highway forms at `kOn` edges and goes away below `kOff` edges. */
|
|
3301
|
+
export declare const hysteresisGate: Gate<HysteresisOptions>;
|
|
3302
|
+
/** The options of the gate `ids` (HWY-054). */
|
|
3303
|
+
interface StableIdOptions {
|
|
3304
|
+
/** A new highway takes the id of an old highway when the Jaccard index of their edges is this value or more. The default is 0.5. */
|
|
3305
|
+
readonly minJaccard: number;
|
|
3306
|
+
}
|
|
3307
|
+
/** The default options of the gate `ids`. */
|
|
3308
|
+
export declare const STABLE_ID_DEFAULTS: Readonly<StableIdOptions>;
|
|
3309
|
+
/**
|
|
3310
|
+
* This function gives stable ids to the highways of a plan (HWY-054). The earlier plan is `input.previous`.
|
|
3311
|
+
* Each new highway takes the id of the old highway with the most common edges.
|
|
3312
|
+
* The pairs with the largest Jaccard index of their edges come first.
|
|
3313
|
+
*
|
|
3314
|
+
* A pair needs an index of `minJaccard` or more, and only the edges of both graphs count.
|
|
3315
|
+
* A new highway without a match gets a new id `h<n>` that no old highway and no new highway has. Thus the old highway of a new id ends.
|
|
3316
|
+
* The gate changes only the ids, so the routes do not change. Without an earlier plan, the plan does not change.
|
|
3317
|
+
*/
|
|
3318
|
+
export declare function stableIdPlan(input: HighwayInput, plan: HighwayPlan, options: Readonly<StableIdOptions>): HighwayPlan;
|
|
3319
|
+
/** The gate `ids` (HWY-054): stable highway ids across edits. A highway keeps the id of its match in the earlier plan. */
|
|
3320
|
+
export declare const stableIdGate: Gate<StableIdOptions>;
|
|
3321
|
+
/** The options of the gate `stretch` (HWY-048). */
|
|
3322
|
+
interface StretchOptions {
|
|
3323
|
+
/** An edge stays on its highways when its route is at most this number times its route alone, plus `pad`. The default is 1.2. */
|
|
3324
|
+
readonly budget: number;
|
|
3325
|
+
/** The added length that each edge can use, in units of the board. The default is 0. */
|
|
3326
|
+
readonly pad: number;
|
|
3327
|
+
}
|
|
3328
|
+
/** The default options of the gate `stretch`. */
|
|
3329
|
+
export declare const STRETCH_DEFAULTS: Readonly<StretchOptions>;
|
|
3330
|
+
/**
|
|
3331
|
+
* This function applies the stretch budget of HWY-048 to a plan: the join test of each edge.
|
|
3332
|
+
* An edge stays on its highways only when its route along the plan is at most `budget` times its route alone, plus `pad`.
|
|
3333
|
+
* The route alone is the route of the router `corners`. An edge that fails leaves each of its highways and goes alone, so the highways do not bend for it.
|
|
3334
|
+
* `follow` routes each edge on its own, so the test of one edge does not change with the other edges. One pass is enough.
|
|
3335
|
+
*/
|
|
3336
|
+
export declare function stretchPlan(input: HighwayInput, plan: HighwayPlan, options: Readonly<StretchOptions>, way?: WayOptions): HighwayPlan;
|
|
3337
|
+
/** The gate `stretch` (HWY-048): an edge joins a highway only when its route stays in a budget of its route alone. */
|
|
3338
|
+
export declare const stretchGate: Gate<StretchOptions>;
|
|
3339
|
+
/** The options of the highway strategy `diffusion` (HWY-020 of the note on highways). */
|
|
3340
|
+
interface DiffusionOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
3341
|
+
/** The share of the density that each step of the diffusion takes from the links next to a link. The default is 0.25. */
|
|
3342
|
+
readonly a: number;
|
|
3343
|
+
/** The number of steps of the diffusion. The default is 3. */
|
|
3344
|
+
readonly steps: number;
|
|
3345
|
+
/** The weight of the density in the cost of a link. The default is 1. */
|
|
3346
|
+
readonly lambda: number;
|
|
3347
|
+
/** The power of the discount of a dense link. The default is 1. */
|
|
3348
|
+
readonly gamma: number;
|
|
3349
|
+
/** A highway has this number of edges or more. The default is 2. */
|
|
3350
|
+
readonly minSize: number;
|
|
3351
|
+
}
|
|
3352
|
+
/** The default options of the strategy `diffusion`. */
|
|
3353
|
+
export declare const DIFFUSION_DEFAULTS: Readonly<Required<Omit<DiffusionOptions, "margin" | "k">>>;
|
|
3354
|
+
/**
|
|
3355
|
+
* This function gives the density of the edges on the links of the corner graph after the diffusion, as a share of the largest density.
|
|
3356
|
+
* The density of a link starts as the number of first ways on it. Each step mixes it with the mean density of the links that share a corner with it:
|
|
3357
|
+
* `rho_{k+1}(l) = (1 - a) rho_k(l) + a mean(rho_k(l'))`. The key of a link is `i * M + j` for the corners `i < j` of a graph of `M` corners.
|
|
3358
|
+
*/
|
|
3359
|
+
export declare function linkDensity(neighbours: (i: number) => readonly number[], corners: number, use: ReadonlyMap<number, number>, a: number, steps: number): Map<number, number>;
|
|
3360
|
+
/**
|
|
3361
|
+
* This function gives the highways of the route-aware bundling on the corner graph (HWY-020).
|
|
3362
|
+
* The first ways of the edges give the density of each link. A diffusion along the graph smooths it.
|
|
3363
|
+
* Then each edge takes a shortest way where a dense link costs less: `cost(l) = len(l) / (1 + lambda rho(l))^gamma`, with `rho` from 0 to 1.
|
|
3364
|
+
* Each stretch that `minSize` ways or more share after the second pass is one highway. The highways stay on the links of the corner graph.
|
|
3365
|
+
*/
|
|
3366
|
+
export declare function diffusionPlan(input: HighwayInput, o: Readonly<DiffusionOptions>): HighwayPlan;
|
|
3367
|
+
/**
|
|
3368
|
+
* The spine of a group of edges. With `shared`, the edges of each group go through the router `shared` with the group as their key.
|
|
3369
|
+
* Each stretch that they share is a highway. With `trunk`, each group gets one trunk between two terminals, with a leg from each plug.
|
|
3370
|
+
*/
|
|
3371
|
+
type GroupSpine = "shared" | "trunk";
|
|
3372
|
+
/** The values of `GroupSpine`. */
|
|
3373
|
+
export declare const GROUP_SPINES: readonly GroupSpine[];
|
|
3374
|
+
/** The group of one edge: its key, and `flip` when the edge goes from the second end of the group to the first end. */
|
|
3375
|
+
interface EdgeGroup {
|
|
3376
|
+
readonly key: string;
|
|
3377
|
+
readonly flip: boolean;
|
|
3378
|
+
}
|
|
3379
|
+
/** The options of `groupedPlan`. */
|
|
3380
|
+
interface GroupedOptions extends WayOptions {
|
|
3381
|
+
readonly spine: GroupSpine;
|
|
3382
|
+
/** A group has this number of edges or more. The value is 2 or more. */
|
|
3383
|
+
readonly minSize: number;
|
|
3384
|
+
/**
|
|
3385
|
+
* With the spine `trunk`, an edge rides the trunk only when each of its legs is this share of the span or shorter.
|
|
3386
|
+
* The span is the distance between the two terminals. `Infinity` sets no limit.
|
|
3387
|
+
*/
|
|
3388
|
+
readonly legMax?: number;
|
|
3389
|
+
}
|
|
3390
|
+
/**
|
|
3391
|
+
* This function gives the geometric median of points (the Weber point), with the iterations of Weiszfeld.
|
|
3392
|
+
* The point has the least sum of the distances to the points.
|
|
3393
|
+
*/
|
|
3394
|
+
export declare function weberPoint(points: readonly Point[], iterations?: number): Point;
|
|
3395
|
+
/**
|
|
3396
|
+
* This function gives the highways of the groups of edges. Only the edges in `groups` ride a highway, and each group needs `minSize` edges.
|
|
3397
|
+
* The spine `shared` gives the shared stretches of the router `shared` with the group as the key.
|
|
3398
|
+
* The spine `trunk` gives one trunk for each group, through the corner graph between two terminals.
|
|
3399
|
+
* A terminal is the Weber point of the points out of the plugs at one end of the group. A terminal in a box moves to the nearest of those points.
|
|
3400
|
+
*/
|
|
3401
|
+
export declare function groupedPlan(input: HighwayInput, groups: ReadonlyMap<string, EdgeGroup>, o: Readonly<GroupedOptions>): HighwayPlan;
|
|
3402
|
+
/** The linkage of the hierarchical clustering: the distance of two clusters from the distances of their edges. */
|
|
3403
|
+
type Linkage = "average" | "complete" | "single";
|
|
3404
|
+
/** The values of `Linkage`. */
|
|
3405
|
+
export declare const LINKAGES: readonly Linkage[];
|
|
3406
|
+
/** The options of the highway strategy `flow-clusters` (HWY-023 of the note on highways). */
|
|
3407
|
+
interface FlowClusterOptions {
|
|
3408
|
+
/** Two clusters join while their distance is this value or less. The distance is a share of the length of the shorter edge. The default is 0.3. */
|
|
3409
|
+
readonly tau: number;
|
|
3410
|
+
/** The linkage. The default is `average`. */
|
|
3411
|
+
readonly linkage: Linkage;
|
|
3412
|
+
/** With `true`, the source of one edge only compares with the source of the other edge. The default is `false`. */
|
|
3413
|
+
readonly directed: boolean;
|
|
3414
|
+
/** A cluster with this number of edges or more gets highways. The default is 2. */
|
|
3415
|
+
readonly minSize: number;
|
|
3416
|
+
/** The spine of each cluster. The default is `trunk`: one flow line from one area to the other area. */
|
|
3417
|
+
readonly spine: GroupSpine;
|
|
3418
|
+
}
|
|
3419
|
+
/** The default options of the strategy `flow-clusters`. */
|
|
3420
|
+
export declare const FLOW_CLUSTER_DEFAULTS: Readonly<FlowClusterOptions>;
|
|
3421
|
+
/**
|
|
3422
|
+
* This function gives the flow distance of two edges (Zhu and Guo 2014): `max(|s_e - s_f|, |t_e - t_f|) / min(len e, len f)`.
|
|
3423
|
+
* Without `directed`, it is the smaller value of the two directions of `f`, and `flip` is `true` when the opposite direction is smaller.
|
|
3424
|
+
*/
|
|
3425
|
+
export declare function flowDistance(s1: Point, t1: Point, s2: Point, t2: Point, directed: boolean): {
|
|
3426
|
+
d: number;
|
|
3427
|
+
flip: boolean;
|
|
3428
|
+
};
|
|
3429
|
+
/**
|
|
3430
|
+
* This function clusters the points of a distance matrix with the chain of nearest neighbours. The linkage is reducible, so the chain gives the same tree as the greedy order.
|
|
3431
|
+
* The clusters join while their distance is `tau` or less. The function gives the cluster of each point, as the index of a point of the cluster.
|
|
3432
|
+
*/
|
|
3433
|
+
export declare function chainClusters(n: number, d: Float64Array, tau: number, linkage: Linkage): Int32Array;
|
|
3434
|
+
/**
|
|
3435
|
+
* This function gives the flow clusters of the edges (HWY-023). It clusters the edges as points in 4D, with the cut at `tau`.
|
|
3436
|
+
* Each edge of a cluster gets the key of the cluster. It gets `flip` when it goes opposite to the first edge of the cluster.
|
|
3437
|
+
*/
|
|
3438
|
+
export declare function flowClusters(input: HighwayInput, o: Readonly<FlowClusterOptions>): Map<string, EdgeGroup>;
|
|
3439
|
+
/**
|
|
3440
|
+
* This function gives the highways of the flow clusters (HWY-023). The clusters of `flowClusters` with `minSize` edges or more get highways.
|
|
3441
|
+
* With the spine `trunk`, each cluster gets one trunk from one area to the other area. With `shared`, the edges of a cluster share their ways.
|
|
3442
|
+
*/
|
|
3443
|
+
export declare function flowClusterPlan(input: HighwayInput, o: Readonly<FlowClusterOptions>): HighwayPlan;
|
|
3444
|
+
/** The options of the highway strategy `edge-paths` (HWY-012 of the note on highways). */
|
|
3445
|
+
interface EdgePathOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
3446
|
+
/** An edge takes a path of other edges only when the path is this many times its own length or less. The default is 2. */
|
|
3447
|
+
readonly distortion: number;
|
|
3448
|
+
/** The weight of a link in the search is its length to this power. A larger power prefers paths of many short links. The default is 2. */
|
|
3449
|
+
readonly power: number;
|
|
3450
|
+
/** A highway has this number of edges or more. The default is 2. */
|
|
3451
|
+
readonly minSize: number;
|
|
3452
|
+
}
|
|
3453
|
+
/** The default options of the strategy `edge-paths`. */
|
|
3454
|
+
export declare const EDGE_PATH_DEFAULTS: Readonly<Required<Omit<EdgePathOptions, "margin" | "k">>>;
|
|
3455
|
+
/** One step of the path of an edge: the edge of the step and `true` when the path goes from its target to its source. */
|
|
3456
|
+
interface PathStep {
|
|
3457
|
+
readonly edge: string;
|
|
3458
|
+
readonly back: boolean;
|
|
3459
|
+
}
|
|
3460
|
+
/**
|
|
3461
|
+
* This function gives the edge paths of the graph (Wallinger and others 2022). The edges go in the order of their lengths, the longest first.
|
|
3462
|
+
* An edge looks for the shortest path of other edges between its nodes, with the weight `length ^ power`. A path is good when its length is `distortion` times the length of the edge or less.
|
|
3463
|
+
* The edges of a good path lock: they keep their own ways. An edge with a good path leaves the graph of the search. The map holds the path of each such edge.
|
|
3464
|
+
*/
|
|
3465
|
+
export declare function edgePaths(input: HighwayInput, o: Readonly<Pick<EdgePathOptions, "distortion" | "power">>): Map<string, PathStep[]>;
|
|
3466
|
+
/**
|
|
3467
|
+
* This function gives the highways of the edge paths (HWY-012). An edge with a good path follows the ways of the edges of its path.
|
|
3468
|
+
* Each edge of the path keeps its own way through the corner graph. So the ways share their links, and each shared stretch is a highway.
|
|
3469
|
+
*/
|
|
3470
|
+
export declare function edgePathPlan(input: HighwayInput, o: Readonly<EdgePathOptions>): HighwayPlan;
|
|
3471
|
+
/** The distance of two edges: 1 less their compatibility of FDEB, or the flow distance in 4D of HWY-023. */
|
|
3472
|
+
type EdgeDistance = "compatibility" | "flow";
|
|
3473
|
+
/** The values of `EdgeDistance`. */
|
|
3474
|
+
export declare const EDGE_DISTANCES: readonly EdgeDistance[];
|
|
3475
|
+
/** The options of the highway strategy `hdbscan` (HWY-028 of the note on highways). */
|
|
3476
|
+
interface HdbscanOptions {
|
|
3477
|
+
/** A cluster has this number of edges or more. The default is 3. */
|
|
3478
|
+
readonly minClusterSize: number;
|
|
3479
|
+
/** The core distance of an edge is the distance to its neighbour of this rank. The default is 3. */
|
|
3480
|
+
readonly minSamples: number;
|
|
3481
|
+
/** The distance of two edges. The default is `compatibility`. */
|
|
3482
|
+
readonly distance: EdgeDistance;
|
|
3483
|
+
/** The spine of each cluster. The default is `trunk`: one trunk from one area to the other area. */
|
|
3484
|
+
readonly spine: GroupSpine;
|
|
3485
|
+
}
|
|
3486
|
+
/** The default options of the strategy `hdbscan`. */
|
|
3487
|
+
export declare const HDBSCAN_DEFAULTS: Readonly<HdbscanOptions>;
|
|
3488
|
+
/**
|
|
3489
|
+
* This function gives the compatibility of two edges of FDEB (Holten and van Wijk 2009): `Ca Cs Cp Cv`, from 0 to 1.
|
|
3490
|
+
* `Ca` is the angle, `Cs` the scale, `Cp` the position and `Cv` the visibility. The direction of an edge does not change the value.
|
|
3491
|
+
*/
|
|
3492
|
+
export declare function compatibility(p0: Point, p1: Point, q0: Point, q1: Point): number;
|
|
3493
|
+
/**
|
|
3494
|
+
* This function gives the HDBSCAN clusters of the points of a distance matrix (Campello, Moulavi and Sander 2013). The value -1 is noise.
|
|
3495
|
+
* The core distance of a point is the distance to its `minSamples`-th nearest point. The mutual reachability is `max(core(a), core(b), d(a, b))`.
|
|
3496
|
+
* The minimum spanning tree of the mutual reachability gives the tree of the clusters. A split with two parts of `minClusterSize` or more gives two clusters.
|
|
3497
|
+
* The selection keeps the clusters with the largest stability, `sum (lambda_leave - lambda_birth)`, with `lambda = 1 / distance`. The root is not a cluster.
|
|
3498
|
+
*/
|
|
3499
|
+
export declare function hdbscanLabels(n: number, d: Float64Array, minClusterSize: number, minSamples: number): Int32Array;
|
|
3500
|
+
/**
|
|
3501
|
+
* This function gives the HDBSCAN clusters of the edges (HWY-028). The edges that are noise get no group.
|
|
3502
|
+
* Each edge of a cluster gets `flip` when it goes opposite to the first edge of the cluster.
|
|
3503
|
+
*/
|
|
3504
|
+
export declare function hdbscanClusters(input: HighwayInput, o: Readonly<HdbscanOptions>): Map<string, EdgeGroup>;
|
|
3505
|
+
/**
|
|
3506
|
+
* This function gives the highways of the HDBSCAN clusters (HWY-028). The clusters that live over a long range of densities are the highways.
|
|
3507
|
+
* The number of highways is not fixed, and the noise edges stay alone.
|
|
3508
|
+
*/
|
|
3509
|
+
export declare function hdbscanPlan(input: HighwayInput, o: Readonly<HdbscanOptions>): HighwayPlan;
|
|
3510
|
+
/** One edge that snaps to a line: the points where it joins and leaves the line, and its place along its own way. */
|
|
3511
|
+
interface SnapMember {
|
|
3512
|
+
readonly edge: string;
|
|
3513
|
+
/** The point on the line where the edge joins it. */
|
|
3514
|
+
readonly from: Point;
|
|
3515
|
+
/** The point on the line where the edge leaves it. */
|
|
3516
|
+
readonly to: Point;
|
|
3517
|
+
/** The place of the join along the edge, from 0 at the source to 1 at the target. It orders the highways of one edge. */
|
|
3518
|
+
readonly at: number;
|
|
3519
|
+
}
|
|
3520
|
+
/** A straight line that a finder gives as the place of a highway, with the edges that snap to it. */
|
|
3521
|
+
interface SnapLine {
|
|
3522
|
+
readonly key: string;
|
|
3523
|
+
readonly a: Point;
|
|
3524
|
+
readonly b: Point;
|
|
3525
|
+
readonly members: readonly SnapMember[];
|
|
3526
|
+
}
|
|
3527
|
+
/** The options of `snapPlan`. */
|
|
3528
|
+
interface SnapOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
3529
|
+
/** A highway has this number of edges or more. The value is 2 or more. */
|
|
3530
|
+
readonly minSize: number;
|
|
3531
|
+
}
|
|
3532
|
+
/** This function gives the line `u d + rho n` of the direction angle `theta`, with `d = (cos, sin)` and the normal `n = (-sin, cos)`. */
|
|
3533
|
+
export declare function linePoint(theta: number, rho: number, u: number): Point;
|
|
3534
|
+
/**
|
|
3535
|
+
* This function gives the highways of straight lines in the free space. Each line becomes a spine through the corner graph between its two ends.
|
|
3536
|
+
* An end inside a box moves to the nearest corner of the graph.
|
|
3537
|
+
* Each member joins the spine at the place nearest to its point `from`, and leaves it at the place nearest to its point `to`.
|
|
3538
|
+
* A member whose part of the spine is shorter than the margin does not ride. A spine with fewer than `minSize` members is not a highway.
|
|
3539
|
+
* An edge on several highways takes them in the order of `at`.
|
|
3540
|
+
*/
|
|
3541
|
+
export declare function snapPlan(input: HighwayInput, lines: readonly SnapLine[], o: Readonly<SnapOptions>): HighwayPlan;
|
|
3542
|
+
/** This function gives the points of a spine from the place `on` to the place `off`, backward when `on` is larger. */
|
|
3543
|
+
export declare function spinePart(spine: readonly Point[], on: number, off: number): Point[];
|
|
3544
|
+
/** The options of the highway strategy `hough` (HWY-024 of the note on highways). */
|
|
3545
|
+
interface HoughOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
3546
|
+
/** The width of the votes in the angle, in degrees. An edge joins a peak within this angle. The default is 8. */
|
|
3547
|
+
readonly dTheta: number;
|
|
3548
|
+
/** The width of the votes in the offset, in units of the board. An edge joins a peak when its middle is this near to the line. The default is 12. */
|
|
3549
|
+
readonly dRho: number;
|
|
3550
|
+
/** A peak with fewer edges than this number is not a corridor. The default is 3. */
|
|
3551
|
+
readonly minVotes: number;
|
|
3552
|
+
/** With `true`, the peaks are only horizontal or vertical lines. The default is `false`. */
|
|
3553
|
+
readonly orthogonal: boolean;
|
|
3554
|
+
}
|
|
3555
|
+
/** The default options of the strategy `hough`. */
|
|
3556
|
+
export declare const HOUGH_DEFAULTS: Readonly<Required<Omit<HoughOptions, "margin" | "k">>>;
|
|
3557
|
+
/** A peak of the votes: its angle, its offset and the sum of its votes. */
|
|
3558
|
+
interface HoughPeak {
|
|
3559
|
+
readonly theta: number;
|
|
3560
|
+
readonly rho: number;
|
|
3561
|
+
readonly votes: number;
|
|
3562
|
+
}
|
|
3563
|
+
/**
|
|
3564
|
+
* This function gives the peaks of the votes of the lines (Duda and Hart 1972). Each line votes for its angle and its offset, with a weight of its length.
|
|
3565
|
+
* A vote spreads as a Gaussian with the widths `dTheta / 2` and `dRho / 2`. The accumulator has bins of 1 degree and of `dRho / 4`.
|
|
3566
|
+
* A peak is a bin with a larger sum than each other bin within `dTheta` and `dRho`. The peaks come in the order of their votes.
|
|
3567
|
+
*/
|
|
3568
|
+
export declare function houghPeaks(lines: readonly {
|
|
3569
|
+
theta: number;
|
|
3570
|
+
mid: Point;
|
|
3571
|
+
len: number;
|
|
3572
|
+
}[], o: Readonly<Pick<HoughOptions, "dTheta" | "dRho" | "orthogonal">>): HoughPeak[];
|
|
3573
|
+
/**
|
|
3574
|
+
* This function gives the corridors of the votes (HWY-024). Each edge joins the first peak with an angle within `dTheta` and its middle within `dRho` of the line.
|
|
3575
|
+
* The corridor runs over the common span of the projections of its edges on the line. Each edge snaps to the ends of that span.
|
|
3576
|
+
* A member that makes the span shorter than four margins leaves, while the peak keeps `minVotes` edges.
|
|
3577
|
+
*/
|
|
3578
|
+
export declare function houghLines(input: HighwayInput, o: Readonly<HoughOptions>): SnapLine[];
|
|
3579
|
+
/**
|
|
3580
|
+
* This function gives the highways of the Hough votes (HWY-024). The peaks of the votes of the straight lines of the edges are corridors.
|
|
3581
|
+
* Each corridor is a spine through the corner graph, and its edges ride it over their common span.
|
|
3582
|
+
*/
|
|
3583
|
+
export declare function houghPlan(input: HighwayInput, o: Readonly<HoughOptions>): HighwayPlan;
|
|
3584
|
+
/** A generator of candidate highways: a highway strategy with its defaults. */
|
|
3585
|
+
type CandidateSource = "corridors" | "quickbundles" | "wspd" | "road-classes" | "flow-field" | "od-cells" | "shared-ways";
|
|
3586
|
+
/** The values of `CandidateSource`. */
|
|
3587
|
+
export declare const CANDIDATE_SOURCES: readonly CandidateSource[];
|
|
3588
|
+
/** The options of the highway strategy `select` (HWY-045 of the note on highways). */
|
|
3589
|
+
interface SelectOptions {
|
|
3590
|
+
/** The generators of the candidates. The default is `corridors`, `quickbundles`, `wspd` and `road-classes`. */
|
|
3591
|
+
readonly generators: readonly CandidateSource[];
|
|
3592
|
+
/** The weight of the added length of the edges against the ink that a highway saves (lambda 3 of the note). The default is 1. */
|
|
3593
|
+
readonly lambda: number;
|
|
3594
|
+
/** The number of passes of the local search with one swap. The default is 2. */
|
|
3595
|
+
readonly swaps: number;
|
|
3596
|
+
}
|
|
3597
|
+
/** The default options of the strategy `select`. */
|
|
3598
|
+
export declare const SELECT_DEFAULTS: Readonly<SelectOptions>;
|
|
3599
|
+
/** This function gives the plan of a generator, with its defaults. */
|
|
3600
|
+
export declare function candidatePlan(input: HighwayInput, source: CandidateSource): HighwayPlan;
|
|
3601
|
+
/**
|
|
3602
|
+
* This function gives the ink that a highway saves. It is the sum of the spine lengths of the members, less the length of their union.
|
|
3603
|
+
* The extra length of a member is its detour from its first route. The detour goes to the merge point, along the spine and back from the split point.
|
|
3604
|
+
*/
|
|
3605
|
+
export declare function candidateScore(h: Highway, routes: ReadonlyMap<string, readonly Point[]>): {
|
|
3606
|
+
gain: number;
|
|
3607
|
+
extra: number;
|
|
3608
|
+
};
|
|
3609
|
+
/**
|
|
3610
|
+
* This function gives the highways of the candidate generation and selection (HWY-045). Each generator proposes its highways as candidates.
|
|
3611
|
+
* The net gain of a candidate is the ink that it saves, less `lambda` times the length that it adds to its edges.
|
|
3612
|
+
* Two candidates of two generators conflict when they share an edge. The highways of one generator do not conflict.
|
|
3613
|
+
*
|
|
3614
|
+
* The selection takes the candidates by net gain for each edge, without a conflict. Then each pass of the local search
|
|
3615
|
+
* swaps in a candidate. The swap occurs when the net gain of the candidate is more than the sum of the selected candidates in conflict with it.
|
|
3616
|
+
*/
|
|
3617
|
+
export declare function selectPlan(input: HighwayInput, o: Readonly<SelectOptions>): HighwayPlan;
|
|
3618
|
+
/** A generator of candidate arcs: `runs` (the shared stretches of the first ways of all edges) or a generator of the strategy `select`. */
|
|
3619
|
+
type ArcSource = "runs" | CandidateSource;
|
|
3620
|
+
/** The values of `ArcSource`. */
|
|
3621
|
+
export declare const ARC_SOURCES: readonly ArcSource[];
|
|
3622
|
+
/** The options of the highway strategy `hub-arcs` (HWY-042 of the note on highways). */
|
|
3623
|
+
interface HubArcOptions {
|
|
3624
|
+
/** The largest number of arcs (highways). The default is 12. */
|
|
3625
|
+
readonly q: number;
|
|
3626
|
+
/** The cost of a length on an arc against a length off the arcs, from 0 to 1. The default is 0.5. */
|
|
3627
|
+
readonly alpha: number;
|
|
3628
|
+
/** An edge rides an arc only when its legs plus its part of the arc are this many times its first route or less. The default is 1.25. */
|
|
3629
|
+
readonly stretch: number;
|
|
3630
|
+
/** The number of passes of the local search with one swap. The default is 1. */
|
|
3631
|
+
readonly swaps: number;
|
|
3632
|
+
/** An arc with fewer edges than this number is not a highway. The default is 2. */
|
|
3633
|
+
readonly minSize: number;
|
|
3634
|
+
/** The generators of the candidate arcs. The default is `runs`, `corridors` and `road-classes`. */
|
|
3635
|
+
readonly generators: readonly ArcSource[];
|
|
3636
|
+
}
|
|
3637
|
+
/** The default options of the strategy `hub-arcs`. */
|
|
3638
|
+
export declare const HUB_ARC_DEFAULTS: Readonly<HubArcOptions>;
|
|
3639
|
+
/** This function gives the candidate arcs: the spines of the plans of the generators, without the copies, with the longest first. */
|
|
3640
|
+
export declare function candidateArcs(input: HighwayInput, generators: readonly ArcSource[]): Point[][];
|
|
3641
|
+
/**
|
|
3642
|
+
* This function gives the highways of the hub arc location (Campbell, Ernst and Krishnamoorthy 2005). It chooses at most `q` arcs from the candidates.
|
|
3643
|
+
* An edge on an arc costs its two legs plus `alpha` times its part of the arc. An edge off the arcs costs its first route.
|
|
3644
|
+
* The greedy step adds the arc that saves the most cost. Then each swap pass changes one chosen arc for one other arc while the saving grows.
|
|
3645
|
+
* Each edge rides the arc that saves the most for it.
|
|
3646
|
+
*/
|
|
3647
|
+
export declare function hubArcPlan(input: HighwayInput, o: Readonly<HubArcOptions>): HighwayPlan;
|
|
3648
|
+
/** The lines that make the density: the straight lines of the edges, or their first routes. */
|
|
3649
|
+
type RidgeSource = "lines" | "routes";
|
|
3650
|
+
/** The options of the highway strategy `ridges` (HWY-032 of the note on highways). */
|
|
3651
|
+
interface RidgeOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
3652
|
+
/** The lines of the density. The default is `lines`. */
|
|
3653
|
+
readonly source: RidgeSource;
|
|
3654
|
+
/** The side of a cell of the density image, in units of the board. The default is 8. A large board gets larger cells, up to 1024 cells on a side. */
|
|
3655
|
+
readonly cell: number;
|
|
3656
|
+
/** The width of the blur, in units of the board. The default is 16. */
|
|
3657
|
+
readonly bandwidth: number;
|
|
3658
|
+
/** A ridge cell has this share of the largest strength or more. The default is 0.15. */
|
|
3659
|
+
readonly strength: number;
|
|
3660
|
+
/** A ridge has this length or more, in units of the board. The default is 60. */
|
|
3661
|
+
readonly minLength: number;
|
|
3662
|
+
/** An edge snaps to a ridge when its line is this near to the ridge, in units of the board. The default is 16. */
|
|
3663
|
+
readonly snap: number;
|
|
3664
|
+
/** A highway has this number of edges or more. The default is 2. */
|
|
3665
|
+
readonly minSize: number;
|
|
3666
|
+
}
|
|
3667
|
+
/** The default options of the strategy `ridges`. */
|
|
3668
|
+
export declare const RIDGE_DEFAULTS: Readonly<Required<Omit<RidgeOptions, "margin" | "k">>>;
|
|
3669
|
+
/** The density image: the cells, its size, and the place of its first cell. */
|
|
3670
|
+
interface DensityImage {
|
|
3671
|
+
readonly w: number;
|
|
3672
|
+
readonly h: number;
|
|
3673
|
+
readonly cell: number;
|
|
3674
|
+
readonly x0: number;
|
|
3675
|
+
readonly y0: number;
|
|
3676
|
+
readonly rho: Float64Array;
|
|
3677
|
+
}
|
|
3678
|
+
/**
|
|
3679
|
+
* This function gives the density of the polylines on a grid of cells, after a Gaussian blur of the width `bandwidth`.
|
|
3680
|
+
* Each polyline adds 1 to each cell that it goes through, one time for each polyline.
|
|
3681
|
+
*/
|
|
3682
|
+
export declare function lineDensity(lines: readonly (readonly Point[])[], box: {
|
|
3683
|
+
x: number;
|
|
3684
|
+
y: number;
|
|
3685
|
+
w: number;
|
|
3686
|
+
h: number;
|
|
3687
|
+
}, cellSize: number, bandwidth: number): DensityImage;
|
|
3688
|
+
/** One ridge: its two ends and the length between them. */
|
|
3689
|
+
interface Ridge {
|
|
3690
|
+
readonly a: Point;
|
|
3691
|
+
readonly b: Point;
|
|
3692
|
+
}
|
|
3693
|
+
/**
|
|
3694
|
+
* This function gives the ridges of a density image (Lindeberg 1998). A ridge cell has a negative eigenvalue of the Hessian with the larger size.
|
|
3695
|
+
* Its density is a maximum along the eigenvector of that eigenvalue. Its strength is the density times the size of that eigenvalue.
|
|
3696
|
+
* The cells with `strength` times the largest strength or more join their neighbours with a direction within 30 degrees.
|
|
3697
|
+
* Each group of cells gives the segment of its main axis. A segment of `minLength` or more is a ridge. The ridges come in the order of their total strength.
|
|
3698
|
+
*/
|
|
3699
|
+
export declare function densityRidges(img: DensityImage, strength: number, minLength: number): Ridge[];
|
|
3700
|
+
/**
|
|
3701
|
+
* This function gives the lines of the ridges (HWY-032), each with the edges that snap to it.
|
|
3702
|
+
* An edge snaps to a ridge when the part of its line near the ridge is half of `minLength` or longer.
|
|
3703
|
+
* The angle between the edge and the ridge is 30 degrees or less.
|
|
3704
|
+
* The edge joins and leaves the ridge at the ends of that part. When two ridges hold one part of an edge, only the longer part rides.
|
|
3705
|
+
*/
|
|
3706
|
+
export declare function ridgeLines(input: HighwayInput, o: Readonly<RidgeOptions>): SnapLine[];
|
|
3707
|
+
/**
|
|
3708
|
+
* This function gives the highways of the ridges of the line density (HWY-032). One pass draws the density, with no advection.
|
|
3709
|
+
* The ridges of the density are the spines, and the edges near a ridge snap to it between their nearest entry and exit points.
|
|
3710
|
+
*/
|
|
3711
|
+
export declare function ridgePlan(input: HighwayInput, o: Readonly<RidgeOptions>): HighwayPlan;
|
|
3712
|
+
/** The options of the highway strategy `soft-keys` (HWY-019 of the note on highways). */
|
|
3713
|
+
interface SoftKeyOptions {
|
|
3714
|
+
/** The rule that gives the key of each edge. The default is `byCollection`: the string `data.collection`. */
|
|
3715
|
+
readonly rule: GroupRule;
|
|
3716
|
+
/** The distance that two different keys add. `Infinity` keeps the edges of two keys apart, as the hard keys do. The default is 0.25. */
|
|
3717
|
+
readonly lambda: number;
|
|
3718
|
+
/** Two clusters join while their distance is this value or less. The default is 0.5. */
|
|
3719
|
+
readonly tau: number;
|
|
3720
|
+
/** The names of number fields of `data` that add a distance. The default is no field. */
|
|
3721
|
+
readonly attributes: readonly string[];
|
|
3722
|
+
/** The weight of each field of `attributes`. The distance of a field is its difference over its range. The default is 1. */
|
|
3723
|
+
readonly weight: number;
|
|
3724
|
+
/** The linkage of the clustering. The default is `average`. */
|
|
3725
|
+
readonly linkage: Linkage;
|
|
3726
|
+
/** A cluster with this number of edges or more gets highways. The default is 2. */
|
|
3727
|
+
readonly minSize: number;
|
|
3728
|
+
/** The spine of each cluster. The default is `shared`: the router `shared` with the cluster as the key. */
|
|
3729
|
+
readonly spine: GroupSpine;
|
|
3730
|
+
}
|
|
3731
|
+
/** The default options of the strategy `soft-keys`. */
|
|
3732
|
+
export declare const SOFT_KEY_DEFAULTS: Readonly<SoftKeyOptions>;
|
|
3733
|
+
/**
|
|
3734
|
+
* This function gives the soft-key distance of two edges (Peysakhovich, Hurter and Telea 2015): `d = d_geom + lambda [key(e) != key(f)] + sum_a w |a(e) - a(f)| / range(a)`.
|
|
3735
|
+
* `d_geom` is the flow distance of HWY-023. The key term is 0 when an edge has no key.
|
|
3736
|
+
*/
|
|
3737
|
+
export declare function softDistance(geom: number, keyA: string | undefined, keyB: string | undefined, lambda: number, attributes: number): number;
|
|
3738
|
+
/**
|
|
3739
|
+
* This function gives the soft-key clusters of the edges (HWY-019). It clusters the edges with `softDistance`, with the cut at `tau`.
|
|
3740
|
+
* Each edge of a cluster gets the key of the cluster. It gets `flip` when it goes opposite to the first edge of the cluster.
|
|
3741
|
+
*/
|
|
3742
|
+
export declare function softKeyClusters(input: HighwayInput, o: Readonly<SoftKeyOptions>): Map<string, EdgeGroup>;
|
|
3743
|
+
/**
|
|
3744
|
+
* This function gives the highways of the soft keys (HWY-019). The key of an edge is one more term of the distance, not a hard split.
|
|
3745
|
+
* Edges of two keys still share a highway when they are very near, and edges of one key do not bundle when they are far.
|
|
3746
|
+
*/
|
|
3747
|
+
export declare function softKeyPlan(input: HighwayInput, o: Readonly<SoftKeyOptions>): HighwayPlan;
|
|
3748
|
+
/** The end of the edges that gets a field: the target of a fan-in, or the source of a fan-out. */
|
|
3749
|
+
type FieldEnd = "target" | "source";
|
|
3750
|
+
/** The options of the highway strategy `flow-field` (EDA-046 with HWY-037 of the notes). */
|
|
3751
|
+
interface FlowFieldOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
3752
|
+
/** An end with this number of edges or more on one side of its box gets a field. The default is 2. */
|
|
3753
|
+
readonly minFanIn: number;
|
|
3754
|
+
/** The end that gets a field. The default is `target`. */
|
|
3755
|
+
readonly end: FieldEnd;
|
|
3756
|
+
}
|
|
3757
|
+
/** The default options of the strategy `flow-field`. */
|
|
3758
|
+
export declare const FLOW_FIELD_DEFAULTS: Readonly<Required<Omit<FlowFieldOptions, "margin" | "k">>>;
|
|
3759
|
+
/**
|
|
3760
|
+
* This function gives the highways of a flow field for each target (EDA-046, HWY-037).
|
|
3761
|
+
* The edges into one side of one box make a fan. The root of the fan is the point out of the median plug of the fan.
|
|
3762
|
+
* Each edge of the fan goes the shortest way from the point out of its other plug to the root, through the corner graph.
|
|
3763
|
+
* The shortest ways to one root make a tree, so they merge like streams and do not cross. Each stretch that two ways share is one highway.
|
|
3764
|
+
* With the end `source`, the same holds for the edges out of one side of one box.
|
|
3765
|
+
*/
|
|
3766
|
+
export declare function flowFieldPlan(input: HighwayInput, o: Readonly<FlowFieldOptions>): HighwayPlan;
|
|
3014
3767
|
/** The options of the highway strategy `keys`: the options of the router `trunks`, without the name and the limit of the benchmark. */
|
|
3015
3768
|
type KeysOptions = Omit<TrunksOptions, "name" | "maxNodes">;
|
|
3016
3769
|
/**
|
|
@@ -3019,6 +3772,282 @@ type KeysOptions = Omit<TrunksOptions, "name" | "maxNodes">;
|
|
|
3019
3772
|
* Each trunk and each run becomes one highway. The function does not change the router: it reads its bundles and its runs.
|
|
3020
3773
|
*/
|
|
3021
3774
|
export declare function keysPlan(input: HighwayInput, options: KeysOptions): HighwayPlan;
|
|
3775
|
+
/**
|
|
3776
|
+
* The plan that a post step changes. `none` is the empty plan: `follow` then routes each edge as the router `corners` does.
|
|
3777
|
+
* `shared-ways` and `corridors` are the plans of those highway strategies, with their defaults.
|
|
3778
|
+
*/
|
|
3779
|
+
type HighwayBase = "none" | "shared-ways" | "corridors";
|
|
3780
|
+
/** The values of `HighwayBase`. */
|
|
3781
|
+
export declare const HIGHWAY_BASES: readonly HighwayBase[];
|
|
3782
|
+
/** This function gives the plan of a base. */
|
|
3783
|
+
export declare function basePlan(input: HighwayInput, base: HighwayBase): HighwayPlan;
|
|
3784
|
+
/** The options of the highway strategy `level-links` (HWY-056 with WILD-034 of the notes). */
|
|
3785
|
+
interface LevelHighwayOptions {
|
|
3786
|
+
/** The plan of the edges that do not ride a level link. The default is `shared-ways`. */
|
|
3787
|
+
readonly from: HighwayBase;
|
|
3788
|
+
/** The depth of the level in the tree of sections. Depth 1 is the level below the root. The default is 1. */
|
|
3789
|
+
readonly depth: number;
|
|
3790
|
+
/** A level link becomes a highway when this number of edges or more ride it. The default is 2. */
|
|
3791
|
+
readonly minSize: number;
|
|
3792
|
+
/** An edge rides the link only when its way along the link is this many times its first route, or shorter. The default is 1.5. */
|
|
3793
|
+
readonly stretch: number;
|
|
3794
|
+
}
|
|
3795
|
+
/** The default options of the strategy `level-links`. */
|
|
3796
|
+
export declare const LEVEL_HIGHWAY_DEFAULTS: Readonly<LevelHighwayOptions>;
|
|
3797
|
+
/**
|
|
3798
|
+
* This function gives a highway for each link of a zoom level, with the edges between its two items (HWY-056, WILD-034).
|
|
3799
|
+
* The level is the cut of the tree of sections at `depth`. The link goes around the boxes of the other items (`levelLinks`).
|
|
3800
|
+
* The spine is the link without a margin at each end, so it stays off the boxes of the two items. It must stay out of each box.
|
|
3801
|
+
* The edges between the two items, in each direction, ride the spine. The ramps go through the corner graph inside the items.
|
|
3802
|
+
*
|
|
3803
|
+
* An edge rides only when the ramps (as straight lines) and the spine are `stretch` times its first route, or shorter.
|
|
3804
|
+
* A link with fewer than `minSize` such edges is not a highway. The other edges keep their highways of the plan `from`.
|
|
3805
|
+
* Thus a zoom from the level to the routes shows the same lines, which open into lanes.
|
|
3806
|
+
*/
|
|
3807
|
+
export declare function levelHighwayPlan(input: HighwayInput, o: Readonly<LevelHighwayOptions>): HighwayPlan;
|
|
3808
|
+
/** The options of the highway strategy `meet` (HWY-050 of the note on highways). */
|
|
3809
|
+
interface MeetOptions {
|
|
3810
|
+
/** The plan whose merge points and split points the strategy moves. The default is `shared-ways`. */
|
|
3811
|
+
readonly from: HighwayBase;
|
|
3812
|
+
/** A first route meets the spine where it is this distance from the spine, or nearer. The default is 8: two lanes of 4. */
|
|
3813
|
+
readonly near: number;
|
|
3814
|
+
/** A first route meets the spine only where it runs at this angle to the spine, or less, in degrees. The default is 45. */
|
|
3815
|
+
readonly maxTurn: number;
|
|
3816
|
+
/** A member keeps its places when the stretch where its first route meets the spine is shorter than this length. The default is 10. */
|
|
3817
|
+
readonly minRun: number;
|
|
3818
|
+
}
|
|
3819
|
+
/** The default options of the strategy `meet`. */
|
|
3820
|
+
export declare const MEET_DEFAULTS: Readonly<MeetOptions>;
|
|
3821
|
+
/**
|
|
3822
|
+
* This function gives a member with its merge point and its split point where its first route meets the spine and parts from it (HWY-050).
|
|
3823
|
+
* The function samples the stretch of the member on the spine, at steps of `near / 2` or less.
|
|
3824
|
+
* A sample meets the route when the route is `near` or nearer, and its nearest leg runs at `maxTurn` or less to the spine.
|
|
3825
|
+
* The new merge point is the first sample that meets the route, in the direction of the member. The new split point is the last one.
|
|
3826
|
+
* So the edge joins the spine late and leaves it early. The places only move inward.
|
|
3827
|
+
* The member keeps its places when no sample meets the route, or when the met stretch is shorter than `minRun`.
|
|
3828
|
+
*/
|
|
3829
|
+
export declare function meetMember(spine: readonly Point[], member: HighwayMember, route: readonly Point[] | undefined, o: Readonly<MeetOptions>): HighwayMember;
|
|
3830
|
+
/**
|
|
3831
|
+
* This function gives the highways of the plan `from`, with merge points and split points where the routes meet and part (HWY-050).
|
|
3832
|
+
* The first route of each edge is the route of `input.routes`, or its route without highways.
|
|
3833
|
+
* Each member gets the places of `meetMember`. The spines and the trips do not change.
|
|
3834
|
+
*/
|
|
3835
|
+
export declare function meetPlan(input: HighwayInput, o: Readonly<MeetOptions>): HighwayPlan;
|
|
3836
|
+
/** The options of the highway strategy `mingle` (HWY-003 of the note on highways). */
|
|
3837
|
+
interface MingleOptions {
|
|
3838
|
+
/** Each bundle looks for a merge among this number of nearest bundles in 4D. The default is 8. */
|
|
3839
|
+
readonly k: number;
|
|
3840
|
+
/** The largest turn of an edge at a meeting point, in degrees. A larger turn moves the meeting point along the trunk. The default is 40. */
|
|
3841
|
+
readonly maxTurn: number;
|
|
3842
|
+
/** The number of levels of merges. The default is 6. */
|
|
3843
|
+
readonly levels: number;
|
|
3844
|
+
/** The weight of the trunk in the ink. With 1, the trunk costs its length one time. The default is 1. */
|
|
3845
|
+
readonly weight: number;
|
|
3846
|
+
/** A bundle with this number of edges or more gets highways. The default is 2. */
|
|
3847
|
+
readonly minSize: number;
|
|
3848
|
+
/** The spine of each bundle. The default is `trunk`: one trunk between the two meeting points. */
|
|
3849
|
+
readonly spine: GroupSpine;
|
|
3850
|
+
}
|
|
3851
|
+
/** The default options of the strategy `mingle`. */
|
|
3852
|
+
export declare const MINGLE_DEFAULTS: Readonly<MingleOptions>;
|
|
3853
|
+
/**
|
|
3854
|
+
* This function gives the bundles of MINGLE (Gansner, Hu, North and Scheidegger 2011) as groups of edges.
|
|
3855
|
+
* Each edge is a point in 4D: its two plugs. At each level, each bundle examines its `k` nearest bundles in 4D.
|
|
3856
|
+
* A merge saves ink when the ink of the joint bundle is less than the sum of the two inks. The merges with the largest gain go first.
|
|
3857
|
+
* A bundle merges one time at most in a level. The levels stop after `levels` levels, or when no merge saves ink.
|
|
3858
|
+
*/
|
|
3859
|
+
export declare function mingleBundles(input: HighwayInput, o: Readonly<MingleOptions>): Map<string, EdgeGroup>;
|
|
3860
|
+
/**
|
|
3861
|
+
* This function gives the highways of MINGLE (HWY-003). The bundles of `mingleBundles` with `minSize` edges or more get highways.
|
|
3862
|
+
* With the spine `trunk`, each bundle gets one trunk between its two meeting points, through the corner graph.
|
|
3863
|
+
* With `shared`, the edges of each bundle share their ways through the corner graph.
|
|
3864
|
+
*/
|
|
3865
|
+
export declare function minglePlan(input: HighwayInput, o: Readonly<MingleOptions>): HighwayPlan;
|
|
3866
|
+
/** The options of the highway strategy `od-cells` (EDA-033 with WILD-032 of the notes). */
|
|
3867
|
+
interface OdCellOptions {
|
|
3868
|
+
/** The depth of the cells in the tree of sections. Depth 1 is the level below the root. The default is 2. */
|
|
3869
|
+
readonly level: number;
|
|
3870
|
+
/** A pair of cells with this number of edges or more gets a trunk. The default is 3. */
|
|
3871
|
+
readonly minGroup: number;
|
|
3872
|
+
/** An edge rides the trunk only when each of its legs is this share of the span or shorter. The default is 0.3. */
|
|
3873
|
+
readonly legMax: number;
|
|
3874
|
+
/** The spine of each pair of cells. The default is `trunk`. */
|
|
3875
|
+
readonly spine: GroupSpine;
|
|
3876
|
+
}
|
|
3877
|
+
/** The default options of the strategy `od-cells`. */
|
|
3878
|
+
export declare const OD_CELL_DEFAULTS: Readonly<OdCellOptions>;
|
|
3879
|
+
/**
|
|
3880
|
+
* This function gives the groups of the edges by the pair of the cells of their two nodes (EDA-033, WILD-032).
|
|
3881
|
+
* The cells are the items of the zoom level at the depth `level`. The edges of one pair of cells, in either direction, are one group.
|
|
3882
|
+
* An edge inside one cell is in no group.
|
|
3883
|
+
*/
|
|
3884
|
+
export declare function odGroups(input: HighwayInput, o: Readonly<OdCellOptions>): Map<string, EdgeGroup>;
|
|
3885
|
+
/**
|
|
3886
|
+
* This function gives the highways of the consolidation by origin and destination cells (EDA-033, WILD-032).
|
|
3887
|
+
* Carriers merge the loads from one region to another into one truck between two terminals. Thus each pair of cells with `minGroup` edges or more gets one trunk.
|
|
3888
|
+
* The terminals are the Weber points of the plugs in each cell. An edge with a leg longer than `legMax` times the span goes alone.
|
|
3889
|
+
*/
|
|
3890
|
+
export declare function odCellPlan(input: HighwayInput, o: Readonly<OdCellOptions>): HighwayPlan;
|
|
3891
|
+
/** The line of each edge that QuickBundles compares: its first route, or the straight line between its plugs. */
|
|
3892
|
+
type BundleLine = "routes" | "lines";
|
|
3893
|
+
/** The order of the edges in the one pass: the order of the graph, or the longest line first. */
|
|
3894
|
+
type BundleOrder = "input" | "length";
|
|
3895
|
+
/** The options of the highway strategy `quickbundles` (HWY-026 of the note on highways). */
|
|
3896
|
+
interface QuickBundlesOptions {
|
|
3897
|
+
/** An edge joins a cluster when its distance to the centroid is this value or less, in units of the board. The default is 3. */
|
|
3898
|
+
readonly theta: number;
|
|
3899
|
+
/** The number of points of each line after the resampling. The default is 12. */
|
|
3900
|
+
readonly points: number;
|
|
3901
|
+
/** The line of each edge. The default is `routes`. */
|
|
3902
|
+
readonly line: BundleLine;
|
|
3903
|
+
/** The order of the edges. The default is `input`, so an added edge does not change the clusters before it. */
|
|
3904
|
+
readonly order: BundleOrder;
|
|
3905
|
+
/** A cluster with this number of edges or more gets highways. The default is 2. */
|
|
3906
|
+
readonly minSize: number;
|
|
3907
|
+
/** The spine of each cluster. The default is `shared`. */
|
|
3908
|
+
readonly spine: GroupSpine;
|
|
3909
|
+
}
|
|
3910
|
+
/** The default options of the strategy `quickbundles`. */
|
|
3911
|
+
export declare const QUICKBUNDLES_DEFAULTS: Readonly<QuickBundlesOptions>;
|
|
3912
|
+
/** This function gives `k` points at equal steps of length along a polyline, from its first point to its last point. */
|
|
3913
|
+
export declare function resample(line: readonly Point[], k: number): Point[];
|
|
3914
|
+
/**
|
|
3915
|
+
* This function gives the MDF distance of two lines with the same number of points. It is the mean distance of their points.
|
|
3916
|
+
* The function compares the points in the same direction and in the opposite direction, and keeps the smaller mean.
|
|
3917
|
+
* `flip` is `true` when the opposite direction is smaller.
|
|
3918
|
+
*/
|
|
3919
|
+
export declare function mdf(p: readonly Point[], q: readonly Point[]): {
|
|
3920
|
+
d: number;
|
|
3921
|
+
flip: boolean;
|
|
3922
|
+
};
|
|
3923
|
+
/**
|
|
3924
|
+
* This function gives the clusters of QuickBundles (Garyfallidis 2012) as groups of edges.
|
|
3925
|
+
* In one pass, each edge joins the cluster with the nearest centroid when the MDF distance is `theta` units or less. Else it starts a cluster.
|
|
3926
|
+
* The centroid is the running mean of the lines of the cluster, each in the direction of the centroid.
|
|
3927
|
+
*/
|
|
3928
|
+
export declare function quickBundles(input: HighwayInput, o: Readonly<QuickBundlesOptions>): Map<string, EdgeGroup>;
|
|
3929
|
+
/**
|
|
3930
|
+
* This function gives the highways of QuickBundles (HWY-026). The clusters of `quickBundles` with `minSize` edges or more get highways.
|
|
3931
|
+
* With the spine `shared`, the edges of each cluster share their ways through the corner graph. With `trunk`, each cluster gets one trunk.
|
|
3932
|
+
*/
|
|
3933
|
+
export declare function quickBundlesPlan(input: HighwayInput, o: Readonly<QuickBundlesOptions>): HighwayPlan;
|
|
3934
|
+
/** The options of the highway strategy `nested` (HWY-052 of the note on highways). */
|
|
3935
|
+
interface NestedOptions {
|
|
3936
|
+
/** The scale of the closest level, in units of the board. An edge joins a cluster when its distance to the centroid is this value or less. The default is 3. */
|
|
3937
|
+
readonly theta: number;
|
|
3938
|
+
/** The scale of each level is this value times the scale of the next closer level. The default is 2. */
|
|
3939
|
+
readonly ratio: number;
|
|
3940
|
+
/** The number of levels. The default is 3. */
|
|
3941
|
+
readonly levels: number;
|
|
3942
|
+
/** The level of the plan. Level 0 is the closest level, and level `levels - 1` is the far level. The default is 0. */
|
|
3943
|
+
readonly level: number;
|
|
3944
|
+
/** The number of points of each line after the resampling. The default is 12. */
|
|
3945
|
+
readonly points: number;
|
|
3946
|
+
/** The line of each edge. The default is `routes`. */
|
|
3947
|
+
readonly line: BundleLine;
|
|
3948
|
+
/** The order of the edges. The default is `input`. */
|
|
3949
|
+
readonly order: BundleOrder;
|
|
3950
|
+
/** A cluster with this number of edges or more gets highways. The default is 2. */
|
|
3951
|
+
readonly minSize: number;
|
|
3952
|
+
/** The spine of each cluster. The default is `shared`. */
|
|
3953
|
+
readonly spine: GroupSpine;
|
|
3954
|
+
}
|
|
3955
|
+
/** The default options of the strategy `nested`. */
|
|
3956
|
+
export declare const NESTED_DEFAULTS: Readonly<NestedOptions>;
|
|
3957
|
+
/**
|
|
3958
|
+
* This function gives the groups of edges of each level, from the closest level (index 0) to the far level.
|
|
3959
|
+
* The far level puts all the edges in clusters at the scale `theta × ratio^(levels - 1)`.
|
|
3960
|
+
* Each closer level puts the edges of each cluster of the level above in clusters, at its own scale. Thus each group of a level is in one group of the level above.
|
|
3961
|
+
*/
|
|
3962
|
+
export declare function nestedGroups(input: HighwayInput, o: Readonly<NestedOptions>): Map<string, EdgeGroup>[];
|
|
3963
|
+
/**
|
|
3964
|
+
* This function gives the number of groups of the closer level `fine` with edges in two groups or more of the level `coarse`.
|
|
3965
|
+
* An edge that is not in `coarse` does not count. The groups of `nestedGroups` give 0.
|
|
3966
|
+
*/
|
|
3967
|
+
export declare function nestingViolations(coarse: ReadonlyMap<string, EdgeGroup>, fine: ReadonlyMap<string, EdgeGroup>): number;
|
|
3968
|
+
/**
|
|
3969
|
+
* This function gives the highways of one level of the nested clusters (HWY-052). The level is `o.level`, with 0 as the closest level.
|
|
3970
|
+
* The clusters of that level with `minSize` edges or more get highways, as in the strategy `quickbundles`.
|
|
3971
|
+
*/
|
|
3972
|
+
export declare function nestedPlan(input: HighwayInput, o: Readonly<NestedOptions>): HighwayPlan;
|
|
3973
|
+
/** The options of the highway strategy `lanes` (HWY-051 of the note on highways). */
|
|
3974
|
+
interface LanesOptions {
|
|
3975
|
+
/** The distance from a box to the corners of the graph. The default is 5. */
|
|
3976
|
+
readonly margin?: number;
|
|
3977
|
+
/** The number of visible neighbours of each corner. The default is 8. */
|
|
3978
|
+
readonly k?: number;
|
|
3979
|
+
/** The plan that the strategy changes. The default is `shared-ways`. */
|
|
3980
|
+
readonly from: HighwayBase;
|
|
3981
|
+
/** The gap between two lanes. The default is 4. */
|
|
3982
|
+
readonly laneGap: number;
|
|
3983
|
+
/** The largest width of a highway. The default is 32. */
|
|
3984
|
+
readonly maxWidth: number;
|
|
3985
|
+
/** The number of times that a highway can split, one half after the other. The default is 3. */
|
|
3986
|
+
readonly depth: number;
|
|
3987
|
+
}
|
|
3988
|
+
/** The default options of the strategy `lanes`. */
|
|
3989
|
+
export declare const LANES_DEFAULTS: Readonly<LanesOptions>;
|
|
3990
|
+
/**
|
|
3991
|
+
* This function gives the number of legs of the spines of a plan where the lanes do not fit in the channel.
|
|
3992
|
+
* A leg with two lanes or more needs `min(maxWidth, lanes × laneGap)`. The channel is the free space across the leg (`channelWidth`).
|
|
3993
|
+
*/
|
|
3994
|
+
export declare function channelOverflows(graph: Graph, plan: HighwayPlan, o: Readonly<Pick<LanesOptions, "laneGap" | "maxWidth" | "margin" | "k">>): number;
|
|
3995
|
+
/**
|
|
3996
|
+
* This function gives the plan of `from`, with each highway that does not fit in its channels split in two (HWY-051).
|
|
3997
|
+
* The lanes split into two halves by lane order. The first half keeps the spine. The second half gets a new spine through the corners, where the narrow links cost more.
|
|
3998
|
+
* A highway with fewer than four lanes moves as one to the new spine.
|
|
3999
|
+
* A half that still does not fit splits again, up to `depth` times. A new spine needs a shorter length of narrow legs than the old spine.
|
|
4000
|
+
*/
|
|
4001
|
+
export declare function lanesPlan(input: HighwayInput, o: Readonly<LanesOptions>): HighwayPlan;
|
|
4002
|
+
/** The order of the edges in the growth: the longest first route first, or the order of the graph. */
|
|
4003
|
+
type GrowthOrder = "length" | "input";
|
|
4004
|
+
/** The options of the highway strategy `growth` (HWY-055 of the note on highways). */
|
|
4005
|
+
interface GrowthOptions {
|
|
4006
|
+
/** The distance from a box to the corners of the graph. The default is 5. */
|
|
4007
|
+
readonly margin?: number;
|
|
4008
|
+
/** The number of visible neighbours of each corner. The default is 8. */
|
|
4009
|
+
readonly k?: number;
|
|
4010
|
+
/** The order of the edges. The default is `length`. */
|
|
4011
|
+
readonly order: GrowthOrder;
|
|
4012
|
+
/** The cost of the part on a spine, as a share of its length. The ramps cost their full length. The default is 0.5. */
|
|
4013
|
+
readonly share: number;
|
|
4014
|
+
/** An edge joins a highway only when its way along it is this value times its first route or shorter. The default is 1.3. */
|
|
4015
|
+
readonly stretch: number;
|
|
4016
|
+
/** A spine end extends when this number of its lanes or more go on together. The default is 3. */
|
|
4017
|
+
readonly extendLanes: number;
|
|
4018
|
+
/** The lanes go on together when their ends are this distance from their center or nearer, in units of the board. The default is 2. */
|
|
4019
|
+
readonly extendRadius: number;
|
|
4020
|
+
/** A highway with this number of edges or more stays in the plan. The default is 2. */
|
|
4021
|
+
readonly minSize: number;
|
|
4022
|
+
}
|
|
4023
|
+
/** The default options of the strategy `growth`. */
|
|
4024
|
+
export declare const GROWTH_DEFAULTS: Readonly<GrowthOptions>;
|
|
4025
|
+
/**
|
|
4026
|
+
* This function gives the highways of local growth (HWY-055). The edges come one by one, by default the longest first route first.
|
|
4027
|
+
* Each edge joins the highway with the largest saving: its first route less its ramps and `share` of its part on the spine. Without a saving, the edge starts a highway on its own way.
|
|
4028
|
+
* After the growth, a spine end can go on to the center of the far ends of its lanes.
|
|
4029
|
+
* This occurs when `extendLanes` of them or more are near that center and the line is clear.
|
|
4030
|
+
*/
|
|
4031
|
+
export declare function growthPlan(input: HighwayInput, o: Readonly<GrowthOptions>): HighwayPlan;
|
|
4032
|
+
/** The options of the highway strategy `road-classes` (HWY-034 with EDA-050 of the notes). */
|
|
4033
|
+
interface RoadClassOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
4034
|
+
/** A link is a highway link when its use is at this quantile of the use of the links, or higher. The default is 0.9. */
|
|
4035
|
+
readonly quantile: number;
|
|
4036
|
+
/** A highway link has this number of edges or more on it, and a highway has this number of edges or more. The default is 2. */
|
|
4037
|
+
readonly minSize: number;
|
|
4038
|
+
/** The second pass gives each highway link this discount, as a share of its length. The default is 0.5. */
|
|
4039
|
+
readonly discount: number;
|
|
4040
|
+
}
|
|
4041
|
+
/** The default options of the strategy `road-classes`. */
|
|
4042
|
+
export declare const ROAD_CLASS_DEFAULTS: Readonly<Required<Omit<RoadClassOptions, "margin" | "k">>>;
|
|
4043
|
+
/**
|
|
4044
|
+
* This function gives the highways of the road classes (HWY-034, EDA-050). It counts how many first ways use each link of the corner graph.
|
|
4045
|
+
* The links with a use at the quantile `quantile` or higher, and at least `minSize`, are the highway links.
|
|
4046
|
+
* They are the main roads of a road map.
|
|
4047
|
+
* A second pass routes each edge again, with the discount on the highway links, so more edges join them.
|
|
4048
|
+
* Each stretch of highway links that `minSize` ways or more share after the second pass is one highway.
|
|
4049
|
+
*/
|
|
4050
|
+
export declare function roadClassPlan(input: HighwayInput, o: Readonly<RoadClassOptions>): HighwayPlan;
|
|
3022
4051
|
/** The options of the highway strategy `shared-ways`: the options of the router `shared`, without the name and the limit of the benchmark. */
|
|
3023
4052
|
type SharedWaysOptions = Omit<SharedOptions, "name" | "maxNodes">;
|
|
3024
4053
|
/**
|
|
@@ -3027,6 +4056,273 @@ type SharedWaysOptions = Omit<SharedOptions, "name" | "maxNodes">;
|
|
|
3027
4056
|
* The function does not change the router: it reads its runs.
|
|
3028
4057
|
*/
|
|
3029
4058
|
export declare function sharedWaysPlan(input: HighwayInput, options: SharedWaysOptions): HighwayPlan;
|
|
4059
|
+
/** The options of the highway strategy `spiral` (HWY-017 with EDA-035 of the notes). */
|
|
4060
|
+
interface SpiralOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
4061
|
+
/** The spiral angle, in degrees: the largest angle between a branch and the line to the root. The default is 25. */
|
|
4062
|
+
readonly alpha: number;
|
|
4063
|
+
/** A node with this number of edges or more gets a spiral tree. The default is 4. */
|
|
4064
|
+
readonly minTargets: number;
|
|
4065
|
+
/** The number of points of the arc of each branch. The default is 4. */
|
|
4066
|
+
readonly arc: number;
|
|
4067
|
+
}
|
|
4068
|
+
/** The default options of the strategy `spiral`. */
|
|
4069
|
+
export declare const SPIRAL_DEFAULTS: Readonly<Required<Omit<SpiralOptions, "margin" | "k">>>;
|
|
4070
|
+
/** One node of a spiral tree, in polar coordinates around the root. A leaf has an edge, and a join has two children. */
|
|
4071
|
+
interface SpiralNode {
|
|
4072
|
+
readonly r: number;
|
|
4073
|
+
readonly theta: number;
|
|
4074
|
+
readonly point: Point;
|
|
4075
|
+
/** A join with this node is this distance or more nearer to the root than the node. A leaf keeps its box clear so. A join has 0. */
|
|
4076
|
+
readonly clear: number;
|
|
4077
|
+
readonly edge?: string;
|
|
4078
|
+
readonly children: readonly SpiralNode[];
|
|
4079
|
+
}
|
|
4080
|
+
/**
|
|
4081
|
+
* This function gives the join of the nodes `p` and `q` of a spiral tree with the angle `alpha`. It gives `undefined` when no join is possible.
|
|
4082
|
+
* Each node can reach the points inside its two spirals toward the root: `|theta - theta_p| <= tan(alpha) ln(r_p / r)`.
|
|
4083
|
+
* The join is the point farthest from the root that both nodes reach, and that is `clear` nearer to the root than each node.
|
|
4084
|
+
* At that radius, the join is at the middle of the angles that both nodes reach.
|
|
4085
|
+
*/
|
|
4086
|
+
export declare function spiralJoin(p: SpiralNode, q: SpiralNode, alpha: number, root: Point): {
|
|
4087
|
+
r: number;
|
|
4088
|
+
theta: number;
|
|
4089
|
+
point: Point;
|
|
4090
|
+
} | undefined;
|
|
4091
|
+
/**
|
|
4092
|
+
* This function gives the spiral tree of the leaves around the root (Buchin, Speckmann and Verbeek 2011), with the greedy sweep.
|
|
4093
|
+
* The sweep goes from the far leaves to the root. A leaf joins the wavefront at its radius. Two nodes that are next to each other in angle join at their join point.
|
|
4094
|
+
* The join with the largest radius goes first. No join occurs below the radius `rMin`. The function gives the nodes of the wavefront at the end.
|
|
4095
|
+
*/
|
|
4096
|
+
export declare function spiralTree(leaves: readonly SpiralNode[], alpha: number, root: Point, rMin: number): SpiralNode[];
|
|
4097
|
+
/**
|
|
4098
|
+
* This function gives the highways of the spiral trees (HWY-017, EDA-035). Each node with `minTargets` edges or more is the root of a fan.
|
|
4099
|
+
* The nodes with more edges go first, and each edge is in one fan at most. The far plug of each edge is a leaf of the tree of its fan.
|
|
4100
|
+
* Each branch of a tree with two leaves or more is a highway. Its spine is an arc of a logarithmic spiral, or a way through the corner graph where the arc hits a box.
|
|
4101
|
+
* An edge rides the branches from the root to its leaf, or from its leaf to the root when the root is its target.
|
|
4102
|
+
*/
|
|
4103
|
+
export declare function spiralPlan(input: HighwayInput, o: Readonly<SpiralOptions>): HighwayPlan;
|
|
4104
|
+
/** The ends of the edges that get stubs: the source ends, the target ends, or both. */
|
|
4105
|
+
type StubEnds = "source" | "target" | "both";
|
|
4106
|
+
/** The options of the highway strategy `stubs` (HWY-015 with WILD-005 of the notes). */
|
|
4107
|
+
interface StubOptions {
|
|
4108
|
+
/** The plan that the stubs go into. The default is `shared-ways`. */
|
|
4109
|
+
readonly from: HighwayBase;
|
|
4110
|
+
/** The ends of one side of a box whose directions are in a window of this angle share a stub, in degrees. The default is 30. */
|
|
4111
|
+
readonly omega: number;
|
|
4112
|
+
/** The length of a stub is this share of the distance to the nearest other end. The default is 0.25. */
|
|
4113
|
+
readonly sigma: number;
|
|
4114
|
+
/** The ends that get stubs. The default is `both`. */
|
|
4115
|
+
readonly ends: StubEnds;
|
|
4116
|
+
/** A stub has this number of edges or more. The default is 2. */
|
|
4117
|
+
readonly minSize: number;
|
|
4118
|
+
}
|
|
4119
|
+
/** The default options of the strategy `stubs`. */
|
|
4120
|
+
export declare const STUB_DEFAULTS: Readonly<StubOptions>;
|
|
4121
|
+
/**
|
|
4122
|
+
* This function gives the highways of the plan `from`, with a stub at the ends of the edges (HWY-015, WILD-005).
|
|
4123
|
+
* The ends on one side of one box are sorted by the direction of their other node. A run of ends in a window of `omega` makes a group.
|
|
4124
|
+
* Each group of `minSize` ends or more shares one plug and one stub along the normal of the side. Then the edges fan out.
|
|
4125
|
+
*
|
|
4126
|
+
* The length of the stub is `sigma` times the distance to the nearest other node, and half that distance at most.
|
|
4127
|
+
* It is two times the margin of the way finder at least, and the stub stays out of the other boxes. Else the group gets no stub.
|
|
4128
|
+
* An end with a fixed plug or a side of its own gets no stub. An end whose first highway starts on its box, or near it, keeps the plan.
|
|
4129
|
+
*/
|
|
4130
|
+
export declare function stubPlan(input: HighwayInput, o: Readonly<StubOptions>): HighwayPlan;
|
|
4131
|
+
/** The options of the highway strategy `traclus` (HWY-025 of the note on highways). */
|
|
4132
|
+
interface TraclusOptions extends Pick<WayOptions, "margin" | "k"> {
|
|
4133
|
+
/** Two segments are neighbours when their distance is this value or less, in units of the board. The default is 2. */
|
|
4134
|
+
readonly eps: number;
|
|
4135
|
+
/** A cluster has segments of this number of edges or more, and a core segment has this number of neighbours or more. The default is 3. */
|
|
4136
|
+
readonly minLns: number;
|
|
4137
|
+
/** The weight of the perpendicular distance. The default is 1. */
|
|
4138
|
+
readonly wPerp: number;
|
|
4139
|
+
/** The weight of the parallel distance. The default is 1. */
|
|
4140
|
+
readonly wPar: number;
|
|
4141
|
+
/** The weight of the angle distance. The default is 1. */
|
|
4142
|
+
readonly wTheta: number;
|
|
4143
|
+
/** A route keeps a corner when the cost of the line without it is more than this value times the cost with it. The default is 1. */
|
|
4144
|
+
readonly mdl: number;
|
|
4145
|
+
}
|
|
4146
|
+
/** The default options of the strategy `traclus`. */
|
|
4147
|
+
export declare const TRACLUS_DEFAULTS: Readonly<Required<Omit<TraclusOptions, "margin" | "k">>>;
|
|
4148
|
+
/** One segment of a partitioned route: the edge, the index of the segment in the route, and its two ends. */
|
|
4149
|
+
interface RouteSegment {
|
|
4150
|
+
readonly edge: string;
|
|
4151
|
+
readonly index: number;
|
|
4152
|
+
readonly a: Point;
|
|
4153
|
+
readonly b: Point;
|
|
4154
|
+
}
|
|
4155
|
+
/**
|
|
4156
|
+
* This function gives the TRACLUS distance of two segments (Lee, Han and Whang 2007): `w_perp d_perp + w_par d_par + w_theta d_theta`.
|
|
4157
|
+
* `d_perp` is `(l1² + l2²) / (l1 + l2)` with the distances of the ends of the shorter segment to the line of the longer segment.
|
|
4158
|
+
* `d_par` is the gap along the longer segment between the two segments, 0 when they overlap. `d_theta` is `|shorter| sin(theta)`.
|
|
4159
|
+
* The segments have no direction, so the angle is 90 degrees or less.
|
|
4160
|
+
*/
|
|
4161
|
+
export declare function segmentDistance(p: {
|
|
4162
|
+
a: Point;
|
|
4163
|
+
b: Point;
|
|
4164
|
+
}, q: {
|
|
4165
|
+
a: Point;
|
|
4166
|
+
b: Point;
|
|
4167
|
+
}, w: {
|
|
4168
|
+
perp: number;
|
|
4169
|
+
par: number;
|
|
4170
|
+
theta: number;
|
|
4171
|
+
}): number;
|
|
4172
|
+
/**
|
|
4173
|
+
* This function gives the characteristic points of a route by the rule of the minimum description length (MDL) of TRACLUS.
|
|
4174
|
+
* A partition from point `i` to point `j` costs `L(H) + L(D|H)`. `L(H)` is the log of its length, and `L(D|H)` the logs of the perpendicular and angle distances of the route parts.
|
|
4175
|
+
* The route keeps the point before `j` when that cost is more than `ratio` times the cost of the route parts. The lengths are in units of the board.
|
|
4176
|
+
*/
|
|
4177
|
+
export declare function characteristicPoints(route: readonly Point[], unit: number, ratio: number): Point[];
|
|
4178
|
+
/**
|
|
4179
|
+
* This function gives the clusters of segments of DBSCAN. A segment with `minLns` neighbours or more within `eps` (itself included) is a core segment.
|
|
4180
|
+
* A cluster grows from each core segment through its neighbours. A cluster with segments of fewer than `minLns` edges is dropped.
|
|
4181
|
+
*/
|
|
4182
|
+
export declare function segmentClusters(segments: readonly RouteSegment[], eps: number, minLns: number, w: {
|
|
4183
|
+
perp: number;
|
|
4184
|
+
par: number;
|
|
4185
|
+
theta: number;
|
|
4186
|
+
}): RouteSegment[][];
|
|
4187
|
+
/**
|
|
4188
|
+
* This function gives the representative line of a cluster of segments. The line goes along the mean direction of the segments.
|
|
4189
|
+
* A sweep along that direction stops at each end of a segment. Where `minLns` segments or more cover the stop, the point is the mean of their points there.
|
|
4190
|
+
* Two points of the line are at least `gap` apart.
|
|
4191
|
+
*/
|
|
4192
|
+
export declare function representative(cluster: readonly RouteSegment[], minLns: number, gap: number): Point[];
|
|
4193
|
+
/**
|
|
4194
|
+
* This function gives the highways of TRACLUS (HWY-025). Each first route breaks into a few long segments by the rule of MDL.
|
|
4195
|
+
* DBSCAN puts the segments that are near in distance and angle into clusters. Each cluster with segments of `minLns` edges or more is one highway.
|
|
4196
|
+
* The spine is the representative line of the cluster, or a way through the corner graph between its ends when the line hits a box.
|
|
4197
|
+
* Each edge of the cluster joins the spine nearest to the first end of its segments. It leaves the spine nearest to the last end.
|
|
4198
|
+
* An edge rides only when both ends of its part are within `eps` of the spine.
|
|
4199
|
+
* Its length on the spine is also at most 1.25 times the length of its own route there.
|
|
4200
|
+
* Each edge rides one highway at most: the highway where it rides the longest length.
|
|
4201
|
+
*/
|
|
4202
|
+
export declare function traclusPlan(input: HighwayInput, o: Readonly<TraclusOptions>): HighwayPlan;
|
|
4203
|
+
/** The options of the highway strategy `weiszfeld` (HWY-043 of the note on highways). */
|
|
4204
|
+
interface WeiszfeldOptions {
|
|
4205
|
+
/** The plan whose highways get new meeting points. The default is `shared-ways`. */
|
|
4206
|
+
readonly from: HighwayBase;
|
|
4207
|
+
/** The weight of the trunk is `k^alpha` for `k` members. With 0, the trunk costs its ink one time. With 1, it costs each lane. The default is 0.5. */
|
|
4208
|
+
readonly alpha: number;
|
|
4209
|
+
/** The number of steps of Weiszfeld. The default is 20. */
|
|
4210
|
+
readonly steps: number;
|
|
4211
|
+
}
|
|
4212
|
+
/** The default options of the strategy `weiszfeld`. */
|
|
4213
|
+
export declare const WEISZFELD_DEFAULTS: Readonly<WeiszfeldOptions>;
|
|
4214
|
+
/**
|
|
4215
|
+
* This function gives the meeting points `M1` and `M2` of a bundle with the least weighted ink (HWY-043):
|
|
4216
|
+
* `Σ |a_i - M1| + w |M1 - M2| + Σ |M2 - b_i|`. The lists `a` and `b` are the ends of the edges on each side, and `w` is the weight of the trunk.
|
|
4217
|
+
* The function starts at the means of `a` and `b`. Each step moves `M1` and then `M2` by one step of Weiszfeld.
|
|
4218
|
+
*/
|
|
4219
|
+
export declare function meetingPoints(a: readonly Point[], b: readonly Point[], w: number, steps: number): [Point, Point];
|
|
4220
|
+
/**
|
|
4221
|
+
* This function gives the highways of the plan `from`, with the meeting points of Weiszfeld (HWY-043).
|
|
4222
|
+
* The ends of a member are the points where its edge comes to the highway and goes away from it after `follow` of the plan.
|
|
4223
|
+
* They are the plugs, or the split point of the highway before and the merge point of the highway after.
|
|
4224
|
+
* The weight of the trunk is `k^alpha` for `k` members. The trunk stays on the spine: the function projects `M1` and `M2` on the spine.
|
|
4225
|
+
* Each member then joins the spine at `M1` and leaves it at `M2`, but not outside its own stretch. So a member only gets shorter on the spine.
|
|
4226
|
+
*/
|
|
4227
|
+
export declare function weiszfeldPlan(input: HighwayInput, o: Readonly<WeiszfeldOptions>): HighwayPlan;
|
|
4228
|
+
/** The options of the highway strategy `wspd` (HWY-018 of the note on highways). */
|
|
4229
|
+
interface WspdOptions {
|
|
4230
|
+
/** The separation `s` of the pairs: the gap between two sets is at least `s` times the radius of the larger set. The default is 2. */
|
|
4231
|
+
readonly separation: number;
|
|
4232
|
+
/** A pair with this number of edges or more gets a highway. The default is 3. */
|
|
4233
|
+
readonly minSize: number;
|
|
4234
|
+
/** The spine of each pair. The default is `trunk`. */
|
|
4235
|
+
readonly spine: GroupSpine;
|
|
4236
|
+
}
|
|
4237
|
+
/** The default options of the strategy `wspd`. */
|
|
4238
|
+
export declare const WSPD_DEFAULTS: Readonly<WspdOptions>;
|
|
4239
|
+
/** A cell of the split tree: the points at the places `lo` to `hi - 1` of the order, with their bounding circle. */
|
|
4240
|
+
interface SplitCell {
|
|
4241
|
+
readonly id: number;
|
|
4242
|
+
readonly lo: number;
|
|
4243
|
+
readonly hi: number;
|
|
4244
|
+
readonly c: Point;
|
|
4245
|
+
readonly r: number;
|
|
4246
|
+
readonly kids?: readonly [SplitCell, SplitCell];
|
|
4247
|
+
}
|
|
4248
|
+
/**
|
|
4249
|
+
* The split tree of a set of points and its well-separated pairs (Callahan and Kosaraju 1995).
|
|
4250
|
+
* Each cell splits at the middle of the longer side of its bounding box. A cell of equal points is a leaf.
|
|
4251
|
+
*/
|
|
4252
|
+
export declare class SplitTree {
|
|
4253
|
+
#private;
|
|
4254
|
+
readonly root: SplitCell;
|
|
4255
|
+
/** This constructor builds the tree of the points. */
|
|
4256
|
+
constructor(points: readonly Point[]);
|
|
4257
|
+
/** This method tells if the cell holds the point `i`. */
|
|
4258
|
+
holds(cell: SplitCell, i: number): boolean;
|
|
4259
|
+
/**
|
|
4260
|
+
* This method gives the well-separated pair that holds the pair of points `u` and `v`, with the cell of `u` first.
|
|
4261
|
+
* Each pair of two different points is in one pair of the decomposition. Two equal points give `undefined`.
|
|
4262
|
+
*/
|
|
4263
|
+
pairOf(u: number, v: number, s: number): [SplitCell, SplitCell] | undefined;
|
|
4264
|
+
}
|
|
4265
|
+
/**
|
|
4266
|
+
* This function gives the groups of the edges by the well-separated pair of their two nodes (HWY-018).
|
|
4267
|
+
* The points are the centers of the boxes. The edges of one pair, in either direction, are one group.
|
|
4268
|
+
*/
|
|
4269
|
+
export declare function wspdGroups(input: HighwayInput, o: Readonly<WspdOptions>): Map<string, EdgeGroup>;
|
|
4270
|
+
/**
|
|
4271
|
+
* This function gives the highways of clustered edge routing with the WSPD (HWY-018, after Bouts and Speckmann 2015).
|
|
4272
|
+
* The well-separated pairs split all the pairs of nodes. The edges of one pair with `minSize` edges or more get one highway from one set to the other.
|
|
4273
|
+
*/
|
|
4274
|
+
export declare function wspdPlan(input: HighwayInput, o: Readonly<WspdOptions>): HighwayPlan;
|
|
4275
|
+
/** The options of the highway strategy `zipper` (NAT-022 with WILD-037 of the notes). */
|
|
4276
|
+
interface ZipperOptions {
|
|
4277
|
+
/** The plan whose routes the zipper joins. The default is `shared-ways`. */
|
|
4278
|
+
readonly from: HighwayBase;
|
|
4279
|
+
/** Two legs zip when they are this distance apart or nearer, in units of the board (the median short side of the boxes). The default is 1. */
|
|
4280
|
+
readonly near: number;
|
|
4281
|
+
/** Two legs zip when the angle between them is this value or less, in degrees. The default is 15. */
|
|
4282
|
+
readonly maxAngle: number;
|
|
4283
|
+
/** The adhesion over the tension: two legs zip when `adhesion * overlap` is more than the length that the zip adds. The default is 0.3. */
|
|
4284
|
+
readonly adhesion: number;
|
|
4285
|
+
/** Two legs zip when they overlap along this length or more, in units of the board. The default is 1. */
|
|
4286
|
+
readonly minOverlap: number;
|
|
4287
|
+
/** The number of passes. Each pass routes the plan and zips the legs again. The default is 1. */
|
|
4288
|
+
readonly passes: number;
|
|
4289
|
+
}
|
|
4290
|
+
/** The default options of the strategy `zipper`. */
|
|
4291
|
+
export declare const ZIPPER_DEFAULTS: Readonly<ZipperOptions>;
|
|
4292
|
+
/** A pair of legs that can zip, with the line of the zip. */
|
|
4293
|
+
interface Zip {
|
|
4294
|
+
readonly gain: number;
|
|
4295
|
+
/** The first point of the zipped line. */
|
|
4296
|
+
readonly from: Point;
|
|
4297
|
+
/** The last point of the zipped line. */
|
|
4298
|
+
readonly to: Point;
|
|
4299
|
+
/** This value is `true` when the leg goes from `from` to `to`, for each of the two legs. */
|
|
4300
|
+
readonly forward: readonly [boolean, boolean];
|
|
4301
|
+
}
|
|
4302
|
+
/** The limits of `zipLegs`, in the units of the board. */
|
|
4303
|
+
interface ZipLimits {
|
|
4304
|
+
readonly near: number;
|
|
4305
|
+
readonly maxAngle: number;
|
|
4306
|
+
readonly adhesion: number;
|
|
4307
|
+
readonly minOverlap: number;
|
|
4308
|
+
}
|
|
4309
|
+
/**
|
|
4310
|
+
* This function tells if two legs zip (NAT-022), and gives the zipped line.
|
|
4311
|
+
* The zipped line is the mean of the two legs, with the weight of their lengths, along the stretch where they overlap.
|
|
4312
|
+
* The legs zip when the angle between them is `maxAngle` or less, and they are `near` or nearer along the overlap.
|
|
4313
|
+
* The overlap must be `minOverlap` or more.
|
|
4314
|
+
* The zip adds two jogs to each leg, so it adds the length `2 (d_a + d_b)`, with the distances of the legs to the zipped line.
|
|
4315
|
+
* The legs zip only when `adhesion * overlap` is more than that length.
|
|
4316
|
+
*/
|
|
4317
|
+
export declare function zipLegs(a0: Point, a1: Point, b0: Point, b1: Point, o: ZipLimits): Zip | undefined;
|
|
4318
|
+
/**
|
|
4319
|
+
* This function gives the highways of the plan `from`, with the legs that run near and nearly parallel zipped together (NAT-022, WILD-037).
|
|
4320
|
+
* A pass routes the plan with `follow` and takes each leg that no other route shares. A grid of the legs finds the near pairs.
|
|
4321
|
+
* The pairs that zip (`zipLegs`) go from the largest gain to the smallest, and each leg zips one time in a pass at most.
|
|
4322
|
+
* A zipped line that goes into a box, made larger by 1, does not zip.
|
|
4323
|
+
* Each zip is a new highway of two members. The `seq` of each member follows the place of its merge point along the route of the edge.
|
|
4324
|
+
*/
|
|
4325
|
+
export declare function zipperPlan(input: HighwayInput, o: Readonly<ZipperOptions>): HighwayPlan;
|
|
3030
4326
|
/** The options of a router strategy: the options of its router, without the name and the limit of the benchmark. */
|
|
3031
4327
|
export type RouterPreset<O> = Omit<O, "name" | "maxNodes">;
|
|
3032
4328
|
/** The built-in router strategies, in the order of the benchmark. They route as the routers of `ROUTERS`. */
|
|
@@ -3113,12 +4409,44 @@ export declare const groupStrategies: {
|
|
|
3113
4409
|
};
|
|
3114
4410
|
/**
|
|
3115
4411
|
* The built-in highway strategies: the decisions of the routers `trunks` and `shared` as plans, and corridor signatures (HWY-031).
|
|
4412
|
+
* The strategies `corridors+<gate>` put a gate of BUILD-W2A after `corridors`: `breakeven` (HWY-047), `stretch` (HWY-048), `ambiguity` (HWY-049),
|
|
4413
|
+
* `hysteresis` (HWY-046) and `ids` (HWY-054). `gateStrategy` puts a gate after any other plan.
|
|
3116
4414
|
* `follow` routes the edges along a plan, and `highwayRouter` gives a router that does both.
|
|
3117
4415
|
*/
|
|
3118
4416
|
export declare const highwayStrategies: {
|
|
3119
4417
|
readonly keys: Strategy<"highway", KeysOptions>;
|
|
3120
4418
|
readonly "shared-ways": Strategy<"highway", SharedWaysOptions>;
|
|
3121
4419
|
readonly corridors: Strategy<"highway", CorridorOptions>;
|
|
4420
|
+
readonly meet: Strategy<"highway", MeetOptions>;
|
|
4421
|
+
readonly weiszfeld: Strategy<"highway", WeiszfeldOptions>;
|
|
4422
|
+
readonly stubs: Strategy<"highway", StubOptions>;
|
|
4423
|
+
readonly zipper: Strategy<"highway", ZipperOptions>;
|
|
4424
|
+
readonly "level-links": Strategy<"highway", LevelHighwayOptions>;
|
|
4425
|
+
readonly quickbundles: Strategy<"highway", QuickBundlesOptions>;
|
|
4426
|
+
readonly "road-classes": Strategy<"highway", RoadClassOptions>;
|
|
4427
|
+
readonly "flow-field": Strategy<"highway", FlowFieldOptions>;
|
|
4428
|
+
readonly wspd: Strategy<"highway", WspdOptions>;
|
|
4429
|
+
readonly "od-cells": Strategy<"highway", OdCellOptions>;
|
|
4430
|
+
readonly select: Strategy<"highway", SelectOptions>;
|
|
4431
|
+
readonly mingle: Strategy<"highway", MingleOptions>;
|
|
4432
|
+
readonly spiral: Strategy<"highway", SpiralOptions>;
|
|
4433
|
+
readonly "flow-clusters": Strategy<"highway", FlowClusterOptions>;
|
|
4434
|
+
readonly traclus: Strategy<"highway", TraclusOptions>;
|
|
4435
|
+
readonly diffusion: Strategy<"highway", DiffusionOptions>;
|
|
4436
|
+
readonly nested: Strategy<"highway", NestedOptions>;
|
|
4437
|
+
readonly lanes: Strategy<"highway", LanesOptions>;
|
|
4438
|
+
readonly growth: Strategy<"highway", GrowthOptions>;
|
|
4439
|
+
readonly "edge-paths": Strategy<"highway", EdgePathOptions>;
|
|
4440
|
+
readonly "soft-keys": Strategy<"highway", SoftKeyOptions>;
|
|
4441
|
+
readonly hough: Strategy<"highway", HoughOptions>;
|
|
4442
|
+
readonly ridges: Strategy<"highway", RidgeOptions>;
|
|
4443
|
+
readonly hdbscan: Strategy<"highway", HdbscanOptions>;
|
|
4444
|
+
readonly "hub-arcs": Strategy<"highway", HubArcOptions>;
|
|
4445
|
+
readonly "corridors+breakeven": Strategy<"highway", CorridorOptions & BreakEvenOptions>;
|
|
4446
|
+
readonly "corridors+stretch": Strategy<"highway", CorridorOptions & StretchOptions>;
|
|
4447
|
+
readonly "corridors+ambiguity": Strategy<"highway", CorridorOptions & AmbiguityGuardOptions>;
|
|
4448
|
+
readonly "corridors+hysteresis": Strategy<"highway", CorridorOptions & HysteresisOptions>;
|
|
4449
|
+
readonly "corridors+ids": Strategy<"highway", CorridorOptions & StableIdOptions>;
|
|
3122
4450
|
};
|
|
3123
4451
|
/** The built-in strategies of each step, in order. A consumer adds its own: `createRegistry([...BUILT_IN_STRATEGIES, mine])`. */
|
|
3124
4452
|
export declare const BUILT_IN_STRATEGIES: readonly AnyStrategy[];
|
|
@@ -3280,8 +4608,8 @@ export interface LayoutBox {
|
|
|
3280
4608
|
readonly parent?: string;
|
|
3281
4609
|
/** The group of the box. */
|
|
3282
4610
|
readonly group?: string;
|
|
3283
|
-
/** This value is `true` when the box is an obstacle: the packer keeps its `x` and `y`. The router ignores it. */
|
|
3284
|
-
readonly locked?:
|
|
4611
|
+
/** This value is `true` when the box is an obstacle: the packer keeps its `x` and `y`. `false` is the same as no value. The router ignores it. */
|
|
4612
|
+
readonly locked?: boolean;
|
|
3285
4613
|
/** The reading order that the caller wants. The router ignores it. */
|
|
3286
4614
|
readonly rank?: number;
|
|
3287
4615
|
readonly ports?: readonly LayoutPort[];
|
|
@@ -3315,7 +4643,7 @@ export interface LayoutGenerator {
|
|
|
3315
4643
|
* The packer reads the first six dimensions. The router reads the last four.
|
|
3316
4644
|
*/
|
|
3317
4645
|
export interface LayoutCell {
|
|
3318
|
-
readonly containerSize?: "fixed" | "freeWidth" | "freeAspect";
|
|
4646
|
+
readonly containerSize?: "fixed" | "freeHeight" | "freeWidth" | "freeAspect" | "freeArea";
|
|
3319
4647
|
readonly containerShape?: "rect" | "convex" | "polygon" | "circle" | "ellipse" | "holes";
|
|
3320
4648
|
readonly obstacles?: "none" | "center" | "scattered" | "wall" | "corridors" | "touching" | "edge";
|
|
3321
4649
|
readonly sizes?: "identical" | "uniform" | "heavyTail" | "bimodal" | "extremeAspect" | "nearIdentical";
|
|
@@ -3441,13 +4769,20 @@ export declare function regionBounds(region: Region): {
|
|
|
3441
4769
|
w: number;
|
|
3442
4770
|
h: number;
|
|
3443
4771
|
};
|
|
4772
|
+
/**
|
|
4773
|
+
* The fields of an input that `inputGraph` reads. A contract input, for example the result of `applyPack`, has these fields.
|
|
4774
|
+
* Without `edges`, the input has no edges.
|
|
4775
|
+
*/
|
|
4776
|
+
export type RouteInput = Pick<LayoutInput, "id" | "boxes" | "obstacles"> & {
|
|
4777
|
+
readonly edges?: LayoutInput["edges"];
|
|
4778
|
+
};
|
|
3444
4779
|
/**
|
|
3445
4780
|
* This function reads the graph of the router from an input file. The router reads the positions, the ports, the edges and the data.
|
|
3446
4781
|
* Each obstacle becomes a node without edges, with the bounding box of its region, after the boxes.
|
|
3447
4782
|
* The router ignores the other fields of the packer: `container`, `gap`, `locked`, `rank`, the `shape` of a box and the `move` of an obstacle.
|
|
3448
4783
|
* A box without `x` and `y` is an error.
|
|
3449
4784
|
*/
|
|
3450
|
-
export declare function inputGraph(input:
|
|
4785
|
+
export declare function inputGraph(input: RouteInput): Graph;
|
|
3451
4786
|
/**
|
|
3452
4787
|
* This function writes an input file as text: the keys in sorted order, and one box or one edge on each line.
|
|
3453
4788
|
* `JSON.parse` of the text gives the input again.
|
|
@@ -3600,6 +4935,12 @@ export interface ScreenOptions {
|
|
|
3600
4935
|
* The default is 0: no measure of the order fragility. The steps `group` and `curve` do not read it.
|
|
3601
4936
|
*/
|
|
3602
4937
|
readonly shuffles?: number;
|
|
4938
|
+
/**
|
|
4939
|
+
* The number of seeded edits of the step `highway` (BUILD-W2A). Each highway strategy runs again after each edit of `highwayEdits`, with its plan before the edit.
|
|
4940
|
+
* The records then get `Z10.edits.*`, the churn of the highways and the share of the highways that keep their id.
|
|
4941
|
+
* The default is 0: no edits. The other steps and the base routers do not read it.
|
|
4942
|
+
*/
|
|
4943
|
+
readonly edits?: number;
|
|
3603
4944
|
/** The commit of the code, for the records. */
|
|
3604
4945
|
readonly commit?: string;
|
|
3605
4946
|
/** The predictions of the run. Each record names the first prediction with its strategy, its set and its input. */
|
|
@@ -3737,6 +5078,37 @@ export declare function highwayRouter<O extends object>(strategy: Strategy<"high
|
|
|
3737
5078
|
* The benchmark and the screen race such a router with the other routers.
|
|
3738
5079
|
*/
|
|
3739
5080
|
export declare function highwayRouterStrategy<O extends object>(strategy: Strategy<"highway", O>): Strategy<"router", O>;
|
|
5081
|
+
/** An edge with its two plugs, as the router `corners` places them. */
|
|
5082
|
+
interface EdgePlugs {
|
|
5083
|
+
readonly edge: Edge;
|
|
5084
|
+
readonly ps: Plug;
|
|
5085
|
+
readonly pt: Plug;
|
|
5086
|
+
}
|
|
5087
|
+
/** This function gives the plugs of each edge of the graph, in the order of the edges. An edge with an unknown node is not in the list. */
|
|
5088
|
+
export declare function edgePlugs(graph: Graph): EdgePlugs[];
|
|
5089
|
+
/** The way of one edge through the corner graph, with a key. Only the ways with one key share a highway. */
|
|
5090
|
+
interface KeyedWay {
|
|
5091
|
+
readonly edge: string;
|
|
5092
|
+
readonly key: string;
|
|
5093
|
+
/** The points of the way, without the plugs. Two ways share a link when the link has the same two points. */
|
|
5094
|
+
readonly points: readonly Point[];
|
|
5095
|
+
}
|
|
5096
|
+
/** The options of `sharedStretches`. */
|
|
5097
|
+
interface SharedStretchOptions {
|
|
5098
|
+
/** A highway has this number of edges or more. The value is 2 or more. */
|
|
5099
|
+
readonly minSize: number;
|
|
5100
|
+
/** This function tells if a link can be part of a highway. Without it, each link can. */
|
|
5101
|
+
readonly link?: (a: Point, b: Point) => boolean;
|
|
5102
|
+
/** This function removes the needless corners of a spine. Without it, the spine keeps each point of the stretch. */
|
|
5103
|
+
readonly pull?: (points: readonly Point[]) => Point[];
|
|
5104
|
+
}
|
|
5105
|
+
/**
|
|
5106
|
+
* This function gives a highway for each stretch that two ways or more of one key share. A way is a polyline through the corner graph.
|
|
5107
|
+
* Each way breaks into stretches where the set of the ways on its links stays the same. The router `shared` makes its runs in the same way.
|
|
5108
|
+
* A stretch with fewer than `minSize` ways is not a highway. Each way joins the spine at one end of the stretch and leaves it at the other end.
|
|
5109
|
+
* The `seq` of each member follows the order of the stretches along the way.
|
|
5110
|
+
*/
|
|
5111
|
+
export declare function sharedStretches(ways: readonly KeyedWay[], o: Readonly<SharedStretchOptions>): HighwayPlan;
|
|
3740
5112
|
/**
|
|
3741
5113
|
* This function gives the graph with its edges in the stable order of WILD-053: by the FNV-1a hash of the id, then by the id.
|
|
3742
5114
|
* The nodes and the edges do not change. Two orders of the same edges give the same graph.
|
|
@@ -3845,5 +5217,5 @@ export declare function withRepair(router: Router, options?: RepairOptions): Rou
|
|
|
3845
5217
|
* The new strategy has the name `<name>+repair`, and the options and the schema of `strategy`. The strategy `strategy` does not change.
|
|
3846
5218
|
*/
|
|
3847
5219
|
export declare function repairStrategy<O extends object>(strategy: Strategy<"router", O>, repair?: RepairOptions): Strategy<"router", O>;
|
|
3848
|
-
export type { ArcOptions, ClothoidOptions, CornersOptions, CorridorOptions, CurveSpace, CutObjective, CutOptions, FollowOptions, Highway, HighwayInput, HighwayMember, HighwayOptions, HighwayPlan, JogStyle, KdAxis, KdLine, KdOptions, KeyOptions, KeysOptions, LaneCurve, NodeKey, RoomBends, RoundedOptions, SectionsOptions, ShareCost, ShareMerge, ShareOrder, SharedOptions, SharedWaysOptions, SmoothOptions, SplineOptions, TrunkFan, TrunkSplit, TrunksOptions };
|
|
5220
|
+
export type { AmbiguityGuardOptions, ArcOptions, ArcSource, BreakEvenOptions, BundleLine, BundleOrder, CandidateSource, ClothoidOptions, CornersOptions, CorridorOptions, CurveSpace, CutObjective, CutOptions, DensityImage, DiffusionOptions, EdgeDistance, EdgeGroup, EdgeLengths, EdgePathOptions, EdgePlugs, FieldEnd, FlowClusterOptions, FlowFieldOptions, FollowOptions, Gate, GroupSpine, GroupedOptions, GrowthOptions, GrowthOrder, HdbscanOptions, Highway, HighwayBase, HighwayInput, HighwayMember, HighwayOptions, HighwayPlan, HoughOptions, HoughPeak, HubArcOptions, HysteresisOptions, JogStyle, KdAxis, KdLine, KdOptions, KeyOptions, KeyedWay, KeysOptions, LaneCurve, LanesOptions, LevelHighwayOptions, Linkage, MeetOptions, MingleOptions, NestedOptions, NodeKey, OdCellOptions, PathStep, QuickBundlesOptions, Ridge, RidgeOptions, RidgeSource, RoadClassOptions, RoomBends, RoundedOptions, RouteSegment, SectionsOptions, SelectOptions, ShareCost, ShareMerge, ShareOrder, SharedOptions, SharedStretchOptions, SharedWaysOptions, SmoothOptions, SnapLine, SnapMember, SnapOptions, SoftKeyOptions, SpiralNode, SpiralOptions, SplineOptions, SplitCell, StableIdOptions, StretchOptions, StubEnds, StubOptions, TraclusOptions, TrunkFan, TrunkSplit, TrunksOptions, WeiszfeldOptions, WspdOptions, Zip, ZipLimits, ZipperOptions };
|
|
3849
5221
|
//# sourceMappingURL=index.d.ts.map
|