data-structure-typed 1.42.2 → 1.42.3
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/CHANGELOG.md +1 -1
- package/README.md +12 -12
- package/benchmark/report.html +12 -12
- package/benchmark/report.json +104 -104
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.js +1 -1
- package/dist/cjs/src/data-structures/binary-tree/binary-tree.js.map +1 -1
- package/dist/cjs/src/data-structures/graph/abstract-graph.js.map +1 -1
- package/dist/mjs/src/data-structures/binary-tree/binary-tree.d.ts +1 -1
- package/dist/mjs/src/data-structures/binary-tree/binary-tree.js +2 -2
- package/dist/umd/data-structure-typed.min.js +1 -1
- package/dist/umd/data-structure-typed.min.js.map +1 -1
- package/package.json +2 -2
- package/src/data-structures/binary-tree/binary-tree.ts +30 -31
- package/src/data-structures/graph/abstract-graph.ts +18 -14
- package/test/performance/reportor.ts +1 -0
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +34 -15
- package/test/unit/data-structures/binary-tree/bst.test.ts +13 -0
- package/test/unit/data-structures/graph/directed-graph.test.ts +7 -8
- package/test/unit/data-structures/graph/salty-edges.json +875 -1
- package/test/unit/data-structures/graph/salty-vertexes.json +200 -1
- package/test/unit/data-structures/graph/undirected-graph.test.ts +15 -16
|
@@ -1 +1,200 @@
|
|
|
1
|
-
[
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Intersection_1"
|
|
4
|
+
},
|
|
5
|
+
{
|
|
6
|
+
"name": "Intersection_2"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"name": "Intersection_3"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "Intersection_4"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "Intersection_5"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Intersection_6"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "Intersection_7"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "Intersection_8"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "Intersection_9"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "Intersection_10"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "Intersection_11"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "Intersection_12"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Intersection_13"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "Intersection_14"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "Intersection_15"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "Intersection_16"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "Intersection_17"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "Intersection_18"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "Intersection_19"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "Intersection_20"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "Intersection_21"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "Intersection_22"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "Intersection_23"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "Intersection_24"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "Intersection_25"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "Intersection_26"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "Intersection_27"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "Intersection_28"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "Intersection_29"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "Intersection_30"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "Intersection_31"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "Intersection_32"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "Intersection_33"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "Intersection_34"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "Intersection_35"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "Intersection_36"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "Intersection_37"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "Intersection_38"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "Intersection_39"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "Intersection_40"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "Intersection_41"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "Intersection_42"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "Intersection_43"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "Intersection_44"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "Intersection_45"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "Intersection_46"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "Intersection_47"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "Intersection_48"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "Intersection_49"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "Intersection_50"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "Intersection_51"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "Intersection_52"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "Intersection_53"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "Intersection_54"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "Intersection_55"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "Intersection_56"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "Intersection_57"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "Intersection_58"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "Intersection_59"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "Intersection_60"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "Intersection_61"
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"name": "Intersection_62"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "Intersection_63"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "Intersection_64"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "Intersection_65"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "Intersection_66"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
@@ -158,24 +158,23 @@ describe('UndirectedGraph', () => {
|
|
|
158
158
|
const [s, d] = e;
|
|
159
159
|
graph.addEdge(s.name, d.name, d.weight);
|
|
160
160
|
}
|
|
161
|
-
const allPaths = graph.getAllPathsBetween('Intersection_1','Intersection_5');
|
|
161
|
+
const allPaths = graph.getAllPathsBetween('Intersection_1', 'Intersection_5');
|
|
162
162
|
expect(allPaths.length).toBe(1000);
|
|
163
|
-
const minWeightedPathDFS = graph.getMinPathBetween('Intersection_1','Intersection_5', true, true);
|
|
163
|
+
const minWeightedPathDFS = graph.getMinPathBetween('Intersection_1', 'Intersection_5', true, true);
|
|
164
164
|
expect(minWeightedPathDFS?.[0]?.key).toBe('Intersection_1');
|
|
165
165
|
expect(minWeightedPathDFS?.[5]?.key).toBe('Intersection_42');
|
|
166
166
|
expect(minWeightedPathDFS?.[8]?.key).toBe('Intersection_18');
|
|
167
167
|
expect(minWeightedPathDFS?.[27]?.key).toBe('Intersection_6');
|
|
168
|
-
const minWeightedPath = graph.dijkstra('Intersection_1','Intersection_5', true, true);
|
|
168
|
+
const minWeightedPath = graph.dijkstra('Intersection_1', 'Intersection_5', true, true);
|
|
169
169
|
|
|
170
|
-
expect(minWeightedPath?.minPath?.[0]?.key).toBe('Intersection_1')
|
|
171
|
-
expect(minWeightedPath?.minPath?.[1]?.key).toBe('Intersection_2')
|
|
172
|
-
expect(minWeightedPath?.minPath?.[2]?.key).toBe('Intersection_3')
|
|
173
|
-
expect(minWeightedPath?.minPath?.[3]?.key).toBe('Intersection_4')
|
|
174
|
-
expect(minWeightedPath?.minPath?.[4]?.key).toBe('Intersection_5')
|
|
170
|
+
expect(minWeightedPath?.minPath?.[0]?.key).toBe('Intersection_1');
|
|
171
|
+
expect(minWeightedPath?.minPath?.[1]?.key).toBe('Intersection_2');
|
|
172
|
+
expect(minWeightedPath?.minPath?.[2]?.key).toBe('Intersection_3');
|
|
173
|
+
expect(minWeightedPath?.minPath?.[3]?.key).toBe('Intersection_4');
|
|
174
|
+
expect(minWeightedPath?.minPath?.[4]?.key).toBe('Intersection_5');
|
|
175
175
|
});
|
|
176
176
|
});
|
|
177
177
|
|
|
178
|
-
|
|
179
178
|
describe('cycles, strongly connected components, bridges, articular points in UndirectedGraph', () => {
|
|
180
179
|
const graph = new UndirectedGraph();
|
|
181
180
|
graph.addVertex('A');
|
|
@@ -201,10 +200,10 @@ describe('cycles, strongly connected components, bridges, articular points in Un
|
|
|
201
200
|
const cutVertexes = graph.getCutVertexes();
|
|
202
201
|
const dfnMap = graph.getDFNMap();
|
|
203
202
|
const lowMap = graph.getLowMap();
|
|
204
|
-
expect(cycles.size).toBe(1)
|
|
205
|
-
expect(scCs.size).toBe(5)
|
|
206
|
-
expect(bridges.length).toBe(4)
|
|
207
|
-
expect(cutVertexes.length).toBe(4)
|
|
208
|
-
expect(dfnMap.size).toBe(8)
|
|
209
|
-
expect(lowMap.size).toBe(8)
|
|
210
|
-
});
|
|
203
|
+
expect(cycles.size).toBe(1);
|
|
204
|
+
expect(scCs.size).toBe(5);
|
|
205
|
+
expect(bridges.length).toBe(4);
|
|
206
|
+
expect(cutVertexes.length).toBe(4);
|
|
207
|
+
expect(dfnMap.size).toBe(8);
|
|
208
|
+
expect(lowMap.size).toBe(8);
|
|
209
|
+
});
|