data-structure-typed 2.4.5 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/.vitepress/cache/deps_temp_51f5f1b0/chunk-7OIKW5WK.js +12984 -0
  2. package/.vitepress/cache/deps_temp_51f5f1b0/package.json +3 -0
  3. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vue_devtools-api.js +4505 -0
  4. package/.vitepress/cache/deps_temp_51f5f1b0/vitepress___@vueuse_core.js +9731 -0
  5. package/.vitepress/cache/deps_temp_51f5f1b0/vue.js +347 -0
  6. package/CHANGELOG.md +3 -1
  7. package/README.md +78 -31
  8. package/dist/cjs/binary-tree.cjs +23698 -0
  9. package/dist/cjs/graph.cjs +5236 -0
  10. package/dist/cjs/hash.cjs +1262 -0
  11. package/dist/cjs/heap.cjs +1540 -0
  12. package/dist/cjs/index.cjs +24509 -2899
  13. package/dist/cjs/linked-list.cjs +4370 -0
  14. package/dist/cjs/matrix.cjs +1042 -0
  15. package/dist/cjs/priority-queue.cjs +1314 -0
  16. package/dist/cjs/queue.cjs +4090 -0
  17. package/dist/cjs/stack.cjs +861 -0
  18. package/dist/cjs/trie.cjs +1173 -0
  19. package/dist/cjs-legacy/binary-tree.cjs +23730 -0
  20. package/dist/cjs-legacy/graph.cjs +5234 -0
  21. package/dist/cjs-legacy/hash.cjs +1262 -0
  22. package/dist/cjs-legacy/heap.cjs +1537 -0
  23. package/dist/cjs-legacy/index.cjs +32555 -10936
  24. package/dist/cjs-legacy/linked-list.cjs +4376 -0
  25. package/dist/cjs-legacy/matrix.cjs +1045 -0
  26. package/dist/cjs-legacy/priority-queue.cjs +1312 -0
  27. package/dist/cjs-legacy/queue.cjs +4088 -0
  28. package/dist/cjs-legacy/stack.cjs +861 -0
  29. package/dist/cjs-legacy/trie.cjs +1172 -0
  30. package/dist/esm/binary-tree.mjs +23683 -0
  31. package/dist/esm/graph.mjs +5223 -0
  32. package/dist/esm/hash.mjs +1259 -0
  33. package/dist/esm/heap.mjs +1534 -0
  34. package/dist/esm/index.mjs +24507 -2898
  35. package/dist/esm/linked-list.mjs +4363 -0
  36. package/dist/esm/matrix.mjs +1038 -0
  37. package/dist/esm/priority-queue.mjs +1310 -0
  38. package/dist/esm/queue.mjs +4086 -0
  39. package/dist/esm/stack.mjs +859 -0
  40. package/dist/esm/trie.mjs +1170 -0
  41. package/dist/esm-legacy/binary-tree.mjs +23715 -0
  42. package/dist/esm-legacy/graph.mjs +5221 -0
  43. package/dist/esm-legacy/hash.mjs +1259 -0
  44. package/dist/esm-legacy/heap.mjs +1531 -0
  45. package/dist/esm-legacy/index.mjs +32553 -10935
  46. package/dist/esm-legacy/linked-list.mjs +4369 -0
  47. package/dist/esm-legacy/matrix.mjs +1041 -0
  48. package/dist/esm-legacy/priority-queue.mjs +1308 -0
  49. package/dist/esm-legacy/queue.mjs +4084 -0
  50. package/dist/esm-legacy/stack.mjs +859 -0
  51. package/dist/esm-legacy/trie.mjs +1169 -0
  52. package/dist/types/data-structures/base/index.d.ts +1 -0
  53. package/dist/types/data-structures/base/iterable-element-base.d.ts +1 -1
  54. package/dist/types/data-structures/base/iterable-entry-base.d.ts +8 -8
  55. package/dist/types/data-structures/base/linear-base.d.ts +3 -3
  56. package/dist/types/data-structures/binary-tree/avl-tree.d.ts +368 -51
  57. package/dist/types/data-structures/binary-tree/binary-indexed-tree.d.ts +473 -147
  58. package/dist/types/data-structures/binary-tree/binary-tree.d.ts +931 -80
  59. package/dist/types/data-structures/binary-tree/bst.d.ts +792 -29
  60. package/dist/types/data-structures/binary-tree/red-black-tree.d.ts +592 -32
  61. package/dist/types/data-structures/binary-tree/segment-tree.d.ts +320 -135
  62. package/dist/types/data-structures/binary-tree/tree-map.d.ts +3662 -6
  63. package/dist/types/data-structures/binary-tree/tree-multi-map.d.ts +3487 -201
  64. package/dist/types/data-structures/binary-tree/tree-multi-set.d.ts +2778 -65
  65. package/dist/types/data-structures/binary-tree/tree-set.d.ts +3414 -6
  66. package/dist/types/data-structures/graph/abstract-graph.d.ts +4 -4
  67. package/dist/types/data-structures/graph/directed-graph.d.ts +419 -47
  68. package/dist/types/data-structures/graph/map-graph.d.ts +59 -1
  69. package/dist/types/data-structures/graph/undirected-graph.d.ts +384 -59
  70. package/dist/types/data-structures/hash/hash-map.d.ts +462 -89
  71. package/dist/types/data-structures/heap/heap.d.ts +567 -99
  72. package/dist/types/data-structures/heap/max-heap.d.ts +46 -0
  73. package/dist/types/data-structures/heap/min-heap.d.ts +59 -0
  74. package/dist/types/data-structures/linked-list/doubly-linked-list.d.ts +631 -49
  75. package/dist/types/data-structures/linked-list/singly-linked-list.d.ts +581 -68
  76. package/dist/types/data-structures/linked-list/skip-linked-list.d.ts +775 -12
  77. package/dist/types/data-structures/matrix/matrix.d.ts +491 -0
  78. package/dist/types/data-structures/priority-queue/max-priority-queue.d.ts +57 -0
  79. package/dist/types/data-structures/priority-queue/min-priority-queue.d.ts +60 -0
  80. package/dist/types/data-structures/priority-queue/priority-queue.d.ts +60 -0
  81. package/dist/types/data-structures/queue/deque.d.ts +578 -71
  82. package/dist/types/data-structures/queue/queue.d.ts +451 -42
  83. package/dist/types/data-structures/stack/stack.d.ts +374 -32
  84. package/dist/types/data-structures/trie/trie.d.ts +458 -48
  85. package/dist/types/interfaces/graph.d.ts +1 -1
  86. package/dist/types/types/common.d.ts +2 -2
  87. package/dist/types/types/data-structures/binary-tree/segment-tree.d.ts +1 -1
  88. package/dist/types/types/data-structures/heap/heap.d.ts +1 -0
  89. package/dist/types/types/data-structures/linked-list/skip-linked-list.d.ts +1 -4
  90. package/dist/types/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
  91. package/dist/types/types/utils/validate-type.d.ts +4 -4
  92. package/dist/umd/data-structure-typed.js +32432 -10808
  93. package/dist/umd/data-structure-typed.min.js +10 -4
  94. package/docs-site-docusaurus/README.md +41 -0
  95. package/docs-site-docusaurus/docs/api/README.md +52 -0
  96. package/docs-site-docusaurus/docs/api/classes/AVLTree.md +6130 -0
  97. package/docs-site-docusaurus/docs/api/classes/AVLTreeNode.md +282 -0
  98. package/docs-site-docusaurus/docs/api/classes/AbstractGraph.md +2266 -0
  99. package/docs-site-docusaurus/docs/api/classes/BST.md +5831 -0
  100. package/docs-site-docusaurus/docs/api/classes/BSTNode.md +333 -0
  101. package/docs-site-docusaurus/docs/api/classes/BinaryIndexedTree.md +455 -0
  102. package/docs-site-docusaurus/docs/api/classes/BinaryTree.md +4647 -0
  103. package/docs-site-docusaurus/docs/api/classes/BinaryTreeNode.md +331 -0
  104. package/docs-site-docusaurus/docs/api/classes/Deque.md +2767 -0
  105. package/docs-site-docusaurus/docs/api/classes/DirectedGraph.md +2999 -0
  106. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedList.md +2685 -0
  107. package/docs-site-docusaurus/docs/api/classes/DoublyLinkedListNode.md +221 -0
  108. package/docs-site-docusaurus/docs/api/classes/FibonacciHeap.md +253 -0
  109. package/docs-site-docusaurus/docs/api/classes/FibonacciHeapNode.md +21 -0
  110. package/docs-site-docusaurus/docs/api/classes/HashMap.md +1333 -0
  111. package/docs-site-docusaurus/docs/api/classes/Heap.md +1881 -0
  112. package/docs-site-docusaurus/docs/api/classes/IterableElementBase.md +800 -0
  113. package/docs-site-docusaurus/docs/api/classes/IterableEntryBase.md +644 -0
  114. package/docs-site-docusaurus/docs/api/classes/LinearBase.md +1632 -0
  115. package/docs-site-docusaurus/docs/api/classes/LinearLinkedBase.md +1853 -0
  116. package/docs-site-docusaurus/docs/api/classes/LinkedHashMap.md +1108 -0
  117. package/docs-site-docusaurus/docs/api/classes/LinkedListNode.md +156 -0
  118. package/docs-site-docusaurus/docs/api/classes/LinkedListQueue.md +2824 -0
  119. package/docs-site-docusaurus/docs/api/classes/MapGraph.md +2929 -0
  120. package/docs-site-docusaurus/docs/api/classes/Matrix.md +1026 -0
  121. package/docs-site-docusaurus/docs/api/classes/MaxHeap.md +1866 -0
  122. package/docs-site-docusaurus/docs/api/classes/MaxPriorityQueue.md +1883 -0
  123. package/docs-site-docusaurus/docs/api/classes/MinHeap.md +1879 -0
  124. package/docs-site-docusaurus/docs/api/classes/MinPriorityQueue.md +1882 -0
  125. package/docs-site-docusaurus/docs/api/classes/Navigator.md +109 -0
  126. package/docs-site-docusaurus/docs/api/classes/PriorityQueue.md +1839 -0
  127. package/docs-site-docusaurus/docs/api/classes/Queue.md +2244 -0
  128. package/docs-site-docusaurus/docs/api/classes/RedBlackTree.md +6374 -0
  129. package/docs-site-docusaurus/docs/api/classes/SegmentTree.md +372 -0
  130. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedList.md +2897 -0
  131. package/docs-site-docusaurus/docs/api/classes/SinglyLinkedListNode.md +169 -0
  132. package/docs-site-docusaurus/docs/api/classes/SkipList.md +1229 -0
  133. package/docs-site-docusaurus/docs/api/classes/Stack.md +1573 -0
  134. package/docs-site-docusaurus/docs/api/classes/TreeMap.md +1257 -0
  135. package/docs-site-docusaurus/docs/api/classes/TreeMultiMap.md +1475 -0
  136. package/docs-site-docusaurus/docs/api/classes/TreeSet.md +1117 -0
  137. package/docs-site-docusaurus/docs/api/classes/Trie.md +1708 -0
  138. package/docs-site-docusaurus/docs/api/classes/TrieNode.md +199 -0
  139. package/docs-site-docusaurus/docs/api/classes/UndirectedGraph.md +2979 -0
  140. package/docs-site-docusaurus/docs/guide/_category_.json +6 -0
  141. package/docs-site-docusaurus/docs/guide/architecture.md +613 -0
  142. package/docs-site-docusaurus/docs/guide/concepts.md +420 -0
  143. package/docs-site-docusaurus/docs/guide/guides.md +611 -0
  144. package/docs-site-docusaurus/docs/guide/installation.md +60 -0
  145. package/docs-site-docusaurus/docs/guide/integrations.md +823 -0
  146. package/docs-site-docusaurus/docs/guide/overview.md +638 -0
  147. package/docs-site-docusaurus/docs/guide/performance.md +833 -0
  148. package/docs-site-docusaurus/docs/guide/quick-start.md +73 -0
  149. package/docs-site-docusaurus/docusaurus.config.ts +159 -0
  150. package/docs-site-docusaurus/fix-mdx-generics.mjs +75 -0
  151. package/docs-site-docusaurus/package-lock.json +18667 -0
  152. package/docs-site-docusaurus/package.json +50 -0
  153. package/docs-site-docusaurus/prefix-class-to-methods.mjs +48 -0
  154. package/docs-site-docusaurus/sidebars.ts +23 -0
  155. package/docs-site-docusaurus/sort-protected.mjs +87 -0
  156. package/docs-site-docusaurus/src/css/custom.css +96 -0
  157. package/docs-site-docusaurus/src/pages/index.module.css +13 -0
  158. package/docs-site-docusaurus/src/pages/index.tsx +71 -0
  159. package/docs-site-docusaurus/src/pages/markdown-page.md +7 -0
  160. package/docs-site-docusaurus/src/theme/TOCItems/index.tsx +34 -0
  161. package/docs-site-docusaurus/static/.nojekyll +0 -0
  162. package/docs-site-docusaurus/static/img/docusaurus-social-card.jpg +0 -0
  163. package/docs-site-docusaurus/static/img/docusaurus.png +0 -0
  164. package/docs-site-docusaurus/static/img/favicon.ico +0 -0
  165. package/docs-site-docusaurus/static/img/favicon.png +0 -0
  166. package/docs-site-docusaurus/static/img/logo-180.png +0 -0
  167. package/docs-site-docusaurus/static/img/logo.jpg +0 -0
  168. package/docs-site-docusaurus/static/img/logo.png +0 -0
  169. package/docs-site-docusaurus/static/img/logo.svg +1 -0
  170. package/docs-site-docusaurus/static/img/og-image.png +0 -0
  171. package/docs-site-docusaurus/static/img/undraw_docusaurus_mountain.svg +171 -0
  172. package/docs-site-docusaurus/static/img/undraw_docusaurus_react.svg +170 -0
  173. package/docs-site-docusaurus/static/img/undraw_docusaurus_tree.svg +40 -0
  174. package/docs-site-docusaurus/static/robots.txt +4 -0
  175. package/docs-site-docusaurus/typedoc.json +23 -0
  176. package/package.json +109 -12
  177. package/src/data-structures/base/index.ts +1 -0
  178. package/src/data-structures/base/iterable-element-base.ts +4 -5
  179. package/src/data-structures/base/iterable-entry-base.ts +8 -8
  180. package/src/data-structures/base/linear-base.ts +3 -3
  181. package/src/data-structures/binary-tree/avl-tree.ts +386 -51
  182. package/src/data-structures/binary-tree/binary-indexed-tree.ts +596 -247
  183. package/src/data-structures/binary-tree/binary-tree.ts +956 -81
  184. package/src/data-structures/binary-tree/bst.ts +840 -35
  185. package/src/data-structures/binary-tree/red-black-tree.ts +689 -97
  186. package/src/data-structures/binary-tree/segment-tree.ts +498 -249
  187. package/src/data-structures/binary-tree/tree-map.ts +3784 -7
  188. package/src/data-structures/binary-tree/tree-multi-map.ts +3614 -211
  189. package/src/data-structures/binary-tree/tree-multi-set.ts +2874 -65
  190. package/src/data-structures/binary-tree/tree-set.ts +3531 -10
  191. package/src/data-structures/graph/abstract-graph.ts +4 -4
  192. package/src/data-structures/graph/directed-graph.ts +429 -47
  193. package/src/data-structures/graph/map-graph.ts +59 -1
  194. package/src/data-structures/graph/undirected-graph.ts +393 -59
  195. package/src/data-structures/hash/hash-map.ts +476 -92
  196. package/src/data-structures/heap/heap.ts +581 -99
  197. package/src/data-structures/heap/max-heap.ts +46 -0
  198. package/src/data-structures/heap/min-heap.ts +59 -0
  199. package/src/data-structures/linked-list/doubly-linked-list.ts +646 -47
  200. package/src/data-structures/linked-list/singly-linked-list.ts +596 -68
  201. package/src/data-structures/linked-list/skip-linked-list.ts +1067 -90
  202. package/src/data-structures/matrix/matrix.ts +584 -12
  203. package/src/data-structures/priority-queue/max-priority-queue.ts +57 -0
  204. package/src/data-structures/priority-queue/min-priority-queue.ts +60 -0
  205. package/src/data-structures/priority-queue/priority-queue.ts +60 -0
  206. package/src/data-structures/queue/deque.ts +592 -70
  207. package/src/data-structures/queue/queue.ts +463 -42
  208. package/src/data-structures/stack/stack.ts +384 -32
  209. package/src/data-structures/trie/trie.ts +470 -48
  210. package/src/interfaces/graph.ts +1 -1
  211. package/src/types/common.ts +2 -2
  212. package/src/types/data-structures/binary-tree/segment-tree.ts +1 -1
  213. package/src/types/data-structures/heap/heap.ts +1 -0
  214. package/src/types/data-structures/linked-list/skip-linked-list.ts +2 -1
  215. package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
  216. package/src/types/utils/validate-type.ts +4 -4
  217. package/vercel.json +6 -0
  218. package/dist/leetcode/avl-tree-counter.mjs +0 -2957
  219. package/dist/leetcode/avl-tree-multi-map.mjs +0 -2889
  220. package/dist/leetcode/avl-tree.mjs +0 -2720
  221. package/dist/leetcode/binary-tree.mjs +0 -1594
  222. package/dist/leetcode/bst.mjs +0 -2398
  223. package/dist/leetcode/deque.mjs +0 -683
  224. package/dist/leetcode/directed-graph.mjs +0 -1733
  225. package/dist/leetcode/doubly-linked-list.mjs +0 -709
  226. package/dist/leetcode/hash-map.mjs +0 -493
  227. package/dist/leetcode/heap.mjs +0 -542
  228. package/dist/leetcode/max-heap.mjs +0 -375
  229. package/dist/leetcode/max-priority-queue.mjs +0 -383
  230. package/dist/leetcode/min-heap.mjs +0 -363
  231. package/dist/leetcode/min-priority-queue.mjs +0 -371
  232. package/dist/leetcode/priority-queue.mjs +0 -363
  233. package/dist/leetcode/queue.mjs +0 -943
  234. package/dist/leetcode/red-black-tree.mjs +0 -2765
  235. package/dist/leetcode/singly-linked-list.mjs +0 -754
  236. package/dist/leetcode/stack.mjs +0 -217
  237. package/dist/leetcode/tree-counter.mjs +0 -3039
  238. package/dist/leetcode/tree-multi-map.mjs +0 -2913
  239. package/dist/leetcode/trie.mjs +0 -413
  240. package/dist/leetcode/undirected-graph.mjs +0 -1650
@@ -0,0 +1,2266 @@
1
+ [**data-structure-typed**](../README.md)
2
+
3
+ ***
4
+
5
+ [data-structure-typed](../README.md) / AbstractGraph
6
+
7
+ # Abstract Class: AbstractGraph\<V, E, VO, EO\>
8
+
9
+ Defined in: [data-structures/graph/abstract-graph.ts:53](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L53)
10
+
11
+ Abstract graph over vertices and edges.
12
+
13
+ ## Remarks
14
+
15
+ Time O(1), Space O(1)
16
+
17
+ ## Example
18
+
19
+ ```ts
20
+ examples will be generated by unit test
21
+ ```
22
+
23
+ ## Extends
24
+
25
+ - [`IterableEntryBase`](IterableEntryBase.md)\<`VertexKey`, `V` \| `undefined`\>
26
+
27
+ ## Extended by
28
+
29
+ - [`DirectedGraph`](DirectedGraph.md)
30
+ - [`UndirectedGraph`](UndirectedGraph.md)
31
+
32
+ ## Type Parameters
33
+
34
+ ### V
35
+
36
+ `V` = `any`
37
+
38
+ Vertex value type.
39
+
40
+ ### E
41
+
42
+ `E` = `any`
43
+
44
+ Edge value type.
45
+
46
+ ### VO
47
+
48
+ `VO` *extends* `AbstractVertex`\<`V`\> = `AbstractVertex`\<`V`\>
49
+
50
+ Concrete vertex subclass (extends AbstractVertex<V>).
51
+
52
+ ### EO
53
+
54
+ `EO` *extends* `AbstractEdge`\<`E`\> = `AbstractEdge`\<`E`\>
55
+
56
+ Concrete edge subclass (extends AbstractEdge<E>).
57
+
58
+ ## Implements
59
+
60
+ - `IGraph`\<`V`, `E`, `VO`, `EO`\>
61
+
62
+ ## Constructors
63
+
64
+ ### Constructor
65
+
66
+ ```ts
67
+ new AbstractGraph<V, E, VO, EO>(options?): AbstractGraph<V, E, VO, EO>;
68
+ ```
69
+
70
+ Defined in: [data-structures/graph/abstract-graph.ts:67](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L67)
71
+
72
+ Construct a graph with runtime defaults.
73
+
74
+ #### Parameters
75
+
76
+ ##### options?
77
+
78
+ `Partial`\<`Record`\<`string`, `unknown`\>\>
79
+
80
+ `GraphOptions<V>` in `options.graph` (e.g. `vertexValueInitializer`, `defaultEdgeWeight`).
81
+
82
+ #### Returns
83
+
84
+ `AbstractGraph`\<`V`, `E`, `VO`, `EO`\>
85
+
86
+ #### Remarks
87
+
88
+ Time O(1), Space O(1)
89
+
90
+ #### Overrides
91
+
92
+ ```ts
93
+ IterableEntryBase<VertexKey, V | undefined>.constructor
94
+ ```
95
+
96
+ ## Accessors
97
+
98
+ ### size
99
+
100
+ #### Get Signature
101
+
102
+ ```ts
103
+ get size(): number;
104
+ ```
105
+
106
+ Defined in: [data-structures/graph/abstract-graph.ts:89](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L89)
107
+
108
+ Total number of entries.
109
+
110
+ ##### Remarks
111
+
112
+ Time O(1), Space O(1)
113
+
114
+ ##### Returns
115
+
116
+ `number`
117
+
118
+ Entry count.
119
+
120
+ #### Overrides
121
+
122
+ [`IterableEntryBase`](IterableEntryBase.md).[`size`](IterableEntryBase.md#size)
123
+
124
+ ## Methods
125
+
126
+ ### \[iterator\]()
127
+
128
+ ```ts
129
+ iterator: IterableIterator<[VertexKey, V | undefined]>;
130
+ ```
131
+
132
+ Defined in: [data-structures/base/iterable-entry-base.ts:22](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L22)
133
+
134
+ Default iterator yielding `[key, value]` entries.
135
+
136
+ #### Parameters
137
+
138
+ ##### args
139
+
140
+ ...`any`[]
141
+
142
+ #### Returns
143
+
144
+ `IterableIterator`\<\[`VertexKey`, `V` \| `undefined`\]\>
145
+
146
+ Iterator of `[K, V]`.
147
+
148
+ #### Remarks
149
+
150
+ Time O(n) to iterate, Space O(1)
151
+
152
+ #### Inherited from
153
+
154
+ [`IterableEntryBase`](IterableEntryBase.md).[`[iterator]`](IterableEntryBase.md#iterator)
155
+
156
+ ***
157
+
158
+ ### addEdge()
159
+
160
+ Add an edge by instance or by `(src, dest, weight?, value?)`.
161
+
162
+ #### Param
163
+
164
+ Edge instance or source vertex/key.
165
+
166
+ #### Param
167
+
168
+ Destination vertex/key (when adding by pair).
169
+
170
+ #### Param
171
+
172
+ Edge weight.
173
+
174
+ #### Param
175
+
176
+ Edge payload.
177
+
178
+ #### Remarks
179
+
180
+ Time O(1) avg, Space O(1)
181
+
182
+ #### Call Signature
183
+
184
+ ```ts
185
+ addEdge(edge): boolean;
186
+ ```
187
+
188
+ Defined in: [data-structures/graph/abstract-graph.ts:254](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L254)
189
+
190
+ ##### Parameters
191
+
192
+ ###### edge
193
+
194
+ `EO`
195
+
196
+ ##### Returns
197
+
198
+ `boolean`
199
+
200
+ #### Call Signature
201
+
202
+ ```ts
203
+ addEdge(
204
+ src,
205
+ dest,
206
+ weight?,
207
+ value?): boolean;
208
+ ```
209
+
210
+ Defined in: [data-structures/graph/abstract-graph.ts:256](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L256)
211
+
212
+ ##### Parameters
213
+
214
+ ###### src
215
+
216
+ `VertexKey` \| `VO`
217
+
218
+ ###### dest
219
+
220
+ `VertexKey` \| `VO`
221
+
222
+ ###### weight?
223
+
224
+ `number`
225
+
226
+ ###### value?
227
+
228
+ `E`
229
+
230
+ ##### Returns
231
+
232
+ `boolean`
233
+
234
+ ***
235
+
236
+ ### addVertex()
237
+
238
+ Add a vertex by key/value or by pre-built vertex.
239
+
240
+ #### Param
241
+
242
+ Vertex key or existing vertex instance.
243
+
244
+ #### Param
245
+
246
+ Optional payload.
247
+
248
+ #### Remarks
249
+
250
+ Time O(1) avg, Space O(1)
251
+
252
+ #### Call Signature
253
+
254
+ ```ts
255
+ addVertex(vertex): boolean;
256
+ ```
257
+
258
+ Defined in: [data-structures/graph/abstract-graph.ts:189](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L189)
259
+
260
+ ##### Parameters
261
+
262
+ ###### vertex
263
+
264
+ `VO`
265
+
266
+ ##### Returns
267
+
268
+ `boolean`
269
+
270
+ ##### Implementation of
271
+
272
+ ```ts
273
+ IGraph.addVertex
274
+ ```
275
+
276
+ #### Call Signature
277
+
278
+ ```ts
279
+ addVertex(key, value?): boolean;
280
+ ```
281
+
282
+ Defined in: [data-structures/graph/abstract-graph.ts:191](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L191)
283
+
284
+ ##### Parameters
285
+
286
+ ###### key
287
+
288
+ `VertexKey`
289
+
290
+ ###### value?
291
+
292
+ `V`
293
+
294
+ ##### Returns
295
+
296
+ `boolean`
297
+
298
+ ##### Implementation of
299
+
300
+ ```ts
301
+ IGraph.addVertex
302
+ ```
303
+
304
+ ***
305
+
306
+ ### bellmanFord()
307
+
308
+ ```ts
309
+ bellmanFord(
310
+ src,
311
+ scanNegativeCycle?,
312
+ getMin?,
313
+ genPath?): object;
314
+ ```
315
+
316
+ Defined in: [data-structures/graph/abstract-graph.ts:705](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L705)
317
+
318
+ Bellman-Ford single-source shortest paths with option to scan negative cycles.
319
+
320
+ #### Parameters
321
+
322
+ ##### src
323
+
324
+ `VertexKey` \| `VO`
325
+
326
+ Source vertex or key.
327
+
328
+ ##### scanNegativeCycle?
329
+
330
+ `boolean`
331
+
332
+ If `true`, also detect negative cycles.
333
+
334
+ ##### getMin?
335
+
336
+ `boolean`
337
+
338
+ If `true`, compute global minimum distance.
339
+
340
+ ##### genPath?
341
+
342
+ `boolean`
343
+
344
+ If `true`, generate path arrays via predecessor map.
345
+
346
+ #### Returns
347
+
348
+ `object`
349
+
350
+ Result bag including distances, predecessors, and optional cycle flag.
351
+
352
+ ##### distMap
353
+
354
+ ```ts
355
+ distMap: Map<VO, number>;
356
+ ```
357
+
358
+ ##### hasNegativeCycle
359
+
360
+ ```ts
361
+ hasNegativeCycle: boolean | undefined;
362
+ ```
363
+
364
+ ##### min
365
+
366
+ ```ts
367
+ min: number;
368
+ ```
369
+
370
+ ##### minPath
371
+
372
+ ```ts
373
+ minPath: VO[];
374
+ ```
375
+
376
+ ##### paths
377
+
378
+ ```ts
379
+ paths: VO[][];
380
+ ```
381
+
382
+ ##### preMap
383
+
384
+ ```ts
385
+ preMap: Map<VO, VO>;
386
+ ```
387
+
388
+ #### Remarks
389
+
390
+ Time O(V * E), Space O(V + E)
391
+
392
+ ***
393
+
394
+ ### clear()
395
+
396
+ ```ts
397
+ abstract clear(): void;
398
+ ```
399
+
400
+ Defined in: [data-structures/base/iterable-entry-base.ts:218](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L218)
401
+
402
+ Remove all entries.
403
+
404
+ #### Returns
405
+
406
+ `void`
407
+
408
+ #### Remarks
409
+
410
+ Time O(n) typical, Space O(1)
411
+
412
+ #### Implementation of
413
+
414
+ ```ts
415
+ IGraph.clear
416
+ ```
417
+
418
+ #### Inherited from
419
+
420
+ [`IterableEntryBase`](IterableEntryBase.md).[`clear`](IterableEntryBase.md#clear)
421
+
422
+ ***
423
+
424
+ ### clone()
425
+
426
+ ```ts
427
+ clone(): this;
428
+ ```
429
+
430
+ Defined in: [data-structures/graph/abstract-graph.ts:947](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L947)
431
+
432
+ Create a deep clone of the graph with the same species.
433
+
434
+ #### Returns
435
+
436
+ `this`
437
+
438
+ A new graph of the same concrete class (`this` type).
439
+
440
+ #### Remarks
441
+
442
+ Time O(V + E), Space O(V + E)
443
+
444
+ #### Implementation of
445
+
446
+ ```ts
447
+ IGraph.clone
448
+ ```
449
+
450
+ #### Overrides
451
+
452
+ [`IterableEntryBase`](IterableEntryBase.md).[`clone`](IterableEntryBase.md#clone)
453
+
454
+ ***
455
+
456
+ ### createEdge()
457
+
458
+ ```ts
459
+ abstract createEdge(
460
+ srcOrV1,
461
+ destOrV2,
462
+ weight?,
463
+ value?): EO;
464
+ ```
465
+
466
+ Defined in: [data-structures/graph/abstract-graph.ts:111](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L111)
467
+
468
+ Create a new edge instance (implementation specific).
469
+
470
+ #### Parameters
471
+
472
+ ##### srcOrV1
473
+
474
+ `VertexKey`
475
+
476
+ Source/endpoint A key.
477
+
478
+ ##### destOrV2
479
+
480
+ `VertexKey`
481
+
482
+ Destination/endpoint B key.
483
+
484
+ ##### weight?
485
+
486
+ `number`
487
+
488
+ Edge weight (defaults may apply).
489
+
490
+ ##### value?
491
+
492
+ `E`
493
+
494
+ Edge payload.
495
+
496
+ #### Returns
497
+
498
+ `EO`
499
+
500
+ Concrete edge instance.
501
+
502
+ #### Remarks
503
+
504
+ Time O(1), Space O(1)
505
+
506
+ #### Implementation of
507
+
508
+ ```ts
509
+ IGraph.createEdge
510
+ ```
511
+
512
+ ***
513
+
514
+ ### createVertex()
515
+
516
+ ```ts
517
+ abstract createVertex(key, value?): VO;
518
+ ```
519
+
520
+ Defined in: [data-structures/graph/abstract-graph.ts:100](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L100)
521
+
522
+ Create a new vertex instance (implementation specific).
523
+
524
+ #### Parameters
525
+
526
+ ##### key
527
+
528
+ `VertexKey`
529
+
530
+ Vertex identifier.
531
+
532
+ ##### value?
533
+
534
+ `V`
535
+
536
+ Optional payload.
537
+
538
+ #### Returns
539
+
540
+ `VO`
541
+
542
+ Concrete vertex instance.
543
+
544
+ #### Remarks
545
+
546
+ Time O(1), Space O(1)
547
+
548
+ #### Implementation of
549
+
550
+ ```ts
551
+ IGraph.createVertex
552
+ ```
553
+
554
+ ***
555
+
556
+ ### degreeOf()
557
+
558
+ ```ts
559
+ abstract degreeOf(vertexOrKey): number;
560
+ ```
561
+
562
+ Defined in: [data-structures/graph/abstract-graph.ts:136](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L136)
563
+
564
+ Degree of a vertex in this graph model.
565
+
566
+ #### Parameters
567
+
568
+ ##### vertexOrKey
569
+
570
+ `VertexKey` \| `VO`
571
+
572
+ Vertex or key.
573
+
574
+ #### Returns
575
+
576
+ `number`
577
+
578
+ Non-negative integer degree.
579
+
580
+ #### Remarks
581
+
582
+ Time O(1) avg, Space O(1)
583
+
584
+ #### Implementation of
585
+
586
+ ```ts
587
+ IGraph.degreeOf
588
+ ```
589
+
590
+ ***
591
+
592
+ ### deleteEdge()
593
+
594
+ ```ts
595
+ abstract deleteEdge(edge): EO | undefined;
596
+ ```
597
+
598
+ Defined in: [data-structures/graph/abstract-graph.ts:119](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L119)
599
+
600
+ Delete an edge by instance.
601
+
602
+ #### Parameters
603
+
604
+ ##### edge
605
+
606
+ `EO`
607
+
608
+ Edge instance.
609
+
610
+ #### Returns
611
+
612
+ `EO` \| `undefined`
613
+
614
+ Removed edge or `undefined`.
615
+
616
+ #### Remarks
617
+
618
+ Time O(1) avg, Space O(1)
619
+
620
+ #### Implementation of
621
+
622
+ ```ts
623
+ IGraph.deleteEdge
624
+ ```
625
+
626
+ ***
627
+
628
+ ### deleteVertex()
629
+
630
+ ```ts
631
+ abstract deleteVertex(vertexOrKey): boolean;
632
+ ```
633
+
634
+ Defined in: [data-structures/graph/abstract-graph.ts:226](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L226)
635
+
636
+ Delete a vertex and its incident edges.
637
+
638
+ #### Parameters
639
+
640
+ ##### vertexOrKey
641
+
642
+ `VertexKey` \| `VO`
643
+
644
+ Vertex or key.
645
+
646
+ #### Returns
647
+
648
+ `boolean`
649
+
650
+ `true` if removed; otherwise `false`.
651
+
652
+ #### Remarks
653
+
654
+ Time O(deg), Space O(1)
655
+
656
+ #### Implementation of
657
+
658
+ ```ts
659
+ IGraph.deleteVertex
660
+ ```
661
+
662
+ ***
663
+
664
+ ### dijkstraWithoutHeap()
665
+
666
+ ```ts
667
+ dijkstraWithoutHeap(
668
+ src,
669
+ dest?,
670
+ getMinDist?,
671
+ genPaths?): DijkstraResult<VO>;
672
+ ```
673
+
674
+ Defined in: [data-structures/graph/abstract-graph.ts:484](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L484)
675
+
676
+ Dijkstra without heap (array-based selection).
677
+
678
+ #### Parameters
679
+
680
+ ##### src
681
+
682
+ `VertexKey` \| `VO`
683
+
684
+ Source vertex or key.
685
+
686
+ ##### dest?
687
+
688
+ `VertexKey` \| `VO` \| `undefined`
689
+
690
+ Optional destination for early stop.
691
+
692
+ ##### getMinDist?
693
+
694
+ `boolean` = `false`
695
+
696
+ If `true`, compute global minimum distance.
697
+
698
+ ##### genPaths?
699
+
700
+ `boolean` = `false`
701
+
702
+ If `true`, also generate path arrays.
703
+
704
+ #### Returns
705
+
706
+ `DijkstraResult`\<`VO`\>
707
+
708
+ Result bag or `undefined` if source missing.
709
+
710
+ #### Remarks
711
+
712
+ Time O(V^2 + E), Space O(V + E)
713
+
714
+ ***
715
+
716
+ ### edgeSet()
717
+
718
+ ```ts
719
+ abstract edgeSet(): EO[];
720
+ ```
721
+
722
+ Defined in: [data-structures/graph/abstract-graph.ts:143](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L143)
723
+
724
+ All edges in the graph (unique, order not guaranteed).
725
+
726
+ #### Returns
727
+
728
+ `EO`[]
729
+
730
+ Array of edges.
731
+
732
+ #### Remarks
733
+
734
+ Time O(E), Space O(E)
735
+
736
+ #### Implementation of
737
+
738
+ ```ts
739
+ IGraph.edgeSet
740
+ ```
741
+
742
+ ***
743
+
744
+ ### edgesOf()
745
+
746
+ ```ts
747
+ abstract edgesOf(vertexOrKey): EO[];
748
+ ```
749
+
750
+ Defined in: [data-structures/graph/abstract-graph.ts:151](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L151)
751
+
752
+ Incident edges of a vertex.
753
+
754
+ #### Parameters
755
+
756
+ ##### vertexOrKey
757
+
758
+ `VertexKey` \| `VO`
759
+
760
+ Vertex or key.
761
+
762
+ #### Returns
763
+
764
+ `EO`[]
765
+
766
+ Array of incident edges.
767
+
768
+ #### Remarks
769
+
770
+ Time O(deg), Space O(deg)
771
+
772
+ #### Implementation of
773
+
774
+ ```ts
775
+ IGraph.edgesOf
776
+ ```
777
+
778
+ ***
779
+
780
+ ### entries()
781
+
782
+ ```ts
783
+ entries(): IterableIterator<[VertexKey, V | undefined]>;
784
+ ```
785
+
786
+ Defined in: [data-structures/base/iterable-entry-base.ts:31](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L31)
787
+
788
+ Iterate over `[key, value]` pairs (may yield `undefined` values).
789
+
790
+ #### Returns
791
+
792
+ `IterableIterator`\<\[`VertexKey`, `V` \| `undefined`\]\>
793
+
794
+ Iterator of `[K, V | undefined]`.
795
+
796
+ #### Remarks
797
+
798
+ Time O(n), Space O(1)
799
+
800
+ #### Inherited from
801
+
802
+ [`IterableEntryBase`](IterableEntryBase.md).[`entries`](IterableEntryBase.md#entries)
803
+
804
+ ***
805
+
806
+ ### every()
807
+
808
+ ```ts
809
+ every(predicate, thisArg?): boolean;
810
+ ```
811
+
812
+ Defined in: [data-structures/base/iterable-entry-base.ts:66](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L66)
813
+
814
+ Test whether all entries satisfy the predicate.
815
+
816
+ #### Parameters
817
+
818
+ ##### predicate
819
+
820
+ `EntryCallback`\<`VertexKey`, `V` \| `undefined`, `boolean`\>
821
+
822
+ `(key, value, index, self) => boolean`.
823
+
824
+ ##### thisArg?
825
+
826
+ `any`
827
+
828
+ Optional `this` for callback.
829
+
830
+ #### Returns
831
+
832
+ `boolean`
833
+
834
+ `true` if all pass; otherwise `false`.
835
+
836
+ #### Remarks
837
+
838
+ Time O(n), Space O(1)
839
+
840
+ #### Inherited from
841
+
842
+ [`IterableEntryBase`](IterableEntryBase.md).[`every`](IterableEntryBase.md#every)
843
+
844
+ ***
845
+
846
+ ### filter()
847
+
848
+ ```ts
849
+ filter(predicate, thisArg?): this;
850
+ ```
851
+
852
+ Defined in: [data-structures/graph/abstract-graph.ts:897](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L897)
853
+
854
+ Induced-subgraph filter: keep vertices where `predicate(key, value)` is true,
855
+ and only keep edges whose endpoints both survive.
856
+
857
+ #### Parameters
858
+
859
+ ##### predicate
860
+
861
+ `EntryCallback`\<`VertexKey`, `V` \| `undefined`, `boolean`\>
862
+
863
+ `(key, value, index, self) => boolean`.
864
+
865
+ ##### thisArg?
866
+
867
+ `any`
868
+
869
+ Optional `this` for callback.
870
+
871
+ #### Returns
872
+
873
+ `this`
874
+
875
+ A new graph of the same concrete class (`this` type).
876
+
877
+ #### Remarks
878
+
879
+ Time O(V + E), Space O(V + E)
880
+
881
+ #### Implementation of
882
+
883
+ ```ts
884
+ IGraph.filter
885
+ ```
886
+
887
+ #### Overrides
888
+
889
+ [`IterableEntryBase`](IterableEntryBase.md).[`filter`](IterableEntryBase.md#filter)
890
+
891
+ ***
892
+
893
+ ### filterEntries()
894
+
895
+ ```ts
896
+ filterEntries(predicate, thisArg?): [VertexKey, V | undefined][];
897
+ ```
898
+
899
+ Defined in: [data-structures/graph/abstract-graph.ts:913](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L913)
900
+
901
+ Preserve the old behavior: return filtered entries as an array.
902
+
903
+ #### Parameters
904
+
905
+ ##### predicate
906
+
907
+ `EntryCallback`\<`VertexKey`, `V` \| `undefined`, `boolean`\>
908
+
909
+ ##### thisArg?
910
+
911
+ `any`
912
+
913
+ #### Returns
914
+
915
+ \[`VertexKey`, `V` \| `undefined`\][]
916
+
917
+ #### Remarks
918
+
919
+ Time O(V), Space O(V)
920
+
921
+ ***
922
+
923
+ ### find()
924
+
925
+ ```ts
926
+ find(callbackfn, thisArg?): [VertexKey, V | undefined] | undefined;
927
+ ```
928
+
929
+ Defined in: [data-structures/base/iterable-entry-base.ts:114](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L114)
930
+
931
+ Find the first entry that matches a predicate.
932
+
933
+ #### Parameters
934
+
935
+ ##### callbackfn
936
+
937
+ `EntryCallback`\<`VertexKey`, `V` \| `undefined`, `boolean`\>
938
+
939
+ `(key, value, index, self) => boolean`.
940
+
941
+ ##### thisArg?
942
+
943
+ `any`
944
+
945
+ Optional `this` for callback.
946
+
947
+ #### Returns
948
+
949
+ \[`VertexKey`, `V` \| `undefined`\] \| `undefined`
950
+
951
+ Matching `[key, value]` or `undefined`.
952
+
953
+ #### Remarks
954
+
955
+ Time O(n), Space O(1)
956
+
957
+ #### Inherited from
958
+
959
+ [`IterableEntryBase`](IterableEntryBase.md).[`find`](IterableEntryBase.md#find)
960
+
961
+ ***
962
+
963
+ ### floydWarshall()
964
+
965
+ ```ts
966
+ floydWarshall(): object;
967
+ ```
968
+
969
+ Defined in: [data-structures/graph/abstract-graph.ts:798](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L798)
970
+
971
+ Floyd–Warshall all-pairs shortest paths.
972
+
973
+ #### Returns
974
+
975
+ `object`
976
+
977
+ `{ costs, predecessor }` matrices.
978
+
979
+ ##### costs
980
+
981
+ ```ts
982
+ costs: number[][];
983
+ ```
984
+
985
+ ##### predecessor
986
+
987
+ ```ts
988
+ predecessor: (VO | undefined)[][];
989
+ ```
990
+
991
+ #### Remarks
992
+
993
+ Time O(V^3), Space O(V^2)
994
+
995
+ ***
996
+
997
+ ### forEach()
998
+
999
+ ```ts
1000
+ forEach(callbackfn, thisArg?): void;
1001
+ ```
1002
+
1003
+ Defined in: [data-structures/base/iterable-entry-base.ts:99](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L99)
1004
+
1005
+ Visit each entry, left-to-right.
1006
+
1007
+ #### Parameters
1008
+
1009
+ ##### callbackfn
1010
+
1011
+ `EntryCallback`\<`VertexKey`, `V` \| `undefined`, `void`\>
1012
+
1013
+ `(key, value, index, self) => void`.
1014
+
1015
+ ##### thisArg?
1016
+
1017
+ `any`
1018
+
1019
+ Optional `this` for callback.
1020
+
1021
+ #### Returns
1022
+
1023
+ `void`
1024
+
1025
+ #### Remarks
1026
+
1027
+ Time O(n), Space O(1)
1028
+
1029
+ #### Inherited from
1030
+
1031
+ [`IterableEntryBase`](IterableEntryBase.md).[`forEach`](IterableEntryBase.md#foreach)
1032
+
1033
+ ***
1034
+
1035
+ ### get()
1036
+
1037
+ ```ts
1038
+ get(key): V | undefined;
1039
+ ```
1040
+
1041
+ Defined in: [data-structures/base/iterable-entry-base.ts:156](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L156)
1042
+
1043
+ Get the value under a key.
1044
+
1045
+ #### Parameters
1046
+
1047
+ ##### key
1048
+
1049
+ `VertexKey`
1050
+
1051
+ Key to look up.
1052
+
1053
+ #### Returns
1054
+
1055
+ `V` \| `undefined`
1056
+
1057
+ Value or `undefined`.
1058
+
1059
+ #### Remarks
1060
+
1061
+ Time O(n) generic, Space O(1)
1062
+
1063
+ #### Inherited from
1064
+
1065
+ [`IterableEntryBase`](IterableEntryBase.md).[`get`](IterableEntryBase.md#get)
1066
+
1067
+ ***
1068
+
1069
+ ### getAllPathsBetween()
1070
+
1071
+ ```ts
1072
+ getAllPathsBetween(
1073
+ v1,
1074
+ v2,
1075
+ limit?): VO[][];
1076
+ ```
1077
+
1078
+ Defined in: [data-structures/graph/abstract-graph.ts:309](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L309)
1079
+
1080
+ Enumerate simple paths up to a limit.
1081
+
1082
+ #### Parameters
1083
+
1084
+ ##### v1
1085
+
1086
+ `VertexKey` \| `VO`
1087
+
1088
+ Source vertex or key.
1089
+
1090
+ ##### v2
1091
+
1092
+ `VertexKey` \| `VO`
1093
+
1094
+ Destination vertex or key.
1095
+
1096
+ ##### limit?
1097
+
1098
+ `number` = `1000`
1099
+
1100
+ Maximum number of paths to collect.
1101
+
1102
+ #### Returns
1103
+
1104
+ `VO`[][]
1105
+
1106
+ Array of paths (each path is an array of vertices).
1107
+
1108
+ #### Remarks
1109
+
1110
+ Time O(paths) worst-case exponential, Space O(V + paths)
1111
+
1112
+ ***
1113
+
1114
+ ### getCycles()
1115
+
1116
+ ```ts
1117
+ getCycles(isInclude2Cycle?): VertexKey[][];
1118
+ ```
1119
+
1120
+ Defined in: [data-structures/graph/abstract-graph.ts:838](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L838)
1121
+
1122
+ Enumerate simple cycles (may be expensive).
1123
+
1124
+ #### Parameters
1125
+
1126
+ ##### isInclude2Cycle?
1127
+
1128
+ `boolean` = `false`
1129
+
1130
+ If `true`, include 2-cycles when graph semantics allow.
1131
+
1132
+ #### Returns
1133
+
1134
+ `VertexKey`[][]
1135
+
1136
+ Array of cycles (each as array of vertex keys).
1137
+
1138
+ #### Remarks
1139
+
1140
+ Time exponential in worst-case, Space O(V + E)
1141
+
1142
+ ***
1143
+
1144
+ ### getEdge()
1145
+
1146
+ ```ts
1147
+ abstract getEdge(srcOrKey, destOrKey): EO | undefined;
1148
+ ```
1149
+
1150
+ Defined in: [data-structures/graph/abstract-graph.ts:128](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L128)
1151
+
1152
+ Get an edge between two vertices if present.
1153
+
1154
+ #### Parameters
1155
+
1156
+ ##### srcOrKey
1157
+
1158
+ `VertexKey` \| `VO`
1159
+
1160
+ Source/endpoint A vertex or key.
1161
+
1162
+ ##### destOrKey
1163
+
1164
+ `VertexKey` \| `VO`
1165
+
1166
+ Destination/endpoint B vertex or key.
1167
+
1168
+ #### Returns
1169
+
1170
+ `EO` \| `undefined`
1171
+
1172
+ Edge instance or `undefined`.
1173
+
1174
+ #### Remarks
1175
+
1176
+ Time O(1) avg, Space O(1)
1177
+
1178
+ #### Implementation of
1179
+
1180
+ ```ts
1181
+ IGraph.getEdge
1182
+ ```
1183
+
1184
+ ***
1185
+
1186
+ ### getEndsOfEdge()
1187
+
1188
+ ```ts
1189
+ abstract getEndsOfEdge(edge): [VO, VO] | undefined;
1190
+ ```
1191
+
1192
+ Defined in: [data-structures/graph/abstract-graph.ts:167](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L167)
1193
+
1194
+ Resolve endpoints of an edge to vertex instances.
1195
+
1196
+ #### Parameters
1197
+
1198
+ ##### edge
1199
+
1200
+ `EO`
1201
+
1202
+ Edge instance.
1203
+
1204
+ #### Returns
1205
+
1206
+ \[`VO`, `VO`\] \| `undefined`
1207
+
1208
+ `[v1, v2]` or `undefined` if missing.
1209
+
1210
+ #### Remarks
1211
+
1212
+ Time O(1), Space O(1)
1213
+
1214
+ #### Implementation of
1215
+
1216
+ ```ts
1217
+ IGraph.getEndsOfEdge
1218
+ ```
1219
+
1220
+ ***
1221
+
1222
+ ### getMinCostBetween()
1223
+
1224
+ ```ts
1225
+ getMinCostBetween(
1226
+ v1,
1227
+ v2,
1228
+ isWeight?): number | undefined;
1229
+ ```
1230
+
1231
+ Defined in: [data-structures/graph/abstract-graph.ts:362](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L362)
1232
+
1233
+ Minimum hops/weight between two vertices.
1234
+
1235
+ #### Parameters
1236
+
1237
+ ##### v1
1238
+
1239
+ `VertexKey` \| `VO`
1240
+
1241
+ Source vertex or key.
1242
+
1243
+ ##### v2
1244
+
1245
+ `VertexKey` \| `VO`
1246
+
1247
+ Destination vertex or key.
1248
+
1249
+ ##### isWeight?
1250
+
1251
+ `boolean`
1252
+
1253
+ If `true`, compare by path weight; otherwise by hop count.
1254
+
1255
+ #### Returns
1256
+
1257
+ `number` \| `undefined`
1258
+
1259
+ Minimum cost or `undefined` if missing/unreachable.
1260
+
1261
+ #### Remarks
1262
+
1263
+ Time O((V + E) log V) weighted / O(V + E) unweighted, Space O(V + E)
1264
+
1265
+ ***
1266
+
1267
+ ### getMinPathBetween()
1268
+
1269
+ ```ts
1270
+ getMinPathBetween(
1271
+ v1,
1272
+ v2,
1273
+ isWeight?,
1274
+ isDFS?): VO[] | undefined;
1275
+ ```
1276
+
1277
+ Defined in: [data-structures/graph/abstract-graph.ts:415](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L415)
1278
+
1279
+ Minimum path (as vertex sequence) between two vertices.
1280
+
1281
+ #### Parameters
1282
+
1283
+ ##### v1
1284
+
1285
+ `VertexKey` \| `VO`
1286
+
1287
+ Source vertex or key.
1288
+
1289
+ ##### v2
1290
+
1291
+ `VertexKey` \| `VO`
1292
+
1293
+ Destination vertex or key.
1294
+
1295
+ ##### isWeight?
1296
+
1297
+ `boolean`
1298
+
1299
+ If `true`, compare by path weight; otherwise by hop count.
1300
+
1301
+ ##### isDFS?
1302
+
1303
+ `boolean` = `false`
1304
+
1305
+ For weighted mode only: if `true`, brute-force all paths; if `false`, use Dijkstra.
1306
+
1307
+ #### Returns
1308
+
1309
+ `VO`[] \| `undefined`
1310
+
1311
+ Vertex sequence, or `undefined`/empty when unreachable depending on branch.
1312
+
1313
+ #### Remarks
1314
+
1315
+ Time O((V + E) log V) weighted / O(V + E) unweighted, Space O(V + E)
1316
+
1317
+ ***
1318
+
1319
+ ### getNeighbors()
1320
+
1321
+ ```ts
1322
+ abstract getNeighbors(vertexOrKey): VO[];
1323
+ ```
1324
+
1325
+ Defined in: [data-structures/graph/abstract-graph.ts:159](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L159)
1326
+
1327
+ One-step neighbors of a vertex.
1328
+
1329
+ #### Parameters
1330
+
1331
+ ##### vertexOrKey
1332
+
1333
+ `VertexKey` \| `VO`
1334
+
1335
+ Vertex or key.
1336
+
1337
+ #### Returns
1338
+
1339
+ `VO`[]
1340
+
1341
+ Array of neighbor vertices.
1342
+
1343
+ #### Remarks
1344
+
1345
+ Time O(deg), Space O(deg)
1346
+
1347
+ #### Implementation of
1348
+
1349
+ ```ts
1350
+ IGraph.getNeighbors
1351
+ ```
1352
+
1353
+ ***
1354
+
1355
+ ### getPathSumWeight()
1356
+
1357
+ ```ts
1358
+ getPathSumWeight(path): number;
1359
+ ```
1360
+
1361
+ Defined in: [data-structures/graph/abstract-graph.ts:346](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L346)
1362
+
1363
+ Sum the weights along a vertex path.
1364
+
1365
+ #### Parameters
1366
+
1367
+ ##### path
1368
+
1369
+ `VO`[]
1370
+
1371
+ Sequence of vertices.
1372
+
1373
+ #### Returns
1374
+
1375
+ `number`
1376
+
1377
+ Path weight sum (0 if empty or edge missing).
1378
+
1379
+ #### Remarks
1380
+
1381
+ Time O(L), Space O(1) where L is path length
1382
+
1383
+ ***
1384
+
1385
+ ### getVertex()
1386
+
1387
+ ```ts
1388
+ getVertex(vertexKey): VO | undefined;
1389
+ ```
1390
+
1391
+ Defined in: [data-structures/graph/abstract-graph.ts:175](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L175)
1392
+
1393
+ Get vertex instance by key.
1394
+
1395
+ #### Parameters
1396
+
1397
+ ##### vertexKey
1398
+
1399
+ `VertexKey`
1400
+
1401
+ Vertex key.
1402
+
1403
+ #### Returns
1404
+
1405
+ `VO` \| `undefined`
1406
+
1407
+ Vertex instance or `undefined`.
1408
+
1409
+ #### Remarks
1410
+
1411
+ Time O(1), Space O(1)
1412
+
1413
+ #### Implementation of
1414
+
1415
+ ```ts
1416
+ IGraph.getVertex
1417
+ ```
1418
+
1419
+ ***
1420
+
1421
+ ### has()
1422
+
1423
+ ```ts
1424
+ has(key): boolean;
1425
+ ```
1426
+
1427
+ Defined in: [data-structures/base/iterable-entry-base.ts:129](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L129)
1428
+
1429
+ Whether the given key exists.
1430
+
1431
+ #### Parameters
1432
+
1433
+ ##### key
1434
+
1435
+ `VertexKey`
1436
+
1437
+ Key to test.
1438
+
1439
+ #### Returns
1440
+
1441
+ `boolean`
1442
+
1443
+ `true` if found; otherwise `false`.
1444
+
1445
+ #### Remarks
1446
+
1447
+ Time O(n) generic, Space O(1)
1448
+
1449
+ #### Inherited from
1450
+
1451
+ [`IterableEntryBase`](IterableEntryBase.md).[`has`](IterableEntryBase.md#has)
1452
+
1453
+ ***
1454
+
1455
+ ### hasEdge()
1456
+
1457
+ ```ts
1458
+ hasEdge(v1, v2): boolean;
1459
+ ```
1460
+
1461
+ Defined in: [data-structures/graph/abstract-graph.ts:249](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L249)
1462
+
1463
+ Whether an edge exists between two vertices.
1464
+
1465
+ #### Parameters
1466
+
1467
+ ##### v1
1468
+
1469
+ `VertexKey` \| `VO`
1470
+
1471
+ Endpoint A vertex or key.
1472
+
1473
+ ##### v2
1474
+
1475
+ `VertexKey` \| `VO`
1476
+
1477
+ Endpoint B vertex or key.
1478
+
1479
+ #### Returns
1480
+
1481
+ `boolean`
1482
+
1483
+ `true` if present; otherwise `false`.
1484
+
1485
+ #### Remarks
1486
+
1487
+ Time O(1) avg, Space O(1)
1488
+
1489
+ ***
1490
+
1491
+ ### hasValue()
1492
+
1493
+ ```ts
1494
+ hasValue(value): boolean;
1495
+ ```
1496
+
1497
+ Defined in: [data-structures/base/iterable-entry-base.ts:143](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L143)
1498
+
1499
+ Whether there exists an entry with the given value.
1500
+
1501
+ #### Parameters
1502
+
1503
+ ##### value
1504
+
1505
+ `V` \| `undefined`
1506
+
1507
+ Value to test.
1508
+
1509
+ #### Returns
1510
+
1511
+ `boolean`
1512
+
1513
+ `true` if found; otherwise `false`.
1514
+
1515
+ #### Remarks
1516
+
1517
+ Time O(n), Space O(1)
1518
+
1519
+ #### Inherited from
1520
+
1521
+ [`IterableEntryBase`](IterableEntryBase.md).[`hasValue`](IterableEntryBase.md#hasvalue)
1522
+
1523
+ ***
1524
+
1525
+ ### hasVertex()
1526
+
1527
+ ```ts
1528
+ hasVertex(vertexOrKey): boolean;
1529
+ ```
1530
+
1531
+ Defined in: [data-structures/graph/abstract-graph.ts:185](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L185)
1532
+
1533
+ Whether a vertex exists.
1534
+
1535
+ #### Parameters
1536
+
1537
+ ##### vertexOrKey
1538
+
1539
+ `VertexKey` \| `VO`
1540
+
1541
+ Vertex or key.
1542
+
1543
+ #### Returns
1544
+
1545
+ `boolean`
1546
+
1547
+ `true` if present, otherwise `false`.
1548
+
1549
+ #### Remarks
1550
+
1551
+ Time O(1) avg, Space O(1)
1552
+
1553
+ #### Implementation of
1554
+
1555
+ ```ts
1556
+ IGraph.hasVertex
1557
+ ```
1558
+
1559
+ ***
1560
+
1561
+ ### isEmpty()
1562
+
1563
+ ```ts
1564
+ abstract isEmpty(): boolean;
1565
+ ```
1566
+
1567
+ Defined in: [data-structures/base/iterable-entry-base.ts:212](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L212)
1568
+
1569
+ Whether there are no entries.
1570
+
1571
+ #### Returns
1572
+
1573
+ `boolean`
1574
+
1575
+ `true` if empty; `false` otherwise.
1576
+
1577
+ #### Remarks
1578
+
1579
+ Time O(1) typical, Space O(1)
1580
+
1581
+ #### Implementation of
1582
+
1583
+ ```ts
1584
+ IGraph.isEmpty
1585
+ ```
1586
+
1587
+ #### Inherited from
1588
+
1589
+ [`IterableEntryBase`](IterableEntryBase.md).[`isEmpty`](IterableEntryBase.md#isempty)
1590
+
1591
+ ***
1592
+
1593
+ ### isVertexKey()
1594
+
1595
+ ```ts
1596
+ isVertexKey(potentialKey): potentialKey is VertexKey;
1597
+ ```
1598
+
1599
+ Defined in: [data-structures/graph/abstract-graph.ts:215](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L215)
1600
+
1601
+ Type guard: check if a value is a valid vertex key.
1602
+
1603
+ #### Parameters
1604
+
1605
+ ##### potentialKey
1606
+
1607
+ `any`
1608
+
1609
+ Value to test.
1610
+
1611
+ #### Returns
1612
+
1613
+ `potentialKey is VertexKey`
1614
+
1615
+ `true` if string/number; else `false`.
1616
+
1617
+ #### Remarks
1618
+
1619
+ Time O(1), Space O(1)
1620
+
1621
+ ***
1622
+
1623
+ ### keys()
1624
+
1625
+ ```ts
1626
+ keys(): IterableIterator<VertexKey>;
1627
+ ```
1628
+
1629
+ Defined in: [data-structures/base/iterable-entry-base.ts:42](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L42)
1630
+
1631
+ Iterate over keys only.
1632
+
1633
+ #### Returns
1634
+
1635
+ `IterableIterator`\<`VertexKey`\>
1636
+
1637
+ Iterator of keys.
1638
+
1639
+ #### Remarks
1640
+
1641
+ Time O(n), Space O(1)
1642
+
1643
+ #### Inherited from
1644
+
1645
+ [`IterableEntryBase`](IterableEntryBase.md).[`keys`](IterableEntryBase.md#keys)
1646
+
1647
+ ***
1648
+
1649
+ ### map()
1650
+
1651
+ ```ts
1652
+ map<T>(callback, thisArg?): T[];
1653
+ ```
1654
+
1655
+ Defined in: [data-structures/graph/abstract-graph.ts:928](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L928)
1656
+
1657
+ Map entries using an implementation-specific strategy.
1658
+
1659
+ #### Type Parameters
1660
+
1661
+ ##### T
1662
+
1663
+ `T`
1664
+
1665
+ #### Parameters
1666
+
1667
+ ##### callback
1668
+
1669
+ `EntryCallback`\<`VertexKey`, `V` \| `undefined`, `T`\>
1670
+
1671
+ ##### thisArg?
1672
+
1673
+ `any`
1674
+
1675
+ #### Returns
1676
+
1677
+ `T`[]
1678
+
1679
+ #### Remarks
1680
+
1681
+ Time O(n), Space O(n)
1682
+
1683
+ #### Overrides
1684
+
1685
+ [`IterableEntryBase`](IterableEntryBase.md).[`map`](IterableEntryBase.md#map)
1686
+
1687
+ ***
1688
+
1689
+ ### print()
1690
+
1691
+ ```ts
1692
+ print(options?): void;
1693
+ ```
1694
+
1695
+ Defined in: [data-structures/graph/abstract-graph.ts:1183](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1183)
1696
+
1697
+ Print the graph to console.
1698
+
1699
+ #### Parameters
1700
+
1701
+ ##### options?
1702
+
1703
+ Display settings passed to `toVisual`.
1704
+
1705
+ ###### showWeight?
1706
+
1707
+ `boolean`
1708
+
1709
+ #### Returns
1710
+
1711
+ `void`
1712
+
1713
+ #### Overrides
1714
+
1715
+ [`IterableEntryBase`](IterableEntryBase.md).[`print`](IterableEntryBase.md#print)
1716
+
1717
+ ***
1718
+
1719
+ ### reduce()
1720
+
1721
+ ```ts
1722
+ reduce<U>(callbackfn, initialValue): U;
1723
+ ```
1724
+
1725
+ Defined in: [data-structures/base/iterable-entry-base.ts:171](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L171)
1726
+
1727
+ Reduce entries into a single accumulator.
1728
+
1729
+ #### Type Parameters
1730
+
1731
+ ##### U
1732
+
1733
+ `U`
1734
+
1735
+ #### Parameters
1736
+
1737
+ ##### callbackfn
1738
+
1739
+ `ReduceEntryCallback`\<`VertexKey`, `V` \| `undefined`, `U`\>
1740
+
1741
+ `(acc, value, key, index, self) => acc`.
1742
+
1743
+ ##### initialValue
1744
+
1745
+ `U`
1746
+
1747
+ Initial accumulator.
1748
+
1749
+ #### Returns
1750
+
1751
+ `U`
1752
+
1753
+ Final accumulator.
1754
+
1755
+ #### Remarks
1756
+
1757
+ Time O(n), Space O(1)
1758
+
1759
+ #### Inherited from
1760
+
1761
+ [`IterableEntryBase`](IterableEntryBase.md).[`reduce`](IterableEntryBase.md#reduce)
1762
+
1763
+ ***
1764
+
1765
+ ### removeManyVertices()
1766
+
1767
+ ```ts
1768
+ removeManyVertices(vertexMap): boolean;
1769
+ ```
1770
+
1771
+ Defined in: [data-structures/graph/abstract-graph.ts:234](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L234)
1772
+
1773
+ Delete multiple vertices.
1774
+
1775
+ #### Parameters
1776
+
1777
+ ##### vertexMap
1778
+
1779
+ `VO`[] \| `VertexKey`[]
1780
+
1781
+ Array of vertices or keys.
1782
+
1783
+ #### Returns
1784
+
1785
+ `boolean`
1786
+
1787
+ `true` if any vertex was removed.
1788
+
1789
+ #### Remarks
1790
+
1791
+ Time O(sum(deg)), Space O(1)
1792
+
1793
+ ***
1794
+
1795
+ ### setEdgeWeight()
1796
+
1797
+ ```ts
1798
+ setEdgeWeight(
1799
+ srcOrKey,
1800
+ destOrKey,
1801
+ weight): boolean;
1802
+ ```
1803
+
1804
+ Defined in: [data-structures/graph/abstract-graph.ts:291](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L291)
1805
+
1806
+ Set the weight of an existing edge.
1807
+
1808
+ #### Parameters
1809
+
1810
+ ##### srcOrKey
1811
+
1812
+ `VertexKey` \| `VO`
1813
+
1814
+ Source vertex or key.
1815
+
1816
+ ##### destOrKey
1817
+
1818
+ `VertexKey` \| `VO`
1819
+
1820
+ Destination vertex or key.
1821
+
1822
+ ##### weight
1823
+
1824
+ `number`
1825
+
1826
+ New weight.
1827
+
1828
+ #### Returns
1829
+
1830
+ `boolean`
1831
+
1832
+ `true` if updated; otherwise `false`.
1833
+
1834
+ #### Remarks
1835
+
1836
+ Time O(1) avg, Space O(1)
1837
+
1838
+ ***
1839
+
1840
+ ### some()
1841
+
1842
+ ```ts
1843
+ some(predicate, thisArg?): boolean;
1844
+ ```
1845
+
1846
+ Defined in: [data-structures/base/iterable-entry-base.ts:83](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L83)
1847
+
1848
+ Test whether any entry satisfies the predicate.
1849
+
1850
+ #### Parameters
1851
+
1852
+ ##### predicate
1853
+
1854
+ `EntryCallback`\<`VertexKey`, `V` \| `undefined`, `boolean`\>
1855
+
1856
+ `(key, value, index, self) => boolean`.
1857
+
1858
+ ##### thisArg?
1859
+
1860
+ `any`
1861
+
1862
+ Optional `this` for callback.
1863
+
1864
+ #### Returns
1865
+
1866
+ `boolean`
1867
+
1868
+ `true` if any passes; otherwise `false`.
1869
+
1870
+ #### Remarks
1871
+
1872
+ Time O(n), Space O(1)
1873
+
1874
+ #### Inherited from
1875
+
1876
+ [`IterableEntryBase`](IterableEntryBase.md).[`some`](IterableEntryBase.md#some)
1877
+
1878
+ ***
1879
+
1880
+ ### toArray()
1881
+
1882
+ ```ts
1883
+ toArray(): [VertexKey, V | undefined][];
1884
+ ```
1885
+
1886
+ Defined in: [data-structures/base/iterable-entry-base.ts:186](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L186)
1887
+
1888
+ Converts data structure to `[key, value]` pairs.
1889
+
1890
+ #### Returns
1891
+
1892
+ \[`VertexKey`, `V` \| `undefined`\][]
1893
+
1894
+ Array of entries.
1895
+
1896
+ #### Remarks
1897
+
1898
+ Time O(n), Space O(n)
1899
+
1900
+ #### Inherited from
1901
+
1902
+ [`IterableEntryBase`](IterableEntryBase.md).[`toArray`](IterableEntryBase.md#toarray)
1903
+
1904
+ ***
1905
+
1906
+ ### toDot()
1907
+
1908
+ ```ts
1909
+ toDot(options?): string;
1910
+ ```
1911
+
1912
+ Defined in: [data-structures/graph/abstract-graph.ts:1143](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1143)
1913
+
1914
+ Generate DOT language representation for Graphviz.
1915
+
1916
+ #### Parameters
1917
+
1918
+ ##### options?
1919
+
1920
+ Optional display settings.
1921
+
1922
+ ###### name?
1923
+
1924
+ `string`
1925
+
1926
+ Graph name (default: 'G').
1927
+
1928
+ ###### showWeight?
1929
+
1930
+ `boolean`
1931
+
1932
+ Whether to label edges with weight (default: true).
1933
+
1934
+ #### Returns
1935
+
1936
+ `string`
1937
+
1938
+ DOT format string.
1939
+
1940
+ ***
1941
+
1942
+ ### toVisual()
1943
+
1944
+ ```ts
1945
+ toVisual(options?): string;
1946
+ ```
1947
+
1948
+ Defined in: [data-structures/graph/abstract-graph.ts:1108](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1108)
1949
+
1950
+ Generate a text-based visual representation of the graph.
1951
+
1952
+ **Adjacency list format:**
1953
+ ```
1954
+ Graph (5 vertices, 6 edges):
1955
+ A -> B (1), C (2)
1956
+ B -> D (3)
1957
+ C -> (no outgoing edges)
1958
+ D -> A (1)
1959
+ E (isolated)
1960
+ ```
1961
+
1962
+ #### Parameters
1963
+
1964
+ ##### options?
1965
+
1966
+ Optional display settings.
1967
+
1968
+ ###### showWeight?
1969
+
1970
+ `boolean`
1971
+
1972
+ Whether to show edge weights (default: true).
1973
+
1974
+ #### Returns
1975
+
1976
+ `string`
1977
+
1978
+ The visual string.
1979
+
1980
+ #### Overrides
1981
+
1982
+ [`IterableEntryBase`](IterableEntryBase.md).[`toVisual`](IterableEntryBase.md#tovisual)
1983
+
1984
+ ***
1985
+
1986
+ ### values()
1987
+
1988
+ ```ts
1989
+ values(): IterableIterator<V | undefined>;
1990
+ ```
1991
+
1992
+ Defined in: [data-structures/base/iterable-entry-base.ts:53](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/base/iterable-entry-base.ts#L53)
1993
+
1994
+ Iterate over values only.
1995
+
1996
+ #### Returns
1997
+
1998
+ `IterableIterator`\<`V` \| `undefined`\>
1999
+
2000
+ Iterator of values.
2001
+
2002
+ #### Remarks
2003
+
2004
+ Time O(n), Space O(1)
2005
+
2006
+ #### Inherited from
2007
+
2008
+ [`IterableEntryBase`](IterableEntryBase.md).[`values`](IterableEntryBase.md#values)
2009
+
2010
+
2011
+ ---
2012
+
2013
+ ## Protected Members
2014
+
2015
+ ### \_edgeConnector
2016
+
2017
+ #### Get Signature
2018
+
2019
+ ```ts
2020
+ get protected _edgeConnector(): string;
2021
+ ```
2022
+
2023
+ Defined in: [data-structures/graph/abstract-graph.ts:1087](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1087)
2024
+
2025
+ The edge connector string used in visual output.
2026
+ Override in subclasses (e.g., '--' for undirected, '->' for directed).
2027
+
2028
+ ##### Returns
2029
+
2030
+ `string`
2031
+
2032
+ ***
2033
+
2034
+ ### \_addEdge()
2035
+
2036
+ ```ts
2037
+ abstract protected _addEdge(edge): boolean;
2038
+ ```
2039
+
2040
+ Defined in: [data-structures/graph/abstract-graph.ts:1046](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1046)
2041
+
2042
+ Internal hook to attach an edge into adjacency structures.
2043
+
2044
+ #### Parameters
2045
+
2046
+ ##### edge
2047
+
2048
+ `EO`
2049
+
2050
+ Edge instance.
2051
+
2052
+ #### Returns
2053
+
2054
+ `boolean`
2055
+
2056
+ `true` if inserted; otherwise `false`.
2057
+
2058
+ #### Remarks
2059
+
2060
+ Time O(1) avg, Space O(1)
2061
+
2062
+ ***
2063
+
2064
+ ### \_addVertex()
2065
+
2066
+ ```ts
2067
+ protected _addVertex(newVertex): boolean;
2068
+ ```
2069
+
2070
+ Defined in: [data-structures/graph/abstract-graph.ts:1054](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1054)
2071
+
2072
+ Insert a pre-built vertex into the graph.
2073
+
2074
+ #### Parameters
2075
+
2076
+ ##### newVertex
2077
+
2078
+ `VO`
2079
+
2080
+ Concrete vertex instance.
2081
+
2082
+ #### Returns
2083
+
2084
+ `boolean`
2085
+
2086
+ `true` if inserted; `false` if key already exists.
2087
+
2088
+ #### Remarks
2089
+
2090
+ Time O(1) avg, Space O(1)
2091
+
2092
+ ***
2093
+
2094
+ ### \_createInstance()
2095
+
2096
+ ```ts
2097
+ protected _createInstance(_options?): this;
2098
+ ```
2099
+
2100
+ Defined in: [data-structures/graph/abstract-graph.ts:987](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L987)
2101
+
2102
+ Create an empty graph instance of the same concrete species.
2103
+
2104
+ #### Parameters
2105
+
2106
+ ##### \_options?
2107
+
2108
+ `Partial`\<`Record`\<`string`, `unknown`\>\>
2109
+
2110
+ Snapshot options from `_snapshotOptions()`.
2111
+
2112
+ #### Returns
2113
+
2114
+ `this`
2115
+
2116
+ A new empty graph instance of `this` type.
2117
+
2118
+ #### Remarks
2119
+
2120
+ Time O(1), Space O(1)
2121
+
2122
+ ***
2123
+
2124
+ ### \_createLike()
2125
+
2126
+ ```ts
2127
+ protected _createLike(iter?, options?): this;
2128
+ ```
2129
+
2130
+ Defined in: [data-structures/graph/abstract-graph.ts:1009](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1009)
2131
+
2132
+ Create a same-species graph populated with entries; preserves edges among kept vertices.
2133
+
2134
+ #### Parameters
2135
+
2136
+ ##### iter?
2137
+
2138
+ `Iterable`\<\[`VertexKey`, `V` \| `undefined`\], `any`, `any`\>
2139
+
2140
+ Optional entries to seed the new graph.
2141
+
2142
+ ##### options?
2143
+
2144
+ `Partial`\<`Record`\<`string`, `unknown`\>\>
2145
+
2146
+ Snapshot options.
2147
+
2148
+ #### Returns
2149
+
2150
+ `this`
2151
+
2152
+ A new graph of `this` type.
2153
+
2154
+ #### Remarks
2155
+
2156
+ Time O(V + E), Space O(V + E)
2157
+
2158
+ ***
2159
+
2160
+ ### \_getIterator()
2161
+
2162
+ ```ts
2163
+ protected _getIterator(): IterableIterator<[VertexKey, V | undefined]>;
2164
+ ```
2165
+
2166
+ Defined in: [data-structures/graph/abstract-graph.ts:958](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L958)
2167
+
2168
+ Internal iterator over `[key, value]` entries in insertion order.
2169
+
2170
+ #### Returns
2171
+
2172
+ `IterableIterator`\<\[`VertexKey`, `V` \| `undefined`\]\>
2173
+
2174
+ Iterator of `[VertexKey, V | undefined]`.
2175
+
2176
+ #### Remarks
2177
+
2178
+ Time O(V), Space O(1)
2179
+
2180
+ #### Overrides
2181
+
2182
+ [`IterableEntryBase`](IterableEntryBase.md).[`_getIterator`](IterableEntryBase.md#_getiterator)
2183
+
2184
+ ***
2185
+
2186
+ ### \_getVertex()
2187
+
2188
+ ```ts
2189
+ protected _getVertex(vertexOrKey): VO | undefined;
2190
+ ```
2191
+
2192
+ Defined in: [data-structures/graph/abstract-graph.ts:1068](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1068)
2193
+
2194
+ Resolve a vertex key or instance to the concrete vertex instance.
2195
+
2196
+ #### Parameters
2197
+
2198
+ ##### vertexOrKey
2199
+
2200
+ `VertexKey` \| `VO`
2201
+
2202
+ Vertex key or existing vertex.
2203
+
2204
+ #### Returns
2205
+
2206
+ `VO` \| `undefined`
2207
+
2208
+ Vertex instance or `undefined`.
2209
+
2210
+ #### Remarks
2211
+
2212
+ Time O(1), Space O(1)
2213
+
2214
+ ***
2215
+
2216
+ ### \_getVertexKey()
2217
+
2218
+ ```ts
2219
+ protected _getVertexKey(vertexOrKey): VertexKey;
2220
+ ```
2221
+
2222
+ Defined in: [data-structures/graph/abstract-graph.ts:1079](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L1079)
2223
+
2224
+ Resolve a vertex key from a key or vertex instance.
2225
+
2226
+ #### Parameters
2227
+
2228
+ ##### vertexOrKey
2229
+
2230
+ `VertexKey` \| `VO`
2231
+
2232
+ Vertex key or existing vertex.
2233
+
2234
+ #### Returns
2235
+
2236
+ `VertexKey`
2237
+
2238
+ The vertex key.
2239
+
2240
+ #### Remarks
2241
+
2242
+ Time O(1), Space O(1)
2243
+
2244
+ ***
2245
+
2246
+ ### \_snapshotOptions()
2247
+
2248
+ ```ts
2249
+ protected _snapshotOptions(): Record<string, unknown>;
2250
+ ```
2251
+
2252
+ Defined in: [data-structures/graph/abstract-graph.ts:973](https://github.com/zrwusa/data-structure-typed/blob/2f6ceb3aee852228efc88b111e19c0809753e805/src/data-structures/graph/abstract-graph.ts#L973)
2253
+
2254
+ Capture configuration needed to reproduce the current graph.
2255
+
2256
+ #### Returns
2257
+
2258
+ `Record`\<`string`, `unknown`\>
2259
+
2260
+ Options bag (opaque to callers).
2261
+
2262
+ #### Remarks
2263
+
2264
+ Time O(1), Space O(1)
2265
+
2266
+ ***