data-structure-typed 0.8.18 → 1.12.9

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.
Files changed (287) hide show
  1. package/.dependency-cruiser.js +449 -0
  2. package/.idea/data-structure-typed.iml +2 -0
  3. package/.idea/modules.xml +1 -1
  4. package/README.md +298 -2
  5. package/dist/data-structures/binary-tree/aa-tree.js +5 -2
  6. package/dist/data-structures/binary-tree/avl-tree.d.ts +58 -5
  7. package/dist/data-structures/binary-tree/avl-tree.js +150 -46
  8. package/dist/data-structures/binary-tree/b-tree.js +5 -2
  9. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +28 -1
  10. package/dist/data-structures/binary-tree/binary-indexed-tree.js +41 -13
  11. package/dist/data-structures/binary-tree/binary-tree.d.ts +230 -36
  12. package/dist/data-structures/binary-tree/binary-tree.js +747 -369
  13. package/dist/data-structures/binary-tree/bst.d.ts +20 -8
  14. package/dist/data-structures/binary-tree/bst.js +164 -107
  15. package/dist/data-structures/binary-tree/rb-tree.js +5 -2
  16. package/dist/data-structures/binary-tree/segment-tree.d.ts +7 -3
  17. package/dist/data-structures/binary-tree/segment-tree.js +95 -61
  18. package/dist/data-structures/binary-tree/splay-tree.js +5 -2
  19. package/dist/data-structures/binary-tree/tree-multiset.d.ts +5 -5
  20. package/dist/data-structures/binary-tree/tree-multiset.js +35 -11
  21. package/dist/data-structures/binary-tree/two-three-tree.js +5 -2
  22. package/dist/data-structures/graph/abstract-graph.d.ts +168 -46
  23. package/dist/data-structures/graph/abstract-graph.js +712 -323
  24. package/dist/data-structures/graph/directed-graph.d.ts +114 -12
  25. package/dist/data-structures/graph/directed-graph.js +372 -128
  26. package/dist/data-structures/graph/undirected-graph.d.ts +67 -3
  27. package/dist/data-structures/graph/undirected-graph.js +233 -81
  28. package/dist/data-structures/hash/coordinate-map.d.ts +33 -1
  29. package/dist/data-structures/hash/coordinate-map.js +70 -20
  30. package/dist/data-structures/hash/coordinate-set.d.ts +25 -0
  31. package/dist/data-structures/hash/coordinate-set.js +58 -15
  32. package/dist/data-structures/hash/index.d.ts +5 -0
  33. package/dist/data-structures/hash/index.js +5 -0
  34. package/dist/data-structures/heap/heap.d.ts +26 -37
  35. package/dist/data-structures/heap/heap.js +56 -60
  36. package/dist/data-structures/heap/max-heap.d.ts +8 -2
  37. package/dist/data-structures/heap/max-heap.js +32 -9
  38. package/dist/data-structures/heap/min-heap.d.ts +9 -2
  39. package/dist/data-structures/heap/min-heap.js +33 -9
  40. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +14 -7
  41. package/dist/data-structures/linked-list/doubly-linked-list.js +101 -61
  42. package/dist/data-structures/linked-list/singly-linked-list.d.ts +18 -19
  43. package/dist/data-structures/linked-list/singly-linked-list.js +312 -174
  44. package/dist/data-structures/matrix/matrix.d.ts +9 -0
  45. package/dist/data-structures/matrix/matrix.js +19 -7
  46. package/dist/data-structures/matrix/matrix2d.d.ts +84 -4
  47. package/dist/data-structures/matrix/matrix2d.js +158 -61
  48. package/dist/data-structures/matrix/navigator.d.ts +34 -16
  49. package/dist/data-structures/matrix/navigator.js +65 -18
  50. package/dist/data-structures/matrix/vector2d.d.ts +153 -29
  51. package/dist/data-structures/matrix/vector2d.js +249 -102
  52. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +11 -2
  53. package/dist/data-structures/priority-queue/max-priority-queue.js +33 -8
  54. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +11 -2
  55. package/dist/data-structures/priority-queue/min-priority-queue.js +33 -8
  56. package/dist/data-structures/priority-queue/priority-queue.d.ts +145 -21
  57. package/dist/data-structures/priority-queue/priority-queue.js +285 -116
  58. package/dist/data-structures/queue/deque.d.ts +69 -0
  59. package/dist/data-structures/queue/deque.js +151 -56
  60. package/dist/data-structures/queue/queue.d.ts +34 -37
  61. package/dist/data-structures/queue/queue.js +59 -61
  62. package/dist/data-structures/stack/stack.d.ts +29 -35
  63. package/dist/data-structures/stack/stack.js +51 -56
  64. package/dist/data-structures/trie/trie.d.ts +36 -6
  65. package/dist/data-structures/trie/trie.js +256 -83
  66. package/dist/data-structures/types/abstract-graph.d.ts +29 -0
  67. package/dist/data-structures/types/abstract-graph.js +2 -0
  68. package/dist/data-structures/types/avl-tree.d.ts +5 -0
  69. package/dist/data-structures/types/avl-tree.js +2 -0
  70. package/dist/data-structures/types/binary-tree.d.ts +16 -0
  71. package/dist/data-structures/types/binary-tree.js +2 -0
  72. package/dist/data-structures/types/bst.d.ts +7 -0
  73. package/dist/data-structures/types/bst.js +2 -0
  74. package/dist/data-structures/types/directed-graph.d.ts +10 -0
  75. package/dist/data-structures/types/directed-graph.js +2 -0
  76. package/dist/data-structures/types/doubly-linked-list.d.ts +1 -0
  77. package/dist/data-structures/types/doubly-linked-list.js +2 -0
  78. package/dist/data-structures/types/heap.d.ts +7 -0
  79. package/dist/data-structures/types/heap.js +2 -0
  80. package/dist/data-structures/types/index.d.ts +13 -0
  81. package/dist/data-structures/types/index.js +29 -0
  82. package/dist/data-structures/types/navigator.d.ts +14 -0
  83. package/dist/data-structures/types/navigator.js +2 -0
  84. package/dist/data-structures/types/priority-queue.d.ts +7 -0
  85. package/dist/data-structures/types/priority-queue.js +2 -0
  86. package/dist/data-structures/types/segment-tree.d.ts +1 -0
  87. package/dist/data-structures/types/segment-tree.js +2 -0
  88. package/dist/data-structures/types/singly-linked-list.js +2 -0
  89. package/dist/data-structures/types/tree-multiset.d.ts +5 -0
  90. package/dist/data-structures/types/tree-multiset.js +2 -0
  91. package/dist/utils/trampoline.d.ts +14 -0
  92. package/dist/utils/trampoline.js +130 -0
  93. package/dist/utils/types/index.js +17 -0
  94. package/dist/{types → utils}/types/utils.d.ts +15 -1
  95. package/dist/{types → utils/types}/utils.js +21 -19
  96. package/dist/{utils.d.ts → utils/utils.d.ts} +5 -22
  97. package/dist/utils/utils.js +651 -0
  98. package/docs/.nojekyll +1 -0
  99. package/docs/assets/highlight.css +85 -0
  100. package/docs/assets/main.js +58 -0
  101. package/docs/assets/search.js +1 -0
  102. package/docs/assets/style.css +1367 -0
  103. package/docs/classes/AVLTree.html +2046 -0
  104. package/docs/classes/AVLTreeNode.html +423 -0
  105. package/docs/classes/AaTree.html +117 -0
  106. package/docs/classes/AbstractEdge.html +198 -0
  107. package/docs/classes/AbstractGraph.html +891 -0
  108. package/docs/classes/AbstractVertex.html +164 -0
  109. package/docs/classes/ArrayDeque.html +384 -0
  110. package/docs/classes/BST.html +1893 -0
  111. package/docs/classes/BSTNode.html +425 -0
  112. package/docs/classes/BTree.html +117 -0
  113. package/docs/classes/BinaryIndexedTree.html +244 -0
  114. package/docs/classes/BinaryTree.html +1754 -0
  115. package/docs/classes/BinaryTreeNode.html +396 -0
  116. package/docs/classes/Character.html +165 -0
  117. package/docs/classes/CoordinateMap.html +394 -0
  118. package/docs/classes/CoordinateSet.html +355 -0
  119. package/docs/classes/Deque.html +617 -0
  120. package/docs/classes/DirectedEdge.html +247 -0
  121. package/docs/classes/DirectedGraph.html +1207 -0
  122. package/docs/classes/DirectedVertex.html +154 -0
  123. package/docs/classes/DoublyLinkedList.html +619 -0
  124. package/docs/classes/DoublyLinkedListNode.html +160 -0
  125. package/docs/classes/Heap.html +315 -0
  126. package/docs/classes/Matrix2D.html +447 -0
  127. package/docs/classes/MatrixNTI2D.html +181 -0
  128. package/docs/classes/MaxHeap.html +325 -0
  129. package/docs/classes/MaxPriorityQueue.html +668 -0
  130. package/docs/classes/MinHeap.html +326 -0
  131. package/docs/classes/MinPriorityQueue.html +668 -0
  132. package/docs/classes/Navigator.html +285 -0
  133. package/docs/classes/ObjectDeque.html +289 -0
  134. package/docs/classes/PriorityQueue.html +643 -0
  135. package/docs/classes/Queue.html +337 -0
  136. package/docs/classes/RBTree.html +117 -0
  137. package/docs/classes/SegmentTree.html +234 -0
  138. package/docs/classes/SegmentTreeNode.html +302 -0
  139. package/docs/classes/SinglyLinkedList.html +1035 -0
  140. package/docs/classes/SinglyLinkedListNode.html +304 -0
  141. package/docs/classes/SplayTree.html +117 -0
  142. package/docs/classes/Stack.html +313 -0
  143. package/docs/classes/TreeMultiSet.html +1897 -0
  144. package/docs/classes/Trie.html +317 -0
  145. package/docs/classes/TrieNode.html +221 -0
  146. package/docs/classes/TwoThreeTree.html +117 -0
  147. package/docs/classes/UndirectedEdge.html +220 -0
  148. package/docs/classes/UndirectedGraph.html +1006 -0
  149. package/docs/classes/UndirectedVertex.html +154 -0
  150. package/docs/classes/Vector2D.html +746 -0
  151. package/docs/enums/CP.html +126 -0
  152. package/docs/enums/FamilyPosition.html +126 -0
  153. package/docs/enums/LoopType.html +119 -0
  154. package/docs/index.html +288 -0
  155. package/docs/modules.html +146 -0
  156. package/jest.config.js +5 -0
  157. package/package.json +33 -47
  158. package/rename_clear_files.sh +29 -0
  159. package/src/assets/complexities-diff.jpg +0 -0
  160. package/src/assets/data-structure-complexities.jpg +0 -0
  161. package/src/data-structures/binary-tree/avl-tree.ts +58 -6
  162. package/src/data-structures/binary-tree/binary-indexed-tree.ts +31 -4
  163. package/src/data-structures/binary-tree/binary-tree.ts +460 -145
  164. package/src/data-structures/binary-tree/bst.ts +31 -25
  165. package/src/data-structures/binary-tree/diagrams/avl-tree-inserting.gif +0 -0
  166. package/src/data-structures/binary-tree/diagrams/bst-rotation.gif +0 -0
  167. package/src/data-structures/binary-tree/diagrams/segment-tree.png +0 -0
  168. package/src/data-structures/binary-tree/segment-tree.ts +25 -12
  169. package/src/data-structures/binary-tree/tree-multiset.ts +5 -4
  170. package/src/data-structures/diagrams/README.md +5 -0
  171. package/src/data-structures/graph/abstract-graph.ts +224 -108
  172. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
  173. package/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
  174. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
  175. package/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
  176. package/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
  177. package/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
  178. package/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
  179. package/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
  180. package/src/data-structures/graph/diagrams/mst.jpg +0 -0
  181. package/src/data-structures/graph/diagrams/tarjan-articulation-point-bridge.png +0 -0
  182. package/src/data-structures/graph/diagrams/tarjan-complicate-simple.png +0 -0
  183. package/src/data-structures/graph/diagrams/tarjan-strongly-connected-component.png +0 -0
  184. package/src/data-structures/graph/diagrams/tarjan.mp4 +0 -0
  185. package/src/data-structures/graph/diagrams/tarjan.webp +0 -0
  186. package/src/data-structures/graph/directed-graph.ts +132 -26
  187. package/src/data-structures/graph/undirected-graph.ts +78 -11
  188. package/src/data-structures/hash/coordinate-map.ts +33 -1
  189. package/src/data-structures/hash/coordinate-set.ts +25 -0
  190. package/src/data-structures/hash/index.ts +5 -0
  191. package/src/data-structures/heap/heap.ts +27 -41
  192. package/src/data-structures/heap/max-heap.ts +8 -2
  193. package/src/data-structures/heap/min-heap.ts +9 -2
  194. package/src/data-structures/linked-list/doubly-linked-list.ts +50 -17
  195. package/src/data-structures/linked-list/singly-linked-list.ts +56 -39
  196. package/src/data-structures/matrix/matrix.ts +11 -0
  197. package/src/data-structures/matrix/matrix2d.ts +90 -10
  198. package/src/data-structures/matrix/navigator.ts +34 -14
  199. package/src/data-structures/matrix/vector2d.ts +187 -63
  200. package/src/data-structures/priority-queue/max-priority-queue.ts +12 -3
  201. package/src/data-structures/priority-queue/min-priority-queue.ts +12 -3
  202. package/src/data-structures/priority-queue/priority-queue.ts +200 -78
  203. package/src/data-structures/queue/deque.ts +71 -2
  204. package/src/data-structures/queue/queue.ts +37 -40
  205. package/src/data-structures/stack/stack.ts +32 -38
  206. package/src/data-structures/trie/trie.ts +83 -14
  207. package/src/data-structures/types/abstract-graph.ts +51 -0
  208. package/src/data-structures/types/avl-tree.ts +6 -0
  209. package/src/data-structures/types/binary-tree.ts +15 -0
  210. package/src/data-structures/types/bst.ts +5 -0
  211. package/src/data-structures/types/directed-graph.ts +18 -0
  212. package/src/data-structures/types/doubly-linked-list.ts +1 -0
  213. package/src/data-structures/types/heap.ts +8 -0
  214. package/src/data-structures/types/index.ts +13 -0
  215. package/src/data-structures/types/navigator.ts +13 -0
  216. package/src/data-structures/types/priority-queue.ts +9 -0
  217. package/src/data-structures/types/segment-tree.ts +1 -0
  218. package/src/data-structures/types/singly-linked-list.ts +1 -0
  219. package/src/data-structures/types/tree-multiset.ts +3 -0
  220. package/src/utils/index.ts +1 -0
  221. package/src/utils/trampoline.ts +51 -0
  222. package/src/utils/types/index.ts +1 -0
  223. package/src/{types → utils/types}/utils.ts +27 -5
  224. package/src/{utils.ts → utils/utils.ts} +41 -131
  225. package/tests/unit/data-structures/binary-tree/bst.test.ts +185 -0
  226. package/tests/unit/data-structures/graph/directed-graph.test.ts +71 -0
  227. package/{dist/types/data-structures/graph/index.d.ts → tests/unit/data-structures/graph/index.ts} +1 -1
  228. package/tests/unit/data-structures/graph/undirected-graph.ts +0 -0
  229. package/tsconfig.json +9 -6
  230. package/dist/data-structures/trampoline.d.ts +0 -25
  231. package/dist/data-structures/trampoline.js +0 -52
  232. package/dist/types/data-structures/binary-tree/aa-tree.d.ts +0 -2
  233. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +0 -21
  234. package/dist/types/data-structures/binary-tree/b-tree.d.ts +0 -2
  235. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -8
  236. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +0 -140
  237. package/dist/types/data-structures/binary-tree/bst.d.ts +0 -32
  238. package/dist/types/data-structures/binary-tree/index.d.ts +0 -4
  239. package/dist/types/data-structures/binary-tree/rb-tree.d.ts +0 -2
  240. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +0 -33
  241. package/dist/types/data-structures/binary-tree/splay-tree.d.ts +0 -2
  242. package/dist/types/data-structures/binary-tree/tree-multiset.d.ts +0 -11
  243. package/dist/types/data-structures/binary-tree/two-three-tree.d.ts +0 -2
  244. package/dist/types/data-structures/graph/abstract-graph.d.ts +0 -126
  245. package/dist/types/data-structures/graph/directed-graph.d.ts +0 -51
  246. package/dist/types/data-structures/graph/undirected-graph.d.ts +0 -24
  247. package/dist/types/data-structures/hash/coordinate-map.d.ts +0 -8
  248. package/dist/types/data-structures/hash/coordinate-set.d.ts +0 -7
  249. package/dist/types/data-structures/hash/index.d.ts +0 -1
  250. package/dist/types/data-structures/hash/pair.d.ts +0 -1
  251. package/dist/types/data-structures/hash/tree-map.d.ts +0 -1
  252. package/dist/types/data-structures/hash/tree-set.d.ts +0 -1
  253. package/dist/types/data-structures/heap/heap.d.ts +0 -72
  254. package/dist/types/data-structures/heap/index.d.ts +0 -3
  255. package/dist/types/data-structures/heap/max-heap.d.ts +0 -14
  256. package/dist/types/data-structures/heap/min-heap.d.ts +0 -14
  257. package/dist/types/data-structures/index.d.ts +0 -9
  258. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +0 -59
  259. package/dist/types/data-structures/linked-list/index.d.ts +0 -2
  260. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +0 -358
  261. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +0 -1
  262. package/dist/types/data-structures/matrix/index.d.ts +0 -3
  263. package/dist/types/data-structures/matrix/matrix.d.ts +0 -9
  264. package/dist/types/data-structures/matrix/matrix2d.d.ts +0 -25
  265. package/dist/types/data-structures/matrix/navigator.d.ts +0 -31
  266. package/dist/types/data-structures/matrix/vector2d.d.ts +0 -74
  267. package/dist/types/data-structures/priority-queue/index.d.ts +0 -3
  268. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +0 -4
  269. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +0 -4
  270. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +0 -36
  271. package/dist/types/data-structures/queue/deque.d.ts +0 -37
  272. package/dist/types/data-structures/queue/index.d.ts +0 -1
  273. package/dist/types/data-structures/queue/queue.d.ts +0 -76
  274. package/dist/types/data-structures/stack/index.d.ts +0 -1
  275. package/dist/types/data-structures/stack/stack.d.ts +0 -69
  276. package/dist/types/data-structures/trampoline.d.ts +0 -25
  277. package/dist/types/data-structures/trie/index.d.ts +0 -1
  278. package/dist/types/data-structures/trie/trie.d.ts +0 -28
  279. package/dist/types/utils.d.ts +0 -46
  280. package/dist/utils.js +0 -569
  281. package/src/data-structures/trampoline.ts +0 -91
  282. package/src/types/index.ts +0 -1
  283. /package/dist/{types/data-structures/hash/hash-table.d.ts → data-structures/types/singly-linked-list.d.ts} +0 -0
  284. /package/dist/{types → utils}/index.d.ts +0 -0
  285. /package/dist/{types → utils}/index.js +0 -0
  286. /package/dist/{types → utils}/types/index.d.ts +0 -0
  287. /package/{src/types/patches/index.d.ts → tests/unit/data-structures/graph/abstract-graph.ts} +0 -0
@@ -1,24 +1,88 @@
1
- import { AbstractEdge, AbstractGraph, AbstractVertex, VertexId } from './abstract-graph';
1
+ import { AbstractEdge, AbstractGraph, AbstractVertex } from './abstract-graph';
2
+ import type { VertexId } from '../types';
2
3
  export declare class UndirectedVertex extends AbstractVertex {
3
4
  constructor(id: VertexId);
4
5
  }
5
6
  export declare class UndirectedEdge extends AbstractEdge {
7
+ constructor(v1: VertexId, v2: VertexId, weight?: number);
6
8
  private _vertices;
7
9
  get vertices(): [VertexId, VertexId];
8
10
  set vertices(v: [VertexId, VertexId]);
9
- constructor(v1: VertexId, v2: VertexId, weight?: number);
10
11
  }
11
12
  export declare class UndirectedGraph<V extends UndirectedVertex, E extends UndirectedEdge> extends AbstractGraph<V, E> {
12
- constructor();
13
13
  protected _edges: Map<V, E[]>;
14
+ constructor();
15
+ /**
16
+ * The function `getEdge` returns the first edge that connects two vertices, or null if no such edge exists.
17
+ * @param {V | null | VertexId} v1 - The parameter `v1` represents either a vertex object (`V`) or a vertex ID
18
+ * (`VertexId`). It can also be `null`.
19
+ * @param {V | null | VertexId} v2 - The parameter `v2` represents a vertex or vertex ID. It can be of type `V` (vertex
20
+ * object), `null`, or `VertexId` (vertex ID).
21
+ * @returns an edge (E) or null.
22
+ */
14
23
  getEdge(v1: V | null | VertexId, v2: V | null | VertexId): E | null;
24
+ /**
25
+ * The function adds an edge to a graph by connecting two vertices.
26
+ * @param {E} edge - The `edge` parameter is an object of type `E`, which represents an edge in a graph.
27
+ * @returns a boolean value.
28
+ */
15
29
  addEdge(edge: E): boolean;
30
+ /**
31
+ * The function removes an edge between two vertices in a graph and returns the removed edge, or null if either of the
32
+ * vertices does not exist.
33
+ * @param {V | VertexId} v1 - The parameter `v1` represents either a vertex object (`V`) or a vertex ID (`VertexId`).
34
+ * @param {V | VertexId} v2 - V | VertexId: The second vertex or vertex ID of the edge to be removed.
35
+ * @returns the removed edge (E) if it exists, or null if either of the vertices (v1 or v2) does not exist.
36
+ */
16
37
  removeEdgeBetween(v1: V | VertexId, v2: V | VertexId): E | null;
38
+ /**
39
+ * The removeEdge function removes an edge between two vertices in a graph.
40
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
41
+ * @returns The method is returning either the removed edge (of type E) or null if the edge was not found.
42
+ */
17
43
  removeEdge(edge: E): E | null;
44
+ /**
45
+ * The function `degreeOf` returns the degree of a vertex in a graph, which is the number of edges connected to that
46
+ * vertex.
47
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
48
+ * @returns The function `degreeOf` returns the degree of a vertex in a graph. The degree of a vertex is the number of
49
+ * edges that are incident to that vertex.
50
+ */
18
51
  degreeOf(vertexOrId: VertexId | V): number;
52
+ /**
53
+ * The function "edgesOf" returns an array of edges connected to a given vertex.
54
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
55
+ * @returns an array of edges connected to the specified vertex. If the vertex exists in the graph, the function
56
+ * returns the array of edges connected to that vertex. If the vertex does not exist in the graph, the function returns
57
+ * an empty array.
58
+ */
19
59
  edgesOf(vertexOrId: VertexId | V): E[];
60
+ /**
61
+ * The function "edgeSet" returns an array of unique edges from a set of edges.
62
+ * @returns The method `edgeSet()` returns an array of type `E[]`.
63
+ */
20
64
  edgeSet(): E[];
65
+ /**
66
+ * The function "getEdgesOf" returns an array of edges connected to a given vertex or vertex ID.
67
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can accept either a vertex object (`V`) or a vertex ID
68
+ * (`VertexId`).
69
+ * @returns an array of edges (E[]) that are connected to the specified vertex or vertex ID.
70
+ */
21
71
  getEdgesOf(vertexOrId: V | VertexId): E[];
72
+ /**
73
+ * The function "getNeighbors" returns an array of neighboring vertices of a given vertex.
74
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can be either a vertex object (`V`) or a vertex ID
75
+ * (`VertexId`).
76
+ * @returns an array of vertices (V[]).
77
+ */
22
78
  getNeighbors(vertexOrId: V | VertexId): V[];
79
+ /**
80
+ * The function "getEndsOfEdge" returns the vertices at the ends of a given edge, or null if the edge does not exist in
81
+ * the graph.
82
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
83
+ * @returns The function `getEndsOfEdge` returns an array containing two vertices `[V, V]` if the edge exists in the
84
+ * graph and both vertices are found. If the edge does not exist or one or both vertices are not found, it returns
85
+ * `null`.
86
+ */
23
87
  getEndsOfEdge(edge: E): [V, V] | null;
24
88
  }
@@ -1,142 +1,294 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __values = (this && this.__values) || function(o) {
18
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
19
+ if (m) return m.call(o);
20
+ if (o && typeof o.length === "number") return {
21
+ next: function () {
22
+ if (o && i >= o.length) o = void 0;
23
+ return { value: o && o[i++], done: !o };
24
+ }
25
+ };
26
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
27
+ };
28
+ var __read = (this && this.__read) || function (o, n) {
29
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
30
+ if (!m) return o;
31
+ var i = m.call(o), r, ar = [], e;
32
+ try {
33
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
34
+ }
35
+ catch (error) { e = { error: error }; }
36
+ finally {
37
+ try {
38
+ if (r && !r.done && (m = i["return"])) m.call(i);
39
+ }
40
+ finally { if (e) throw e.error; }
41
+ }
42
+ return ar;
43
+ };
44
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
45
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
46
+ if (ar || !(i in from)) {
47
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
48
+ ar[i] = from[i];
49
+ }
50
+ }
51
+ return to.concat(ar || Array.prototype.slice.call(from));
52
+ };
2
53
  Object.defineProperty(exports, "__esModule", { value: true });
3
54
  exports.UndirectedGraph = exports.UndirectedEdge = exports.UndirectedVertex = void 0;
4
- const utils_1 = require("../../utils");
5
- const abstract_graph_1 = require("./abstract-graph");
6
- class UndirectedVertex extends abstract_graph_1.AbstractVertex {
7
- constructor(id) {
8
- super(id);
55
+ /**
56
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
57
+ * @license MIT
58
+ */
59
+ var utils_1 = require("../../utils");
60
+ var abstract_graph_1 = require("./abstract-graph");
61
+ var UndirectedVertex = /** @class */ (function (_super) {
62
+ __extends(UndirectedVertex, _super);
63
+ function UndirectedVertex(id) {
64
+ return _super.call(this, id) || this;
9
65
  }
10
- }
66
+ return UndirectedVertex;
67
+ }(abstract_graph_1.AbstractVertex));
11
68
  exports.UndirectedVertex = UndirectedVertex;
12
- class UndirectedEdge extends abstract_graph_1.AbstractEdge {
13
- get vertices() {
14
- return this._vertices;
69
+ var UndirectedEdge = /** @class */ (function (_super) {
70
+ __extends(UndirectedEdge, _super);
71
+ function UndirectedEdge(v1, v2, weight) {
72
+ var _this = _super.call(this, weight) || this;
73
+ _this._vertices = [v1, v2];
74
+ return _this;
15
75
  }
16
- set vertices(v) {
17
- this._vertices = v;
18
- }
19
- constructor(v1, v2, weight) {
20
- super(weight);
21
- this._vertices = [v1, v2];
22
- }
23
- }
76
+ Object.defineProperty(UndirectedEdge.prototype, "vertices", {
77
+ get: function () {
78
+ return this._vertices;
79
+ },
80
+ set: function (v) {
81
+ this._vertices = v;
82
+ },
83
+ enumerable: false,
84
+ configurable: true
85
+ });
86
+ return UndirectedEdge;
87
+ }(abstract_graph_1.AbstractEdge));
24
88
  exports.UndirectedEdge = UndirectedEdge;
25
- class UndirectedGraph extends abstract_graph_1.AbstractGraph {
26
- constructor() {
27
- super();
28
- this._edges = new Map();
89
+ var UndirectedGraph = /** @class */ (function (_super) {
90
+ __extends(UndirectedGraph, _super);
91
+ function UndirectedGraph() {
92
+ var _this = _super.call(this) || this;
93
+ _this._edges = new Map();
94
+ return _this;
29
95
  }
30
- getEdge(v1, v2) {
96
+ /**
97
+ * The function `getEdge` returns the first edge that connects two vertices, or null if no such edge exists.
98
+ * @param {V | null | VertexId} v1 - The parameter `v1` represents either a vertex object (`V`) or a vertex ID
99
+ * (`VertexId`). It can also be `null`.
100
+ * @param {V | null | VertexId} v2 - The parameter `v2` represents a vertex or vertex ID. It can be of type `V` (vertex
101
+ * object), `null`, or `VertexId` (vertex ID).
102
+ * @returns an edge (E) or null.
103
+ */
104
+ UndirectedGraph.prototype.getEdge = function (v1, v2) {
31
105
  var _a;
32
- let edges = [];
106
+ var edges = [];
33
107
  if (v1 !== null && v2 !== null) {
34
- const vertex1 = this.getVertex(v1);
35
- const vertex2 = this.getVertex(v2);
36
- if (vertex1 && vertex2) {
37
- edges = (_a = this._edges.get(vertex1)) === null || _a === void 0 ? void 0 : _a.filter(e => e.vertices.includes(vertex2.id));
108
+ var vertex1 = this.getVertex(v1);
109
+ var vertex2_1 = this.getVertex(v2);
110
+ if (vertex1 && vertex2_1) {
111
+ edges = (_a = this._edges.get(vertex1)) === null || _a === void 0 ? void 0 : _a.filter(function (e) { return e.vertices.includes(vertex2_1.id); });
38
112
  }
39
113
  }
40
114
  return edges ? edges[0] || null : null;
41
- }
42
- addEdge(edge) {
43
- for (const end of edge.vertices) {
44
- const endVertex = this.getVertex(end);
45
- if (endVertex === null)
46
- return false;
47
- if (endVertex) {
48
- const edges = this._edges.get(endVertex);
49
- if (edges) {
50
- edges.push(edge);
51
- }
52
- else {
53
- this._edges.set(endVertex, [edge]);
115
+ };
116
+ /**
117
+ * The function adds an edge to a graph by connecting two vertices.
118
+ * @param {E} edge - The `edge` parameter is an object of type `E`, which represents an edge in a graph.
119
+ * @returns a boolean value.
120
+ */
121
+ UndirectedGraph.prototype.addEdge = function (edge) {
122
+ var e_1, _a;
123
+ try {
124
+ for (var _b = __values(edge.vertices), _c = _b.next(); !_c.done; _c = _b.next()) {
125
+ var end = _c.value;
126
+ var endVertex = this.getVertex(end);
127
+ if (endVertex === null)
128
+ return false;
129
+ if (endVertex) {
130
+ var edges = this._edges.get(endVertex);
131
+ if (edges) {
132
+ edges.push(edge);
133
+ }
134
+ else {
135
+ this._edges.set(endVertex, [edge]);
136
+ }
54
137
  }
55
138
  }
56
139
  }
140
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
141
+ finally {
142
+ try {
143
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
144
+ }
145
+ finally { if (e_1) throw e_1.error; }
146
+ }
57
147
  return true;
58
- }
59
- removeEdgeBetween(v1, v2) {
60
- const vertex1 = this.getVertex(v1);
61
- const vertex2 = this.getVertex(v2);
148
+ };
149
+ /**
150
+ * The function removes an edge between two vertices in a graph and returns the removed edge, or null if either of the
151
+ * vertices does not exist.
152
+ * @param {V | VertexId} v1 - The parameter `v1` represents either a vertex object (`V`) or a vertex ID (`VertexId`).
153
+ * @param {V | VertexId} v2 - V | VertexId: The second vertex or vertex ID of the edge to be removed.
154
+ * @returns the removed edge (E) if it exists, or null if either of the vertices (v1 or v2) does not exist.
155
+ */
156
+ UndirectedGraph.prototype.removeEdgeBetween = function (v1, v2) {
157
+ var vertex1 = this.getVertex(v1);
158
+ var vertex2 = this.getVertex(v2);
62
159
  if (!vertex1 || !vertex2) {
63
160
  return null;
64
161
  }
65
- const v1Edges = this._edges.get(vertex1);
66
- let removed = null;
162
+ var v1Edges = this._edges.get(vertex1);
163
+ var removed = null;
67
164
  if (v1Edges) {
68
- removed = (0, utils_1.arrayRemove)(v1Edges, e => e.vertices.includes(vertex2.id))[0] || null;
165
+ removed = (0, utils_1.arrayRemove)(v1Edges, function (e) { return e.vertices.includes(vertex2.id); })[0] || null;
69
166
  }
70
- const v2Edges = this._edges.get(vertex2);
167
+ var v2Edges = this._edges.get(vertex2);
71
168
  if (v2Edges) {
72
- (0, utils_1.arrayRemove)(v2Edges, e => e.vertices.includes(vertex1.id));
169
+ (0, utils_1.arrayRemove)(v2Edges, function (e) { return e.vertices.includes(vertex1.id); });
73
170
  }
74
171
  return removed;
75
- }
76
- removeEdge(edge) {
172
+ };
173
+ /**
174
+ * The removeEdge function removes an edge between two vertices in a graph.
175
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
176
+ * @returns The method is returning either the removed edge (of type E) or null if the edge was not found.
177
+ */
178
+ UndirectedGraph.prototype.removeEdge = function (edge) {
77
179
  return this.removeEdgeBetween(edge.vertices[0], edge.vertices[1]);
78
- }
79
- degreeOf(vertexOrId) {
180
+ };
181
+ /**
182
+ * The function `degreeOf` returns the degree of a vertex in a graph, which is the number of edges connected to that
183
+ * vertex.
184
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
185
+ * @returns The function `degreeOf` returns the degree of a vertex in a graph. The degree of a vertex is the number of
186
+ * edges that are incident to that vertex.
187
+ */
188
+ UndirectedGraph.prototype.degreeOf = function (vertexOrId) {
80
189
  var _a;
81
- const vertex = this.getVertex(vertexOrId);
190
+ var vertex = this.getVertex(vertexOrId);
82
191
  if (vertex) {
83
192
  return ((_a = this._edges.get(vertex)) === null || _a === void 0 ? void 0 : _a.length) || 0;
84
193
  }
85
194
  else {
86
195
  return 0;
87
196
  }
88
- }
89
- edgesOf(vertexOrId) {
90
- const vertex = this.getVertex(vertexOrId);
197
+ };
198
+ /**
199
+ * The function "edgesOf" returns an array of edges connected to a given vertex.
200
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
201
+ * @returns an array of edges connected to the specified vertex. If the vertex exists in the graph, the function
202
+ * returns the array of edges connected to that vertex. If the vertex does not exist in the graph, the function returns
203
+ * an empty array.
204
+ */
205
+ UndirectedGraph.prototype.edgesOf = function (vertexOrId) {
206
+ var vertex = this.getVertex(vertexOrId);
91
207
  if (vertex) {
92
208
  return this._edges.get(vertex) || [];
93
209
  }
94
210
  else {
95
211
  return [];
96
212
  }
97
- }
98
- edgeSet() {
99
- const edgeSet = new Set();
100
- this._edges.forEach(edges => {
101
- edges.forEach(edge => {
213
+ };
214
+ /**
215
+ * The function "edgeSet" returns an array of unique edges from a set of edges.
216
+ * @returns The method `edgeSet()` returns an array of type `E[]`.
217
+ */
218
+ UndirectedGraph.prototype.edgeSet = function () {
219
+ var edgeSet = new Set();
220
+ this._edges.forEach(function (edges) {
221
+ edges.forEach(function (edge) {
102
222
  edgeSet.add(edge);
103
223
  });
104
224
  });
105
- return [...edgeSet];
106
- }
107
- getEdgesOf(vertexOrId) {
108
- const vertex = this.getVertex(vertexOrId);
225
+ return __spreadArray([], __read(edgeSet), false);
226
+ };
227
+ /**
228
+ * The function "getEdgesOf" returns an array of edges connected to a given vertex or vertex ID.
229
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can accept either a vertex object (`V`) or a vertex ID
230
+ * (`VertexId`).
231
+ * @returns an array of edges (E[]) that are connected to the specified vertex or vertex ID.
232
+ */
233
+ UndirectedGraph.prototype.getEdgesOf = function (vertexOrId) {
234
+ var vertex = this.getVertex(vertexOrId);
109
235
  if (!vertex) {
110
236
  return [];
111
237
  }
112
238
  return this._edges.get(vertex) || [];
113
- }
114
- getNeighbors(vertexOrId) {
115
- const neighbors = [];
116
- const vertex = this.getVertex(vertexOrId);
239
+ };
240
+ /**
241
+ * The function "getNeighbors" returns an array of neighboring vertices of a given vertex.
242
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can be either a vertex object (`V`) or a vertex ID
243
+ * (`VertexId`).
244
+ * @returns an array of vertices (V[]).
245
+ */
246
+ UndirectedGraph.prototype.getNeighbors = function (vertexOrId) {
247
+ var e_2, _a;
248
+ var neighbors = [];
249
+ var vertex = this.getVertex(vertexOrId);
117
250
  if (vertex) {
118
- const neighborEdges = this.getEdgesOf(vertex);
119
- for (const edge of neighborEdges) {
120
- const neighbor = this.getVertex(edge.vertices.filter(e => e !== vertex.id)[0]);
121
- if (neighbor) {
122
- neighbors.push(neighbor);
251
+ var neighborEdges = this.getEdgesOf(vertex);
252
+ try {
253
+ for (var neighborEdges_1 = __values(neighborEdges), neighborEdges_1_1 = neighborEdges_1.next(); !neighborEdges_1_1.done; neighborEdges_1_1 = neighborEdges_1.next()) {
254
+ var edge = neighborEdges_1_1.value;
255
+ var neighbor = this.getVertex(edge.vertices.filter(function (e) { return e !== vertex.id; })[0]);
256
+ if (neighbor) {
257
+ neighbors.push(neighbor);
258
+ }
259
+ }
260
+ }
261
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
262
+ finally {
263
+ try {
264
+ if (neighborEdges_1_1 && !neighborEdges_1_1.done && (_a = neighborEdges_1.return)) _a.call(neighborEdges_1);
123
265
  }
266
+ finally { if (e_2) throw e_2.error; }
124
267
  }
125
268
  }
126
269
  return neighbors;
127
- }
128
- getEndsOfEdge(edge) {
270
+ };
271
+ /**
272
+ * The function "getEndsOfEdge" returns the vertices at the ends of a given edge, or null if the edge does not exist in
273
+ * the graph.
274
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
275
+ * @returns The function `getEndsOfEdge` returns an array containing two vertices `[V, V]` if the edge exists in the
276
+ * graph and both vertices are found. If the edge does not exist or one or both vertices are not found, it returns
277
+ * `null`.
278
+ */
279
+ UndirectedGraph.prototype.getEndsOfEdge = function (edge) {
129
280
  if (!this.containsEdge(edge.vertices[0], edge.vertices[1])) {
130
281
  return null;
131
282
  }
132
- const v1 = this.getVertex(edge.vertices[0]);
133
- const v2 = this.getVertex(edge.vertices[1]);
283
+ var v1 = this.getVertex(edge.vertices[0]);
284
+ var v2 = this.getVertex(edge.vertices[1]);
134
285
  if (v1 && v2) {
135
286
  return [v1, v2];
136
287
  }
137
288
  else {
138
289
  return null;
139
290
  }
140
- }
141
- }
291
+ };
292
+ return UndirectedGraph;
293
+ }(abstract_graph_1.AbstractGraph));
142
294
  exports.UndirectedGraph = UndirectedGraph;
@@ -1,8 +1,40 @@
1
- export declare class CoordinateSet<V> extends Map<any, V> {
1
+ /**
2
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
3
+ * @license MIT
4
+ */
5
+ export declare class CoordinateMap<V> extends Map<any, V> {
2
6
  private readonly _joint;
3
7
  constructor(joint?: string);
8
+ /**
9
+ * The "has" function overrides the base class's "has" function and checks if a key exists in the map by joining the
10
+ * key array with a specified delimiter.
11
+ * @param {number[]} key - The parameter "key" is an array of numbers.
12
+ * @returns The `has` method is being overridden to return the result of calling the `has` method of the superclass
13
+ * (`super.has`) with the `key` array joined together using the `_joint` property.
14
+ */
4
15
  has(key: number[]): boolean;
16
+ /**
17
+ * The function overrides the set method of a Map object to convert the key from an array to a string using a specified
18
+ * delimiter before calling the original set method.
19
+ * @param {number[]} key - The key parameter is an array of numbers.
20
+ * @param {V} value - The value parameter is the value that you want to associate with the specified key.
21
+ * @returns The `set` method is returning the result of calling the `set` method of the superclass
22
+ * (`super.set(key.join(this._joint), value)`).
23
+ */
5
24
  set(key: number[], value: V): this;
25
+ /**
26
+ * The function overrides the get method to join the key array with a specified joint and then calls the super get
27
+ * method.
28
+ * @param {number[]} key - An array of numbers
29
+ * @returns The code is returning the value associated with the specified key in the map.
30
+ */
6
31
  get(key: number[]): V | undefined;
32
+ /**
33
+ * The function overrides the delete method and joins the key array using a specified joint character before calling
34
+ * the super delete method.
35
+ * @param {number[]} key - An array of numbers that represents the key to be deleted.
36
+ * @returns The `delete` method is returning the result of calling the `delete` method on the superclass, with the
37
+ * `key` array joined together using the `_joint` property.
38
+ */
7
39
  delete(key: number[]): boolean;
8
40
  }
@@ -1,24 +1,74 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CoordinateSet = void 0;
4
- class CoordinateSet extends Map {
5
- constructor(joint) {
6
- super();
7
- this._joint = '_';
18
+ exports.CoordinateMap = void 0;
19
+ /**
20
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
21
+ * @license MIT
22
+ */
23
+ var CoordinateMap = /** @class */ (function (_super) {
24
+ __extends(CoordinateMap, _super);
25
+ function CoordinateMap(joint) {
26
+ var _this = _super.call(this) || this;
27
+ _this._joint = '_';
8
28
  if (joint !== undefined)
9
- this._joint = joint;
29
+ _this._joint = joint;
30
+ return _this;
10
31
  }
11
- has(key) {
12
- return super.has(key.join(this._joint));
13
- }
14
- set(key, value) {
15
- return super.set(key.join(this._joint), value);
16
- }
17
- get(key) {
18
- return super.get(key.join(this._joint));
19
- }
20
- delete(key) {
21
- return super.delete(key.join(this._joint));
22
- }
23
- }
24
- exports.CoordinateSet = CoordinateSet;
32
+ /**
33
+ * The "has" function overrides the base class's "has" function and checks if a key exists in the map by joining the
34
+ * key array with a specified delimiter.
35
+ * @param {number[]} key - The parameter "key" is an array of numbers.
36
+ * @returns The `has` method is being overridden to return the result of calling the `has` method of the superclass
37
+ * (`super.has`) with the `key` array joined together using the `_joint` property.
38
+ */
39
+ CoordinateMap.prototype.has = function (key) {
40
+ return _super.prototype.has.call(this, key.join(this._joint));
41
+ };
42
+ /**
43
+ * The function overrides the set method of a Map object to convert the key from an array to a string using a specified
44
+ * delimiter before calling the original set method.
45
+ * @param {number[]} key - The key parameter is an array of numbers.
46
+ * @param {V} value - The value parameter is the value that you want to associate with the specified key.
47
+ * @returns The `set` method is returning the result of calling the `set` method of the superclass
48
+ * (`super.set(key.join(this._joint), value)`).
49
+ */
50
+ CoordinateMap.prototype.set = function (key, value) {
51
+ return _super.prototype.set.call(this, key.join(this._joint), value);
52
+ };
53
+ /**
54
+ * The function overrides the get method to join the key array with a specified joint and then calls the super get
55
+ * method.
56
+ * @param {number[]} key - An array of numbers
57
+ * @returns The code is returning the value associated with the specified key in the map.
58
+ */
59
+ CoordinateMap.prototype.get = function (key) {
60
+ return _super.prototype.get.call(this, key.join(this._joint));
61
+ };
62
+ /**
63
+ * The function overrides the delete method and joins the key array using a specified joint character before calling
64
+ * the super delete method.
65
+ * @param {number[]} key - An array of numbers that represents the key to be deleted.
66
+ * @returns The `delete` method is returning the result of calling the `delete` method on the superclass, with the
67
+ * `key` array joined together using the `_joint` property.
68
+ */
69
+ CoordinateMap.prototype.delete = function (key) {
70
+ return _super.prototype.delete.call(this, key.join(this._joint));
71
+ };
72
+ return CoordinateMap;
73
+ }(Map));
74
+ exports.CoordinateMap = CoordinateMap;
@@ -1,7 +1,32 @@
1
+ /**
2
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
3
+ * @license MIT
4
+ */
1
5
  export declare class CoordinateSet extends Set {
2
6
  private readonly _joint;
3
7
  constructor(joint?: string);
8
+ /**
9
+ * The "has" function overrides the "has" method of the superclass and checks if a value exists in an array after
10
+ * joining its elements with a specified separator.
11
+ * @param {number[]} value - The parameter "value" is an array of numbers.
12
+ * @returns The overridden `has` method is returning the result of calling the `has` method of the superclass, passing
13
+ * in the joined value as an argument.
14
+ */
4
15
  has(value: number[]): boolean;
16
+ /**
17
+ * The "add" function overrides the parent class's "add" function by joining the elements of the input array with a
18
+ * specified delimiter before calling the parent class's "add" function.
19
+ * @param {number[]} value - An array of numbers
20
+ * @returns The overridden `add` method is returning the result of calling the `add` method of the superclass
21
+ * (`super.add`) with the joined string representation of the `value` array (`value.join(this._joint)`).
22
+ */
5
23
  add(value: number[]): this;
24
+ /**
25
+ * The function overrides the delete method and deletes an element from a Set by joining the elements of the input
26
+ * array with a specified joint and then calling the delete method of the parent class.
27
+ * @param {number[]} value - An array of numbers
28
+ * @returns The `delete` method is returning the result of calling the `delete` method of the superclass, with the
29
+ * `value` array joined together using the `_joint` property.
30
+ */
6
31
  delete(value: number[]): boolean;
7
32
  }