data-structure-typed 0.9.16 → 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 (199) hide show
  1. package/.dependency-cruiser.js +449 -0
  2. package/.idea/data-structure-typed.iml +2 -0
  3. package/README.md +102 -1
  4. package/dist/data-structures/binary-tree/avl-tree.d.ts +57 -0
  5. package/dist/data-structures/binary-tree/avl-tree.js +57 -0
  6. package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +27 -0
  7. package/dist/data-structures/binary-tree/binary-indexed-tree.js +27 -0
  8. package/dist/data-structures/binary-tree/binary-tree.d.ts +215 -9
  9. package/dist/data-structures/binary-tree/binary-tree.js +283 -15
  10. package/dist/data-structures/binary-tree/bst.d.ts +16 -0
  11. package/dist/data-structures/binary-tree/bst.js +12 -0
  12. package/dist/data-structures/binary-tree/segment-tree.d.ts +4 -0
  13. package/dist/data-structures/binary-tree/segment-tree.js +4 -0
  14. package/dist/data-structures/binary-tree/tree-multiset.d.ts +4 -0
  15. package/dist/data-structures/binary-tree/tree-multiset.js +4 -0
  16. package/dist/data-structures/graph/abstract-graph.d.ts +163 -13
  17. package/dist/data-structures/graph/abstract-graph.js +166 -12
  18. package/dist/data-structures/graph/directed-graph.d.ts +111 -1
  19. package/dist/data-structures/graph/directed-graph.js +122 -0
  20. package/dist/data-structures/graph/undirected-graph.d.ts +63 -0
  21. package/dist/data-structures/graph/undirected-graph.js +67 -0
  22. package/dist/data-structures/hash/coordinate-map.d.ts +32 -0
  23. package/dist/data-structures/hash/coordinate-map.js +32 -0
  24. package/dist/data-structures/hash/coordinate-set.d.ts +25 -0
  25. package/dist/data-structures/hash/coordinate-set.js +25 -0
  26. package/dist/data-structures/heap/heap.d.ts +26 -31
  27. package/dist/data-structures/heap/heap.js +23 -32
  28. package/dist/data-structures/heap/max-heap.d.ts +6 -1
  29. package/dist/data-structures/heap/max-heap.js +6 -1
  30. package/dist/data-structures/heap/min-heap.d.ts +7 -1
  31. package/dist/data-structures/heap/min-heap.js +7 -1
  32. package/dist/data-structures/index.d.ts +0 -1
  33. package/dist/data-structures/index.js +0 -1
  34. package/dist/data-structures/linked-list/doubly-linked-list.d.ts +14 -6
  35. package/dist/data-structures/linked-list/doubly-linked-list.js +45 -8
  36. package/dist/data-structures/linked-list/singly-linked-list.d.ts +11 -8
  37. package/dist/data-structures/linked-list/singly-linked-list.js +4 -0
  38. package/dist/data-structures/matrix/matrix.d.ts +9 -0
  39. package/dist/data-structures/matrix/matrix.js +11 -0
  40. package/dist/data-structures/matrix/matrix2d.d.ts +82 -2
  41. package/dist/data-structures/matrix/matrix2d.js +82 -2
  42. package/dist/data-structures/matrix/navigator.d.ts +32 -0
  43. package/dist/data-structures/matrix/navigator.js +28 -0
  44. package/dist/data-structures/matrix/vector2d.d.ts +139 -15
  45. package/dist/data-structures/matrix/vector2d.js +139 -15
  46. package/dist/data-structures/priority-queue/max-priority-queue.d.ts +8 -0
  47. package/dist/data-structures/priority-queue/max-priority-queue.js +8 -0
  48. package/dist/data-structures/priority-queue/min-priority-queue.d.ts +8 -0
  49. package/dist/data-structures/priority-queue/min-priority-queue.js +8 -0
  50. package/dist/data-structures/priority-queue/priority-queue.d.ts +130 -0
  51. package/dist/data-structures/priority-queue/priority-queue.js +126 -0
  52. package/dist/data-structures/queue/deque.d.ts +69 -0
  53. package/dist/data-structures/queue/deque.js +69 -0
  54. package/dist/data-structures/queue/queue.d.ts +30 -32
  55. package/dist/data-structures/queue/queue.js +30 -32
  56. package/dist/data-structures/stack/stack.d.ts +26 -31
  57. package/dist/data-structures/stack/stack.js +26 -31
  58. package/dist/data-structures/trie/trie.d.ts +26 -6
  59. package/dist/data-structures/trie/trie.js +26 -7
  60. package/dist/data-structures/types/avl-tree.d.ts +1 -1
  61. package/dist/data-structures/types/binary-tree.d.ts +1 -1
  62. package/dist/data-structures/types/index.d.ts +1 -1
  63. package/dist/data-structures/types/index.js +1 -1
  64. package/dist/data-structures/types/singly-linked-list.d.ts +1 -5
  65. package/dist/data-structures/types/tree-multiset.d.ts +1 -1
  66. package/dist/{data-structures → utils}/trampoline.d.ts +5 -7
  67. package/dist/utils/types/index.d.ts +1 -0
  68. package/dist/utils/types/index.js +17 -0
  69. package/dist/{data-structures → utils}/types/utils.d.ts +8 -0
  70. package/dist/{data-structures → utils}/types/utils.js +1 -0
  71. package/dist/utils/utils.d.ts +1 -1
  72. package/docs/.nojekyll +1 -0
  73. package/docs/assets/highlight.css +85 -0
  74. package/docs/assets/main.js +58 -0
  75. package/docs/assets/search.js +1 -0
  76. package/docs/assets/style.css +1367 -0
  77. package/docs/classes/AVLTree.html +2046 -0
  78. package/docs/classes/AVLTreeNode.html +423 -0
  79. package/docs/classes/AaTree.html +117 -0
  80. package/docs/classes/AbstractEdge.html +198 -0
  81. package/docs/classes/AbstractGraph.html +891 -0
  82. package/docs/classes/AbstractVertex.html +164 -0
  83. package/docs/classes/ArrayDeque.html +384 -0
  84. package/docs/classes/BST.html +1893 -0
  85. package/docs/classes/BSTNode.html +425 -0
  86. package/docs/classes/BTree.html +117 -0
  87. package/docs/classes/BinaryIndexedTree.html +244 -0
  88. package/docs/classes/BinaryTree.html +1754 -0
  89. package/docs/classes/BinaryTreeNode.html +396 -0
  90. package/docs/classes/Character.html +165 -0
  91. package/docs/classes/CoordinateMap.html +394 -0
  92. package/docs/classes/CoordinateSet.html +355 -0
  93. package/docs/classes/Deque.html +617 -0
  94. package/docs/classes/DirectedEdge.html +247 -0
  95. package/docs/classes/DirectedGraph.html +1207 -0
  96. package/docs/classes/DirectedVertex.html +154 -0
  97. package/docs/classes/DoublyLinkedList.html +619 -0
  98. package/docs/classes/DoublyLinkedListNode.html +160 -0
  99. package/docs/classes/Heap.html +315 -0
  100. package/docs/classes/Matrix2D.html +447 -0
  101. package/docs/classes/MatrixNTI2D.html +181 -0
  102. package/docs/classes/MaxHeap.html +325 -0
  103. package/docs/classes/MaxPriorityQueue.html +668 -0
  104. package/docs/classes/MinHeap.html +326 -0
  105. package/docs/classes/MinPriorityQueue.html +668 -0
  106. package/docs/classes/Navigator.html +285 -0
  107. package/docs/classes/ObjectDeque.html +289 -0
  108. package/docs/classes/PriorityQueue.html +643 -0
  109. package/docs/classes/Queue.html +337 -0
  110. package/docs/classes/RBTree.html +117 -0
  111. package/docs/classes/SegmentTree.html +234 -0
  112. package/docs/classes/SegmentTreeNode.html +302 -0
  113. package/docs/classes/SinglyLinkedList.html +1035 -0
  114. package/docs/classes/SinglyLinkedListNode.html +304 -0
  115. package/docs/classes/SplayTree.html +117 -0
  116. package/docs/classes/Stack.html +313 -0
  117. package/docs/classes/TreeMultiSet.html +1897 -0
  118. package/docs/classes/Trie.html +317 -0
  119. package/docs/classes/TrieNode.html +221 -0
  120. package/docs/classes/TwoThreeTree.html +117 -0
  121. package/docs/classes/UndirectedEdge.html +220 -0
  122. package/docs/classes/UndirectedGraph.html +1006 -0
  123. package/docs/classes/UndirectedVertex.html +154 -0
  124. package/docs/classes/Vector2D.html +746 -0
  125. package/docs/enums/CP.html +126 -0
  126. package/docs/enums/FamilyPosition.html +126 -0
  127. package/docs/enums/LoopType.html +119 -0
  128. package/docs/index.html +288 -0
  129. package/docs/modules.html +146 -0
  130. package/jest.config.js +5 -0
  131. package/package.json +19 -11
  132. package/rename_clear_files.sh +29 -0
  133. package/src/assets/complexities-diff.jpg +0 -0
  134. package/src/assets/data-structure-complexities.jpg +0 -0
  135. package/src/data-structures/binary-tree/avl-tree.ts +57 -0
  136. package/src/data-structures/binary-tree/binary-indexed-tree.ts +27 -0
  137. package/src/data-structures/binary-tree/binary-tree.ts +288 -18
  138. package/src/data-structures/binary-tree/bst.ts +16 -1
  139. package/src/data-structures/binary-tree/segment-tree.ts +5 -0
  140. package/src/data-structures/binary-tree/tree-multiset.ts +4 -0
  141. package/src/data-structures/diagrams/README.md +5 -7
  142. package/src/data-structures/graph/abstract-graph.ts +167 -15
  143. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.jpg +0 -0
  144. package/src/data-structures/graph/diagrams/adjacency-list.jpg +0 -0
  145. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.jpg +0 -0
  146. package/src/data-structures/graph/diagrams/adjacency-matrix.jpg +0 -0
  147. package/src/data-structures/graph/diagrams/dfs-can-do.jpg +0 -0
  148. package/src/data-structures/graph/diagrams/edge-list-pros-cons.jpg +0 -0
  149. package/src/data-structures/graph/diagrams/edge-list.jpg +0 -0
  150. package/src/data-structures/graph/diagrams/max-flow.jpg +0 -0
  151. package/src/data-structures/graph/diagrams/mst.jpg +0 -0
  152. package/src/data-structures/graph/diagrams/tarjan.webp +0 -0
  153. package/src/data-structures/graph/directed-graph.ts +127 -5
  154. package/src/data-structures/graph/undirected-graph.ts +67 -1
  155. package/src/data-structures/hash/coordinate-map.ts +32 -0
  156. package/src/data-structures/hash/coordinate-set.ts +25 -0
  157. package/src/data-structures/heap/heap.ts +27 -32
  158. package/src/data-structures/heap/max-heap.ts +6 -1
  159. package/src/data-structures/heap/min-heap.ts +7 -1
  160. package/src/data-structures/index.ts +0 -1
  161. package/src/data-structures/linked-list/doubly-linked-list.ts +49 -8
  162. package/src/data-structures/linked-list/singly-linked-list.ts +39 -8
  163. package/src/data-structures/matrix/matrix.ts +11 -0
  164. package/src/data-structures/matrix/matrix2d.ts +82 -2
  165. package/src/data-structures/matrix/navigator.ts +32 -0
  166. package/src/data-structures/matrix/vector2d.ts +139 -15
  167. package/src/data-structures/priority-queue/max-priority-queue.ts +8 -0
  168. package/src/data-structures/priority-queue/min-priority-queue.ts +8 -0
  169. package/src/data-structures/priority-queue/priority-queue.ts +130 -0
  170. package/src/data-structures/queue/deque.ts +69 -0
  171. package/src/data-structures/queue/queue.ts +30 -32
  172. package/src/data-structures/stack/stack.ts +26 -31
  173. package/src/data-structures/trie/trie.ts +26 -7
  174. package/src/data-structures/types/avl-tree.ts +1 -1
  175. package/src/data-structures/types/binary-tree.ts +1 -1
  176. package/src/data-structures/types/bst.ts +1 -1
  177. package/src/data-structures/types/index.ts +1 -1
  178. package/src/data-structures/types/navigator.ts +1 -0
  179. package/src/data-structures/types/singly-linked-list.ts +1 -15
  180. package/src/data-structures/types/tree-multiset.ts +1 -1
  181. package/src/{data-structures → utils}/trampoline.ts +6 -6
  182. package/src/utils/types/index.ts +1 -0
  183. package/src/{data-structures → utils}/types/utils.ts +7 -0
  184. package/src/utils/utils.ts +12 -2
  185. package/tests/unit/data-structures/binary-tree/bst.test.ts +185 -0
  186. package/tests/unit/data-structures/graph/abstract-graph.ts +0 -0
  187. package/tests/unit/data-structures/graph/directed-graph.test.ts +71 -0
  188. package/tests/unit/data-structures/graph/index.ts +3 -0
  189. package/tests/unit/data-structures/graph/undirected-graph.ts +0 -0
  190. package/src/data-structures/graph/diagrams/adjacency-list-pros-cons.png +0 -0
  191. package/src/data-structures/graph/diagrams/adjacency-list.png +0 -0
  192. package/src/data-structures/graph/diagrams/adjacency-matrix-pros-cons.png +0 -0
  193. package/src/data-structures/graph/diagrams/adjacency-matrix.png +0 -0
  194. package/src/data-structures/graph/diagrams/dfs-can-do.png +0 -0
  195. package/src/data-structures/graph/diagrams/edge-list-pros-cons.png +0 -0
  196. package/src/data-structures/graph/diagrams/edge-list.png +0 -0
  197. package/src/data-structures/graph/diagrams/max-flow.png +0 -0
  198. package/src/data-structures/graph/diagrams/mst.png +0 -0
  199. /package/dist/{data-structures → utils}/trampoline.js +0 -0
@@ -16,28 +16,138 @@ export declare class DirectedGraph<V extends DirectedVertex, E extends DirectedE
16
16
  protected _outEdgeMap: Map<V, E[]>;
17
17
  protected _inEdgeMap: Map<V, E[]>;
18
18
  constructor();
19
+ /**
20
+ * The function `getEdge` returns the first edge between two vertices, given their source and destination.
21
+ * @param {V | null | VertexId} srcOrId - The `srcOrId` parameter can be either a vertex object (`V`), a vertex ID
22
+ * (`VertexId`), or `null`. It represents the source vertex of the edge.
23
+ * @param {V | null | VertexId} destOrId - The `destOrId` parameter is either a vertex object (`V`), a vertex ID
24
+ * (`VertexId`), or `null`. It represents the destination vertex of the edge.
25
+ * @returns an edge (E) or null.
26
+ */
19
27
  getEdge(srcOrId: V | null | VertexId, destOrId: V | null | VertexId): E | null;
28
+ /**
29
+ * The `addEdge` function adds an edge to a graph if the source and destination vertices exist.
30
+ * @param {E} edge - The parameter `edge` is of type `E`, which represents an edge in the graph. It contains
31
+ * information about the source vertex (`src`) and the destination vertex (`dest`) of the edge.
32
+ * @returns The `addEdge` function returns a boolean value. It returns `true` if the edge was successfully added to the
33
+ * graph, and `false` if either the source or destination vertices of the edge are not present in the graph.
34
+ */
20
35
  addEdge(edge: E): boolean;
36
+ /**
37
+ * The function removes an edge between two vertices in a directed graph and returns the removed edge.
38
+ * @param {V | VertexId} srcOrId - The source vertex or its ID.
39
+ * @param {V | VertexId} destOrId - The `destOrId` parameter in the `removeEdgeBetween` function represents the
40
+ * destination vertex of the edge that needs to be removed. It can be either a vertex object (`V`) or a vertex ID
41
+ * (`VertexId`).
42
+ * @returns The function `removeEdgeBetween` returns the removed edge (`E`) if the edge between the source and
43
+ * destination vertices is successfully removed. If either the source or destination vertex is not found, or if the
44
+ * edge does not exist, it returns `null`.
45
+ */
21
46
  removeEdgeBetween(srcOrId: V | VertexId, destOrId: V | VertexId): E | null;
47
+ /**
48
+ * The removeEdge function removes an edge from a graph and returns the removed edge, or null if the edge was not
49
+ * found.
50
+ * @param {E} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
51
+ * and `dest`, which represent the source and destination vertices of the edge, respectively.
52
+ * @returns The method `removeEdge` returns the removed edge (`E`) if it exists, or `null` if the edge does not exist.
53
+ */
22
54
  removeEdge(edge: E): E | null;
55
+ /**
56
+ * The function removeAllEdges removes all edges between two vertices.
57
+ * @param {VertexId | V} src - The `src` parameter represents the source vertex from which the edges will be removed.
58
+ * It can be either a `VertexId` or a `V` type, which represents the identifier or object of the vertex.
59
+ * @param {VertexId | V} dest - The `dest` parameter represents the destination vertex of an edge. It can be either a
60
+ * `VertexId` or a vertex object `V`.
61
+ * @returns An empty array is being returned.
62
+ */
23
63
  removeAllEdges(src: VertexId | V, dest: VertexId | V): E[];
64
+ /**
65
+ * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
66
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can be either a vertex object (`V`) or a vertex ID
67
+ * (`VertexId`).
68
+ * @returns The method `incomingEdgesOf` returns an array of edges (`E[]`).
69
+ */
24
70
  incomingEdgesOf(vertexOrId: V | VertexId): E[];
71
+ /**
72
+ * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
73
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can accept either a vertex object (`V`) or a vertex ID
74
+ * (`VertexId`).
75
+ * @returns The method `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
76
+ */
25
77
  outgoingEdgesOf(vertexOrId: V | VertexId): E[];
78
+ /**
79
+ * The function "degreeOf" returns the total degree of a vertex, which is the sum of its out-degree and in-degree.
80
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
81
+ * @returns the sum of the out-degree and in-degree of the specified vertex or vertex ID.
82
+ */
26
83
  degreeOf(vertexOrId: VertexId | V): number;
84
+ /**
85
+ * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
86
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
87
+ * @returns The number of incoming edges of the specified vertex or vertex ID.
88
+ */
27
89
  inDegreeOf(vertexOrId: VertexId | V): number;
90
+ /**
91
+ * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
92
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
93
+ * @returns The number of outgoing edges from the specified vertex or vertex ID.
94
+ */
28
95
  outDegreeOf(vertexOrId: VertexId | V): number;
96
+ /**
97
+ * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
98
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
99
+ * @returns The function `edgesOf` returns an array of edges.
100
+ */
29
101
  edgesOf(vertexOrId: VertexId | V): E[];
102
+ /**
103
+ * The function "getEdgeSrc" returns the source vertex of an edge, or null if the edge does not exist.
104
+ * @param {E} e - E - an edge object
105
+ * @returns the source vertex of the given edge, or null if the edge does not exist.
106
+ */
30
107
  getEdgeSrc(e: E): V | null;
108
+ /**
109
+ * The function "getEdgeDest" returns the vertex associated with the destination of an edge.
110
+ * @param {E} e - The parameter `e` is of type `E`, which represents an edge in a graph.
111
+ * @returns either a vertex object (of type V) or null.
112
+ */
31
113
  getEdgeDest(e: E): V | null;
114
+ /**
115
+ * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
116
+ * @param {V | VertexId | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
117
+ * find the destinations. It can be either a `V` object, a `VertexId` (which is a unique identifier for a vertex), or
118
+ * `null` if we want to find destinations from all vertices.
119
+ * @returns an array of vertices (V[]).
120
+ */
32
121
  getDestinations(vertex: V | VertexId | null): V[];
33
122
  /**--- start find cycles --- */
34
123
  /**
35
124
  * when stored with adjacency list time: O(V+E)
36
125
  * when stored with adjacency matrix time: O(V^2)
126
+ * The `topologicalSort` function performs a topological sort on a directed graph and returns the sorted vertices in
127
+ * reverse order, or null if the graph contains a cycle.
128
+ * @returns The function `topologicalSort()` returns an array of vertices in topological order if there is no cycle in
129
+ * the graph. If there is a cycle in the graph, it returns `null`.
37
130
  */
38
- topologicalSort(): (V | VertexId)[] | null;
131
+ topologicalSort(): V[] | null;
39
132
  /**--- end find cycles --- */
133
+ /**
134
+ * The `edgeSet` function returns an array of all the edges in the graph.
135
+ * @returns The `edgeSet()` method returns an array of edges (`E[]`).
136
+ */
40
137
  edgeSet(): E[];
138
+ /**
139
+ * The function `getNeighbors` returns an array of neighboring vertices for a given vertex or vertex ID.
140
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can be either a vertex object (`V`) or a vertex ID
141
+ * (`VertexId`).
142
+ * @returns an array of vertices (V[]).
143
+ */
41
144
  getNeighbors(vertexOrId: V | VertexId): V[];
145
+ /**
146
+ * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
147
+ * otherwise it returns null.
148
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
149
+ * @returns an array containing two vertices [V, V] if the edge is found in the graph. If the edge is not found, it
150
+ * returns null.
151
+ */
42
152
  getEndsOfEdge(edge: E): [V, V] | null;
43
153
  }
@@ -52,6 +52,10 @@ var __values = (this && this.__values) || function(o) {
52
52
  };
53
53
  Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.DirectedGraph = exports.DirectedEdge = exports.DirectedVertex = void 0;
55
+ /**
56
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
57
+ * @license MIT
58
+ */
55
59
  var utils_1 = require("../../utils");
56
60
  var abstract_graph_1 = require("./abstract-graph");
57
61
  var DirectedVertex = /** @class */ (function (_super) {
@@ -102,6 +106,14 @@ var DirectedGraph = /** @class */ (function (_super) {
102
106
  _this._inEdgeMap = new Map();
103
107
  return _this;
104
108
  }
109
+ /**
110
+ * The function `getEdge` returns the first edge between two vertices, given their source and destination.
111
+ * @param {V | null | VertexId} srcOrId - The `srcOrId` parameter can be either a vertex object (`V`), a vertex ID
112
+ * (`VertexId`), or `null`. It represents the source vertex of the edge.
113
+ * @param {V | null | VertexId} destOrId - The `destOrId` parameter is either a vertex object (`V`), a vertex ID
114
+ * (`VertexId`), or `null`. It represents the destination vertex of the edge.
115
+ * @returns an edge (E) or null.
116
+ */
105
117
  DirectedGraph.prototype.getEdge = function (srcOrId, destOrId) {
106
118
  var edges = [];
107
119
  if (srcOrId !== null && destOrId !== null) {
@@ -116,6 +128,13 @@ var DirectedGraph = /** @class */ (function (_super) {
116
128
  }
117
129
  return edges[0] || null;
118
130
  };
131
+ /**
132
+ * The `addEdge` function adds an edge to a graph if the source and destination vertices exist.
133
+ * @param {E} edge - The parameter `edge` is of type `E`, which represents an edge in the graph. It contains
134
+ * information about the source vertex (`src`) and the destination vertex (`dest`) of the edge.
135
+ * @returns The `addEdge` function returns a boolean value. It returns `true` if the edge was successfully added to the
136
+ * graph, and `false` if either the source or destination vertices of the edge are not present in the graph.
137
+ */
119
138
  DirectedGraph.prototype.addEdge = function (edge) {
120
139
  if (!(this.containsVertex(edge.src) && this.containsVertex(edge.dest))) {
121
140
  return false;
@@ -144,6 +163,16 @@ var DirectedGraph = /** @class */ (function (_super) {
144
163
  return false;
145
164
  }
146
165
  };
166
+ /**
167
+ * The function removes an edge between two vertices in a directed graph and returns the removed edge.
168
+ * @param {V | VertexId} srcOrId - The source vertex or its ID.
169
+ * @param {V | VertexId} destOrId - The `destOrId` parameter in the `removeEdgeBetween` function represents the
170
+ * destination vertex of the edge that needs to be removed. It can be either a vertex object (`V`) or a vertex ID
171
+ * (`VertexId`).
172
+ * @returns The function `removeEdgeBetween` returns the removed edge (`E`) if the edge between the source and
173
+ * destination vertices is successfully removed. If either the source or destination vertex is not found, or if the
174
+ * edge does not exist, it returns `null`.
175
+ */
147
176
  DirectedGraph.prototype.removeEdgeBetween = function (srcOrId, destOrId) {
148
177
  var src = this.getVertex(srcOrId);
149
178
  var dest = this.getVertex(destOrId);
@@ -153,6 +182,14 @@ var DirectedGraph = /** @class */ (function (_super) {
153
182
  }
154
183
  var srcOutEdges = this._outEdgeMap.get(src);
155
184
  if (srcOutEdges) {
185
+ /**
186
+ * The removeEdge function removes an edge from a graph and returns the removed edge, or null if the edge was not
187
+ * found.
188
+ * @param {E} edge - The `edge` parameter represents the edge that you want to remove from the graph. It should be an
189
+ * object that has `src` and `dest` properties, which represent the source and destination vertices of the edge,
190
+ * respectively.
191
+ * @returns The method `removeEdge` returns the removed edge (`E`) if it exists, or `null` if the edge does not exist.
192
+ */
156
193
  (0, utils_1.arrayRemove)(srcOutEdges, function (edge) { return edge.dest === dest.id; });
157
194
  }
158
195
  var destInEdges = this._inEdgeMap.get(dest);
@@ -161,6 +198,13 @@ var DirectedGraph = /** @class */ (function (_super) {
161
198
  }
162
199
  return removed;
163
200
  };
201
+ /**
202
+ * The removeEdge function removes an edge from a graph and returns the removed edge, or null if the edge was not
203
+ * found.
204
+ * @param {E} edge - The `edge` parameter is an object that represents an edge in a graph. It has two properties: `src`
205
+ * and `dest`, which represent the source and destination vertices of the edge, respectively.
206
+ * @returns The method `removeEdge` returns the removed edge (`E`) if it exists, or `null` if the edge does not exist.
207
+ */
164
208
  DirectedGraph.prototype.removeEdge = function (edge) {
165
209
  var removed = null;
166
210
  var src = this.getVertex(edge.src);
@@ -177,9 +221,23 @@ var DirectedGraph = /** @class */ (function (_super) {
177
221
  }
178
222
  return removed;
179
223
  };
224
+ /**
225
+ * The function removeAllEdges removes all edges between two vertices.
226
+ * @param {VertexId | V} src - The `src` parameter represents the source vertex from which the edges will be removed.
227
+ * It can be either a `VertexId` or a `V` type, which represents the identifier or object of the vertex.
228
+ * @param {VertexId | V} dest - The `dest` parameter represents the destination vertex of an edge. It can be either a
229
+ * `VertexId` or a vertex object `V`.
230
+ * @returns An empty array is being returned.
231
+ */
180
232
  DirectedGraph.prototype.removeAllEdges = function (src, dest) {
181
233
  return [];
182
234
  };
235
+ /**
236
+ * The function `incomingEdgesOf` returns an array of incoming edges for a given vertex or vertex ID.
237
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can be either a vertex object (`V`) or a vertex ID
238
+ * (`VertexId`).
239
+ * @returns The method `incomingEdgesOf` returns an array of edges (`E[]`).
240
+ */
183
241
  DirectedGraph.prototype.incomingEdgesOf = function (vertexOrId) {
184
242
  var target = this.getVertex(vertexOrId);
185
243
  if (target) {
@@ -187,6 +245,12 @@ var DirectedGraph = /** @class */ (function (_super) {
187
245
  }
188
246
  return [];
189
247
  };
248
+ /**
249
+ * The function `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
250
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can accept either a vertex object (`V`) or a vertex ID
251
+ * (`VertexId`).
252
+ * @returns The method `outgoingEdgesOf` returns an array of outgoing edges from a given vertex or vertex ID.
253
+ */
190
254
  DirectedGraph.prototype.outgoingEdgesOf = function (vertexOrId) {
191
255
  var target = this.getVertex(vertexOrId);
192
256
  if (target) {
@@ -194,24 +258,61 @@ var DirectedGraph = /** @class */ (function (_super) {
194
258
  }
195
259
  return [];
196
260
  };
261
+ /**
262
+ * The function "degreeOf" returns the total degree of a vertex, which is the sum of its out-degree and in-degree.
263
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
264
+ * @returns the sum of the out-degree and in-degree of the specified vertex or vertex ID.
265
+ */
197
266
  DirectedGraph.prototype.degreeOf = function (vertexOrId) {
198
267
  return this.outDegreeOf(vertexOrId) + this.inDegreeOf(vertexOrId);
199
268
  };
269
+ /**
270
+ * The function "inDegreeOf" returns the number of incoming edges for a given vertex.
271
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
272
+ * @returns The number of incoming edges of the specified vertex or vertex ID.
273
+ */
200
274
  DirectedGraph.prototype.inDegreeOf = function (vertexOrId) {
201
275
  return this.incomingEdgesOf(vertexOrId).length;
202
276
  };
277
+ /**
278
+ * The function `outDegreeOf` returns the number of outgoing edges from a given vertex.
279
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
280
+ * @returns The number of outgoing edges from the specified vertex or vertex ID.
281
+ */
203
282
  DirectedGraph.prototype.outDegreeOf = function (vertexOrId) {
204
283
  return this.outgoingEdgesOf(vertexOrId).length;
205
284
  };
285
+ /**
286
+ * The function "edgesOf" returns an array of both outgoing and incoming edges of a given vertex or vertex ID.
287
+ * @param {VertexId | V} vertexOrId - The parameter `vertexOrId` can be either a `VertexId` or a `V`.
288
+ * @returns The function `edgesOf` returns an array of edges.
289
+ */
206
290
  DirectedGraph.prototype.edgesOf = function (vertexOrId) {
207
291
  return __spreadArray(__spreadArray([], __read(this.outgoingEdgesOf(vertexOrId)), false), __read(this.incomingEdgesOf(vertexOrId)), false);
208
292
  };
293
+ /**
294
+ * The function "getEdgeSrc" returns the source vertex of an edge, or null if the edge does not exist.
295
+ * @param {E} e - E - an edge object
296
+ * @returns the source vertex of the given edge, or null if the edge does not exist.
297
+ */
209
298
  DirectedGraph.prototype.getEdgeSrc = function (e) {
210
299
  return this.getVertex(e.src);
211
300
  };
301
+ /**
302
+ * The function "getEdgeDest" returns the vertex associated with the destination of an edge.
303
+ * @param {E} e - The parameter `e` is of type `E`, which represents an edge in a graph.
304
+ * @returns either a vertex object (of type V) or null.
305
+ */
212
306
  DirectedGraph.prototype.getEdgeDest = function (e) {
213
307
  return this.getVertex(e.dest);
214
308
  };
309
+ /**
310
+ * The function `getDestinations` returns an array of destination vertices connected to a given vertex.
311
+ * @param {V | VertexId | null} vertex - The `vertex` parameter represents the starting vertex from which we want to
312
+ * find the destinations. It can be either a `V` object, a `VertexId` (which is a unique identifier for a vertex), or
313
+ * `null` if we want to find destinations from all vertices.
314
+ * @returns an array of vertices (V[]).
315
+ */
215
316
  DirectedGraph.prototype.getDestinations = function (vertex) {
216
317
  var e_1, _a;
217
318
  if (vertex === null) {
@@ -241,6 +342,10 @@ var DirectedGraph = /** @class */ (function (_super) {
241
342
  /**
242
343
  * when stored with adjacency list time: O(V+E)
243
344
  * when stored with adjacency matrix time: O(V^2)
345
+ * The `topologicalSort` function performs a topological sort on a directed graph and returns the sorted vertices in
346
+ * reverse order, or null if the graph contains a cycle.
347
+ * @returns The function `topologicalSort()` returns an array of vertices in topological order if there is no cycle in
348
+ * the graph. If there is a cycle in the graph, it returns `null`.
244
349
  */
245
350
  DirectedGraph.prototype.topologicalSort = function () {
246
351
  var e_2, _a, e_3, _b;
@@ -339,6 +444,10 @@ var DirectedGraph = /** @class */ (function (_super) {
339
444
  return sorted.reverse();
340
445
  };
341
446
  /**--- end find cycles --- */
447
+ /**
448
+ * The `edgeSet` function returns an array of all the edges in the graph.
449
+ * @returns The `edgeSet()` method returns an array of edges (`E[]`).
450
+ */
342
451
  DirectedGraph.prototype.edgeSet = function () {
343
452
  var edges = [];
344
453
  this._outEdgeMap.forEach(function (outEdges) {
@@ -346,6 +455,12 @@ var DirectedGraph = /** @class */ (function (_super) {
346
455
  });
347
456
  return edges;
348
457
  };
458
+ /**
459
+ * The function `getNeighbors` returns an array of neighboring vertices for a given vertex or vertex ID.
460
+ * @param {V | VertexId} vertexOrId - The parameter `vertexOrId` can be either a vertex object (`V`) or a vertex ID
461
+ * (`VertexId`).
462
+ * @returns an array of vertices (V[]).
463
+ */
349
464
  DirectedGraph.prototype.getNeighbors = function (vertexOrId) {
350
465
  var e_5, _a;
351
466
  var neighbors = [];
@@ -372,6 +487,13 @@ var DirectedGraph = /** @class */ (function (_super) {
372
487
  }
373
488
  return neighbors;
374
489
  };
490
+ /**
491
+ * The function "getEndsOfEdge" returns the source and destination vertices of an edge if it exists in the graph,
492
+ * otherwise it returns null.
493
+ * @param {E} edge - The parameter "edge" is of type E, which represents an edge in a graph.
494
+ * @returns an array containing two vertices [V, V] if the edge is found in the graph. If the edge is not found, it
495
+ * returns null.
496
+ */
375
497
  DirectedGraph.prototype.getEndsOfEdge = function (edge) {
376
498
  if (!this.containsEdge(edge.src, edge.dest)) {
377
499
  return null;
@@ -12,14 +12,77 @@ export declare class UndirectedEdge extends AbstractEdge {
12
12
  export declare class UndirectedGraph<V extends UndirectedVertex, E extends UndirectedEdge> extends AbstractGraph<V, E> {
13
13
  protected _edges: Map<V, E[]>;
14
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
+ */
15
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
+ */
16
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
+ */
17
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
+ */
18
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
+ */
19
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
+ */
20
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
+ */
21
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
+ */
22
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
+ */
23
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
+ */
24
87
  getEndsOfEdge(edge: E): [V, V] | null;
25
88
  }
@@ -52,6 +52,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
52
52
  };
53
53
  Object.defineProperty(exports, "__esModule", { value: true });
54
54
  exports.UndirectedGraph = exports.UndirectedEdge = exports.UndirectedVertex = void 0;
55
+ /**
56
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
57
+ * @license MIT
58
+ */
55
59
  var utils_1 = require("../../utils");
56
60
  var abstract_graph_1 = require("./abstract-graph");
57
61
  var UndirectedVertex = /** @class */ (function (_super) {
@@ -89,6 +93,14 @@ var UndirectedGraph = /** @class */ (function (_super) {
89
93
  _this._edges = new Map();
90
94
  return _this;
91
95
  }
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
+ */
92
104
  UndirectedGraph.prototype.getEdge = function (v1, v2) {
93
105
  var _a;
94
106
  var edges = [];
@@ -101,6 +113,11 @@ var UndirectedGraph = /** @class */ (function (_super) {
101
113
  }
102
114
  return edges ? edges[0] || null : null;
103
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
+ */
104
121
  UndirectedGraph.prototype.addEdge = function (edge) {
105
122
  var e_1, _a;
106
123
  try {
@@ -129,6 +146,13 @@ var UndirectedGraph = /** @class */ (function (_super) {
129
146
  }
130
147
  return true;
131
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
+ */
132
156
  UndirectedGraph.prototype.removeEdgeBetween = function (v1, v2) {
133
157
  var vertex1 = this.getVertex(v1);
134
158
  var vertex2 = this.getVertex(v2);
@@ -146,9 +170,21 @@ var UndirectedGraph = /** @class */ (function (_super) {
146
170
  }
147
171
  return removed;
148
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
+ */
149
178
  UndirectedGraph.prototype.removeEdge = function (edge) {
150
179
  return this.removeEdgeBetween(edge.vertices[0], edge.vertices[1]);
151
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
+ */
152
188
  UndirectedGraph.prototype.degreeOf = function (vertexOrId) {
153
189
  var _a;
154
190
  var vertex = this.getVertex(vertexOrId);
@@ -159,6 +195,13 @@ var UndirectedGraph = /** @class */ (function (_super) {
159
195
  return 0;
160
196
  }
161
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
+ */
162
205
  UndirectedGraph.prototype.edgesOf = function (vertexOrId) {
163
206
  var vertex = this.getVertex(vertexOrId);
164
207
  if (vertex) {
@@ -168,6 +211,10 @@ var UndirectedGraph = /** @class */ (function (_super) {
168
211
  return [];
169
212
  }
170
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
+ */
171
218
  UndirectedGraph.prototype.edgeSet = function () {
172
219
  var edgeSet = new Set();
173
220
  this._edges.forEach(function (edges) {
@@ -177,6 +224,12 @@ var UndirectedGraph = /** @class */ (function (_super) {
177
224
  });
178
225
  return __spreadArray([], __read(edgeSet), false);
179
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
+ */
180
233
  UndirectedGraph.prototype.getEdgesOf = function (vertexOrId) {
181
234
  var vertex = this.getVertex(vertexOrId);
182
235
  if (!vertex) {
@@ -184,6 +237,12 @@ var UndirectedGraph = /** @class */ (function (_super) {
184
237
  }
185
238
  return this._edges.get(vertex) || [];
186
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
+ */
187
246
  UndirectedGraph.prototype.getNeighbors = function (vertexOrId) {
188
247
  var e_2, _a;
189
248
  var neighbors = [];
@@ -209,6 +268,14 @@ var UndirectedGraph = /** @class */ (function (_super) {
209
268
  }
210
269
  return neighbors;
211
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
+ */
212
279
  UndirectedGraph.prototype.getEndsOfEdge = function (edge) {
213
280
  if (!this.containsEdge(edge.vertices[0], edge.vertices[1])) {
214
281
  return null;
@@ -1,8 +1,40 @@
1
+ /**
2
+ * @copyright 2030 Tyler Zeng <zrwusa@gmail.com>
3
+ * @license MIT
4
+ */
1
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
  }