data-structure-typed 1.40.0-rc → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +7 -5
- package/.github/workflows/ci.yml +2 -20
- package/.travis.yml +3 -4
- package/CHANGELOG.md +23 -1
- package/CONTRIBUTING.md +13 -0
- package/README.md +20 -11
- package/dist/cjs/data-structures/binary-tree/avl-tree.d.ts +106 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree.js +348 -0
- package/dist/cjs/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.d.ts +149 -0
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js +270 -0
- package/dist/cjs/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/binary-tree.d.ts +363 -0
- package/dist/cjs/data-structures/binary-tree/binary-tree.js +1136 -0
- package/dist/cjs/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/bst.d.ts +167 -0
- package/dist/cjs/data-structures/binary-tree/bst.js +513 -0
- package/dist/cjs/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/index.d.ts +7 -0
- package/dist/cjs/data-structures/binary-tree/index.js +24 -0
- package/dist/cjs/data-structures/binary-tree/index.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/rb-tree.d.ts +97 -0
- package/dist/cjs/data-structures/binary-tree/rb-tree.js +389 -0
- package/dist/cjs/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/segment-tree.d.ts +67 -0
- package/dist/cjs/data-structures/binary-tree/segment-tree.js +181 -0
- package/dist/cjs/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/cjs/data-structures/binary-tree/tree-multiset.d.ts +126 -0
- package/dist/cjs/data-structures/binary-tree/tree-multiset.js +356 -0
- package/dist/cjs/data-structures/binary-tree/tree-multiset.js.map +1 -0
- package/dist/cjs/data-structures/graph/abstract-graph.d.ts +313 -0
- package/dist/cjs/data-structures/graph/abstract-graph.js +885 -0
- package/dist/cjs/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/directed-graph.d.ts +194 -0
- package/dist/cjs/data-structures/graph/directed-graph.js +405 -0
- package/dist/cjs/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/data-structures/graph/map-graph.d.ts +73 -0
- package/dist/cjs/data-structures/graph/map-graph.js +94 -0
- package/dist/cjs/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/data-structures/graph/undirected-graph.d.ts +120 -0
- package/dist/cjs/data-structures/graph/undirected-graph.js +240 -0
- package/dist/cjs/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/data-structures/hash/coordinate-map.d.ts +44 -0
- package/dist/cjs/data-structures/hash/coordinate-map.js +63 -0
- package/dist/cjs/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/coordinate-set.d.ts +36 -0
- package/dist/cjs/data-structures/hash/coordinate-set.js +53 -0
- package/dist/cjs/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/data-structures/hash/hash-map.d.ts +50 -0
- package/dist/cjs/data-structures/hash/hash-map.js +154 -0
- package/dist/cjs/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/hash-table.d.ts +103 -0
- package/dist/cjs/data-structures/hash/hash-table.js +237 -0
- package/dist/cjs/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/data-structures/hash/index.d.ts +6 -0
- package/dist/cjs/data-structures/hash/index.js +23 -0
- package/dist/cjs/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/data-structures/heap/heap.d.ts +235 -0
- package/dist/cjs/data-structures/heap/heap.js +516 -0
- package/dist/cjs/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/data-structures/heap/max-heap.d.ts +15 -0
- package/dist/cjs/data-structures/heap/max-heap.js +27 -0
- package/dist/cjs/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/data-structures/heap/min-heap.d.ts +15 -0
- package/dist/cjs/data-structures/heap/min-heap.js +27 -0
- package/dist/cjs/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/data-structures/index.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.d.ts +253 -0
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js +570 -0
- package/dist/cjs/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.d.ts +232 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js +534 -0
- package/dist/cjs/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/linked-list/skip-linked-list.d.ts +80 -0
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js +188 -0
- package/dist/cjs/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/data-structures/matrix/matrix.d.ts +21 -0
- package/dist/cjs/data-structures/matrix/matrix.js.map +1 -0
- package/dist/cjs/data-structures/matrix/matrix2d.d.ts +107 -0
- package/dist/cjs/data-structures/matrix/matrix2d.js +200 -0
- package/dist/cjs/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/data-structures/matrix/navigator.d.ts +52 -0
- package/dist/cjs/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/data-structures/matrix/vector2d.d.ts +200 -0
- package/dist/cjs/data-structures/matrix/vector2d.js +291 -0
- package/dist/cjs/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.d.ts +15 -0
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js +27 -0
- package/dist/cjs/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.d.ts +15 -0
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js +27 -0
- package/dist/cjs/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/priority-queue/priority-queue.d.ts +15 -0
- package/dist/cjs/data-structures/priority-queue/priority-queue.js +18 -0
- package/dist/cjs/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/data-structures/queue/deque.d.ts +161 -0
- package/dist/cjs/data-structures/queue/deque.js +265 -0
- package/dist/cjs/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/data-structures/queue/queue.d.ts +122 -0
- package/dist/cjs/data-structures/queue/queue.js +188 -0
- package/dist/cjs/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/data-structures/stack/stack.d.ts +64 -0
- package/dist/cjs/data-structures/stack/stack.js +95 -0
- package/dist/cjs/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/data-structures/tree/tree.d.ts +8 -0
- package/dist/cjs/data-structures/tree/tree.js +41 -0
- package/dist/cjs/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/data-structures/trie/trie.d.ts +79 -0
- package/dist/cjs/data-structures/trie/trie.js +252 -0
- package/dist/cjs/data-structures/trie/trie.js.map +1 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interfaces/binary-tree.d.ts +7 -0
- package/dist/cjs/interfaces/binary-tree.js.map +1 -0
- package/dist/cjs/interfaces/doubly-linked-list.js.map +1 -0
- package/dist/cjs/interfaces/graph.d.ts +5 -0
- package/dist/cjs/interfaces/graph.js +3 -0
- package/dist/cjs/interfaces/graph.js.map +1 -0
- package/dist/cjs/interfaces/heap.js.map +1 -0
- package/dist/cjs/interfaces/index.d.ts +8 -0
- package/dist/cjs/interfaces/index.js +25 -0
- package/dist/cjs/interfaces/index.js.map +1 -0
- package/dist/cjs/interfaces/navigator.js.map +1 -0
- package/dist/cjs/interfaces/priority-queue.js.map +1 -0
- package/dist/cjs/interfaces/segment-tree.js.map +1 -0
- package/dist/cjs/interfaces/singly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.d.ts +4 -0
- package/dist/cjs/types/data-structures/binary-tree/avl-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js +3 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-indexed-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js +25 -0
- package/dist/cjs/types/data-structures/binary-tree/binary-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/bst.d.ts +7 -0
- package/dist/cjs/types/data-structures/binary-tree/bst.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/index.d.ts +6 -0
- package/dist/cjs/types/data-structures/binary-tree/index.js +23 -0
- package/dist/cjs/types/data-structures/binary-tree/index.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.d.ts +4 -0
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.js +14 -0
- package/dist/cjs/types/data-structures/binary-tree/rb-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/segment-tree.js.map +1 -0
- package/dist/cjs/types/data-structures/binary-tree/tree-multiset.d.ts +4 -0
- package/dist/cjs/types/data-structures/binary-tree/tree-multiset.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/abstract-graph.d.ts +10 -0
- package/dist/cjs/types/data-structures/graph/abstract-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/directed-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/index.d.ts +3 -0
- package/dist/cjs/types/data-structures/graph/index.js +20 -0
- package/dist/cjs/types/data-structures/graph/index.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/map-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/graph/undirected-graph.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/coordinate-map.js +3 -0
- package/dist/cjs/types/data-structures/hash/coordinate-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/coordinate-set.js +3 -0
- package/dist/cjs/types/data-structures/hash/coordinate-set.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/hash-map.js +3 -0
- package/dist/cjs/types/data-structures/hash/hash-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/hash-table.js +3 -0
- package/dist/cjs/types/data-structures/hash/hash-table.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/index.js +3 -0
- package/dist/cjs/types/data-structures/hash/index.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/tree-map.js +3 -0
- package/dist/cjs/types/data-structures/hash/tree-map.js.map +1 -0
- package/dist/cjs/types/data-structures/hash/tree-set.js +3 -0
- package/dist/cjs/types/data-structures/hash/tree-set.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/heap.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/index.d.ts +1 -0
- package/dist/cjs/types/data-structures/heap/index.js +18 -0
- package/dist/cjs/types/data-structures/heap/index.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/max-heap.js +3 -0
- package/dist/cjs/types/data-structures/heap/max-heap.js.map +1 -0
- package/dist/cjs/types/data-structures/heap/min-heap.js +3 -0
- package/dist/cjs/types/data-structures/heap/min-heap.js.map +1 -0
- package/dist/cjs/types/data-structures/index.d.ts +11 -0
- package/dist/cjs/types/data-structures/index.js +28 -0
- package/dist/cjs/types/data-structures/index.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/doubly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/index.d.ts +2 -0
- package/dist/cjs/types/data-structures/linked-list/index.js +19 -0
- package/dist/cjs/types/data-structures/linked-list/index.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/singly-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js +3 -0
- package/dist/cjs/types/data-structures/linked-list/skip-linked-list.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/index.d.ts +1 -0
- package/dist/cjs/types/data-structures/matrix/index.js +18 -0
- package/dist/cjs/types/data-structures/matrix/index.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/matrix.js +3 -0
- package/dist/cjs/types/data-structures/matrix/matrix.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/matrix2d.js +3 -0
- package/dist/cjs/types/data-structures/matrix/matrix2d.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/navigator.js.map +1 -0
- package/dist/cjs/types/data-structures/matrix/vector2d.js +3 -0
- package/dist/cjs/types/data-structures/matrix/vector2d.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/index.js +20 -0
- package/dist/cjs/types/data-structures/priority-queue/index.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js +3 -0
- package/dist/cjs/types/data-structures/priority-queue/max-priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js +3 -0
- package/dist/cjs/types/data-structures/priority-queue/min-priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/priority-queue/priority-queue.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/deque.js +3 -0
- package/dist/cjs/types/data-structures/queue/deque.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/index.js +19 -0
- package/dist/cjs/types/data-structures/queue/index.js.map +1 -0
- package/dist/cjs/types/data-structures/queue/queue.js +3 -0
- package/dist/cjs/types/data-structures/queue/queue.js.map +1 -0
- package/dist/cjs/types/data-structures/stack/index.js +18 -0
- package/dist/cjs/types/data-structures/stack/index.js.map +1 -0
- package/dist/cjs/types/data-structures/stack/stack.js +3 -0
- package/dist/cjs/types/data-structures/stack/stack.js.map +1 -0
- package/dist/cjs/types/data-structures/tree/index.js +18 -0
- package/dist/cjs/types/data-structures/tree/index.js.map +1 -0
- package/dist/cjs/types/data-structures/tree/tree.js +3 -0
- package/dist/cjs/types/data-structures/tree/tree.js.map +1 -0
- package/dist/cjs/types/data-structures/trie/index.js +18 -0
- package/dist/cjs/types/data-structures/trie/index.js.map +1 -0
- package/dist/cjs/types/data-structures/trie/trie.js +3 -0
- package/dist/cjs/types/data-structures/trie/trie.js.map +1 -0
- package/dist/cjs/types/helpers.d.ts +8 -0
- package/dist/cjs/types/helpers.js +10 -0
- package/dist/cjs/types/helpers.js.map +1 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/utils/index.js.map +1 -0
- package/dist/cjs/types/utils/utils.js.map +1 -0
- package/dist/cjs/types/utils/validate-type.js.map +1 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/utils.d.ts +20 -0
- package/dist/cjs/utils/utils.js +74 -0
- package/dist/cjs/utils/utils.js.map +1 -0
- package/dist/mjs/data-structures/binary-tree/avl-tree.d.ts +106 -0
- package/dist/mjs/data-structures/binary-tree/avl-tree.js +348 -0
- package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.d.ts +149 -0
- package/dist/mjs/data-structures/binary-tree/binary-indexed-tree.js +274 -0
- package/dist/mjs/data-structures/binary-tree/binary-tree.d.ts +363 -0
- package/dist/mjs/data-structures/binary-tree/binary-tree.js +1147 -0
- package/dist/mjs/data-structures/binary-tree/bst.d.ts +167 -0
- package/dist/mjs/data-structures/binary-tree/bst.js +509 -0
- package/dist/mjs/data-structures/binary-tree/index.d.ts +7 -0
- package/dist/mjs/data-structures/binary-tree/index.js +23 -0
- package/dist/mjs/data-structures/binary-tree/rb-tree.d.ts +97 -0
- package/dist/mjs/data-structures/binary-tree/rb-tree.js +393 -0
- package/dist/mjs/data-structures/binary-tree/segment-tree.d.ts +67 -0
- package/dist/mjs/data-structures/binary-tree/segment-tree.js +182 -0
- package/dist/mjs/data-structures/binary-tree/tree-multiset.d.ts +126 -0
- package/dist/mjs/data-structures/binary-tree/tree-multiset.js +356 -0
- package/dist/mjs/data-structures/graph/abstract-graph.d.ts +313 -0
- package/dist/mjs/data-structures/graph/abstract-graph.js +883 -0
- package/dist/mjs/data-structures/graph/directed-graph.d.ts +194 -0
- package/dist/mjs/data-structures/graph/directed-graph.js +406 -0
- package/dist/mjs/data-structures/graph/index.js +20 -0
- package/dist/mjs/data-structures/graph/map-graph.d.ts +73 -0
- package/dist/mjs/data-structures/graph/map-graph.js +96 -0
- package/dist/mjs/data-structures/graph/undirected-graph.d.ts +120 -0
- package/dist/mjs/data-structures/graph/undirected-graph.js +239 -0
- package/dist/mjs/data-structures/hash/coordinate-map.d.ts +44 -0
- package/dist/mjs/data-structures/hash/coordinate-map.js +62 -0
- package/dist/mjs/data-structures/hash/coordinate-set.d.ts +36 -0
- package/dist/mjs/data-structures/hash/coordinate-set.js +52 -0
- package/dist/mjs/data-structures/hash/hash-map.d.ts +50 -0
- package/dist/mjs/data-structures/hash/hash-map.js +159 -0
- package/dist/mjs/data-structures/hash/hash-table.d.ts +103 -0
- package/dist/mjs/data-structures/hash/hash-table.js +243 -0
- package/dist/mjs/data-structures/hash/index.d.ts +6 -0
- package/dist/mjs/data-structures/hash/index.js +22 -0
- package/dist/mjs/data-structures/hash/tree-map.js +6 -0
- package/dist/mjs/data-structures/hash/tree-set.js +6 -0
- package/dist/mjs/data-structures/heap/heap.d.ts +235 -0
- package/dist/mjs/data-structures/heap/heap.js +525 -0
- package/dist/mjs/data-structures/heap/index.js +19 -0
- package/dist/mjs/data-structures/heap/max-heap.d.ts +15 -0
- package/dist/mjs/data-structures/heap/max-heap.js +26 -0
- package/dist/mjs/data-structures/heap/min-heap.d.ts +15 -0
- package/dist/mjs/data-structures/heap/min-heap.js +26 -0
- package/dist/mjs/data-structures/index.js +27 -0
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.d.ts +253 -0
- package/dist/mjs/data-structures/linked-list/doubly-linked-list.js +573 -0
- package/dist/mjs/data-structures/linked-list/index.js +19 -0
- package/dist/mjs/data-structures/linked-list/singly-linked-list.d.ts +232 -0
- package/dist/mjs/data-structures/linked-list/singly-linked-list.js +538 -0
- package/dist/mjs/data-structures/linked-list/skip-linked-list.d.ts +80 -0
- package/dist/mjs/data-structures/linked-list/skip-linked-list.js +194 -0
- package/dist/mjs/data-structures/matrix/index.js +20 -0
- package/dist/mjs/data-structures/matrix/matrix.d.ts +21 -0
- package/dist/mjs/data-structures/matrix/matrix.js +29 -0
- package/dist/mjs/data-structures/matrix/matrix2d.d.ts +107 -0
- package/dist/mjs/data-structures/matrix/matrix2d.js +200 -0
- package/dist/mjs/data-structures/matrix/navigator.d.ts +52 -0
- package/dist/mjs/data-structures/matrix/navigator.js +113 -0
- package/dist/mjs/data-structures/matrix/vector2d.d.ts +200 -0
- package/dist/mjs/data-structures/matrix/vector2d.js +293 -0
- package/dist/mjs/data-structures/priority-queue/index.js +19 -0
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.d.ts +15 -0
- package/dist/mjs/data-structures/priority-queue/max-priority-queue.js +26 -0
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.d.ts +15 -0
- package/dist/mjs/data-structures/priority-queue/min-priority-queue.js +26 -0
- package/dist/mjs/data-structures/priority-queue/priority-queue.d.ts +15 -0
- package/dist/mjs/data-structures/priority-queue/priority-queue.js +17 -0
- package/dist/mjs/data-structures/queue/deque.d.ts +161 -0
- package/dist/mjs/data-structures/queue/deque.js +257 -0
- package/dist/mjs/data-structures/queue/index.js +18 -0
- package/dist/mjs/data-structures/queue/queue.d.ts +122 -0
- package/dist/mjs/data-structures/queue/queue.js +188 -0
- package/dist/mjs/data-structures/stack/index.js +17 -0
- package/dist/mjs/data-structures/stack/stack.d.ts +64 -0
- package/dist/mjs/data-structures/stack/stack.js +95 -0
- package/dist/mjs/data-structures/tree/index.js +17 -0
- package/dist/mjs/data-structures/tree/tree.d.ts +8 -0
- package/dist/mjs/data-structures/tree/tree.js +43 -0
- package/dist/mjs/data-structures/trie/index.js +17 -0
- package/dist/mjs/data-structures/trie/trie.d.ts +79 -0
- package/dist/mjs/data-structures/trie/trie.js +256 -0
- package/dist/mjs/index.js +20 -0
- package/dist/mjs/interfaces/binary-tree.d.ts +7 -0
- package/dist/mjs/interfaces/binary-tree.js +2 -0
- package/dist/mjs/interfaces/doubly-linked-list.js +2 -0
- package/dist/mjs/interfaces/graph.d.ts +5 -0
- package/dist/mjs/interfaces/graph.js +2 -0
- package/dist/mjs/interfaces/heap.js +2 -0
- package/dist/mjs/interfaces/index.d.ts +8 -0
- package/dist/mjs/interfaces/index.js +24 -0
- package/dist/mjs/interfaces/navigator.js +2 -0
- package/dist/mjs/interfaces/priority-queue.js +2 -0
- package/dist/mjs/interfaces/segment-tree.js +2 -0
- package/dist/mjs/interfaces/singly-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/avl-tree.d.ts +4 -0
- package/dist/mjs/types/data-structures/binary-tree/avl-tree.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-indexed-tree.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.d.ts +29 -0
- package/dist/mjs/types/data-structures/binary-tree/binary-tree.js +24 -0
- package/dist/mjs/types/data-structures/binary-tree/bst.d.ts +7 -0
- package/dist/mjs/types/data-structures/binary-tree/bst.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/index.d.ts +6 -0
- package/dist/mjs/types/data-structures/binary-tree/index.js +22 -0
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.d.ts +4 -0
- package/dist/mjs/types/data-structures/binary-tree/rb-tree.js +13 -0
- package/dist/mjs/types/data-structures/binary-tree/segment-tree.js +2 -0
- package/dist/mjs/types/data-structures/binary-tree/tree-multiset.d.ts +4 -0
- package/dist/mjs/types/data-structures/binary-tree/tree-multiset.js +2 -0
- package/dist/mjs/types/data-structures/graph/abstract-graph.d.ts +10 -0
- package/dist/mjs/types/data-structures/graph/abstract-graph.js +2 -0
- package/dist/mjs/types/data-structures/graph/directed-graph.js +9 -0
- package/dist/mjs/types/data-structures/graph/index.d.ts +3 -0
- package/dist/mjs/types/data-structures/graph/index.js +19 -0
- package/dist/mjs/types/data-structures/graph/map-graph.js +2 -0
- package/dist/mjs/types/data-structures/graph/undirected-graph.js +2 -0
- package/dist/mjs/types/data-structures/hash/coordinate-map.js +2 -0
- package/dist/mjs/types/data-structures/hash/coordinate-set.js +2 -0
- package/dist/mjs/types/data-structures/hash/hash-map.js +2 -0
- package/dist/mjs/types/data-structures/hash/hash-table.js +2 -0
- package/dist/mjs/types/data-structures/hash/index.js +2 -0
- package/dist/mjs/types/data-structures/hash/tree-map.js +2 -0
- package/dist/mjs/types/data-structures/hash/tree-set.js +2 -0
- package/dist/mjs/types/data-structures/heap/heap.js +2 -0
- package/dist/mjs/types/data-structures/heap/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/heap/index.js +17 -0
- package/dist/mjs/types/data-structures/heap/max-heap.js +2 -0
- package/dist/mjs/types/data-structures/heap/min-heap.js +2 -0
- package/dist/mjs/types/data-structures/index.d.ts +11 -0
- package/dist/mjs/types/data-structures/index.js +27 -0
- package/dist/mjs/types/data-structures/linked-list/doubly-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/linked-list/index.d.ts +2 -0
- package/dist/mjs/types/data-structures/linked-list/index.js +18 -0
- package/dist/mjs/types/data-structures/linked-list/singly-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/linked-list/skip-linked-list.d.ts +1 -0
- package/dist/mjs/types/data-structures/linked-list/skip-linked-list.js +2 -0
- package/dist/mjs/types/data-structures/matrix/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/index.js +17 -0
- package/dist/mjs/types/data-structures/matrix/matrix.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/matrix.js +2 -0
- package/dist/mjs/types/data-structures/matrix/matrix2d.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/matrix2d.js +2 -0
- package/dist/mjs/types/data-structures/matrix/navigator.js +2 -0
- package/dist/mjs/types/data-structures/matrix/vector2d.d.ts +1 -0
- package/dist/mjs/types/data-structures/matrix/vector2d.js +2 -0
- package/dist/mjs/types/data-structures/priority-queue/index.d.ts +3 -0
- package/dist/mjs/types/data-structures/priority-queue/index.js +19 -0
- package/dist/mjs/types/data-structures/priority-queue/max-priority-queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/priority-queue/max-priority-queue.js +2 -0
- package/dist/mjs/types/data-structures/priority-queue/min-priority-queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/priority-queue/min-priority-queue.js +2 -0
- package/dist/mjs/types/data-structures/priority-queue/priority-queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/priority-queue/priority-queue.js +2 -0
- package/dist/mjs/types/data-structures/queue/deque.d.ts +1 -0
- package/dist/mjs/types/data-structures/queue/deque.js +2 -0
- package/dist/mjs/types/data-structures/queue/index.d.ts +2 -0
- package/dist/mjs/types/data-structures/queue/index.js +18 -0
- package/dist/mjs/types/data-structures/queue/queue.d.ts +1 -0
- package/dist/mjs/types/data-structures/queue/queue.js +2 -0
- package/dist/mjs/types/data-structures/stack/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/stack/index.js +17 -0
- package/dist/mjs/types/data-structures/stack/stack.d.ts +1 -0
- package/dist/mjs/types/data-structures/stack/stack.js +2 -0
- package/dist/mjs/types/data-structures/tree/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/tree/index.js +17 -0
- package/dist/mjs/types/data-structures/tree/tree.d.ts +1 -0
- package/dist/mjs/types/data-structures/tree/tree.js +2 -0
- package/dist/mjs/types/data-structures/trie/index.d.ts +1 -0
- package/dist/mjs/types/data-structures/trie/index.js +17 -0
- package/dist/mjs/types/data-structures/trie/trie.d.ts +1 -0
- package/dist/mjs/types/data-structures/trie/trie.js +2 -0
- package/dist/mjs/types/helpers.d.ts +8 -0
- package/dist/mjs/types/helpers.js +9 -0
- package/dist/mjs/types/index.js +19 -0
- package/dist/mjs/types/utils/index.js +18 -0
- package/dist/mjs/types/utils/utils.js +2 -0
- package/dist/mjs/types/utils/validate-type.js +2 -0
- package/dist/mjs/utils/index.js +17 -0
- package/dist/mjs/utils/utils.d.ts +20 -0
- package/dist/mjs/utils/utils.js +64 -0
- package/dist/umd/data-structure-typed.min.js +27 -0
- package/dist/umd/data-structure-typed.min.js.map +1 -0
- package/package.json +28 -22
- package/src/data-structures/binary-tree/avl-tree.ts +88 -74
- package/src/data-structures/binary-tree/binary-indexed-tree.ts +265 -35
- package/src/data-structures/binary-tree/binary-tree.ts +1263 -26
- package/src/data-structures/binary-tree/bst.ts +217 -237
- package/src/data-structures/binary-tree/index.ts +0 -5
- package/src/data-structures/binary-tree/rb-tree.ts +416 -356
- package/src/data-structures/binary-tree/segment-tree.ts +25 -92
- package/src/data-structures/binary-tree/tree-multiset.ts +113 -422
- package/src/data-structures/graph/abstract-graph.ts +169 -214
- package/src/data-structures/graph/directed-graph.ts +105 -126
- package/src/data-structures/graph/map-graph.ts +29 -57
- package/src/data-structures/graph/undirected-graph.ts +67 -82
- package/src/data-structures/hash/coordinate-map.ts +0 -4
- package/src/data-structures/hash/coordinate-set.ts +0 -4
- package/src/data-structures/hash/hash-map.ts +65 -83
- package/src/data-structures/hash/hash-table.ts +109 -118
- package/src/data-structures/hash/index.ts +0 -1
- package/src/data-structures/hash/tree-map.ts +2 -1
- package/src/data-structures/hash/tree-set.ts +2 -1
- package/src/data-structures/heap/heap.ts +505 -128
- package/src/data-structures/heap/max-heap.ts +16 -21
- package/src/data-structures/heap/min-heap.ts +16 -22
- package/src/data-structures/linked-list/doubly-linked-list.ts +143 -174
- package/src/data-structures/linked-list/singly-linked-list.ts +174 -99
- package/src/data-structures/linked-list/skip-linked-list.ts +104 -49
- package/src/data-structures/matrix/matrix.ts +2 -2
- package/src/data-structures/matrix/matrix2d.ts +12 -14
- package/src/data-structures/matrix/navigator.ts +4 -4
- package/src/data-structures/matrix/vector2d.ts +2 -3
- package/src/data-structures/priority-queue/max-priority-queue.ts +15 -46
- package/src/data-structures/priority-queue/min-priority-queue.ts +15 -47
- package/src/data-structures/priority-queue/priority-queue.ts +7 -350
- package/src/data-structures/queue/deque.ts +62 -77
- package/src/data-structures/queue/queue.ts +39 -21
- package/src/data-structures/stack/stack.ts +13 -9
- package/src/data-structures/tree/tree.ts +10 -38
- package/src/data-structures/trie/trie.ts +108 -71
- package/src/interfaces/binary-tree.ts +7 -4
- package/src/interfaces/graph.ts +7 -0
- package/src/interfaces/index.ts +1 -8
- package/src/types/data-structures/binary-tree/avl-tree.ts +5 -0
- package/src/types/data-structures/binary-tree/binary-indexed-tree.ts +1 -0
- package/src/types/data-structures/binary-tree/binary-tree.ts +31 -0
- package/src/types/data-structures/binary-tree/bst.ts +11 -0
- package/src/types/data-structures/binary-tree/index.ts +6 -0
- package/src/types/data-structures/binary-tree/rb-tree.ts +8 -0
- package/src/types/data-structures/binary-tree/tree-multiset.ts +6 -0
- package/src/types/data-structures/graph/abstract-graph.ts +11 -0
- package/src/types/data-structures/graph/index.ts +3 -0
- package/src/types/data-structures/graph/undirected-graph.ts +1 -0
- package/src/types/data-structures/hash/coordinate-map.ts +1 -0
- package/src/types/data-structures/hash/coordinate-set.ts +1 -0
- package/src/types/data-structures/hash/hash-map.ts +1 -0
- package/src/types/data-structures/hash/hash-table.ts +1 -0
- package/src/types/data-structures/hash/tree-map.ts +1 -0
- package/src/types/data-structures/hash/tree-set.ts +1 -0
- package/src/types/data-structures/heap/heap.ts +1 -0
- package/src/types/data-structures/heap/index.ts +1 -0
- package/src/types/data-structures/heap/max-heap.ts +1 -0
- package/src/types/data-structures/heap/min-heap.ts +1 -0
- package/src/types/data-structures/index.ts +8 -13
- package/src/types/data-structures/linked-list/doubly-linked-list.ts +1 -0
- package/src/types/data-structures/linked-list/index.ts +2 -0
- package/src/types/data-structures/linked-list/singly-linked-list.ts +1 -0
- package/src/types/data-structures/linked-list/skip-linked-list.ts +1 -0
- package/src/types/data-structures/matrix/index.ts +1 -0
- package/src/types/data-structures/matrix/matrix.ts +1 -0
- package/src/types/data-structures/matrix/matrix2d.ts +1 -0
- package/src/types/data-structures/matrix/navigator.ts +14 -0
- package/src/types/data-structures/matrix/vector2d.ts +1 -0
- package/src/types/data-structures/priority-queue/index.ts +3 -0
- package/src/types/data-structures/priority-queue/max-priority-queue.ts +1 -0
- package/src/types/data-structures/priority-queue/min-priority-queue.ts +1 -0
- package/src/types/data-structures/priority-queue/priority-queue.ts +1 -0
- package/src/types/data-structures/queue/deque.ts +1 -0
- package/src/types/data-structures/queue/index.ts +2 -0
- package/src/types/data-structures/queue/queue.ts +1 -0
- package/src/types/data-structures/stack/index.ts +1 -0
- package/src/types/data-structures/stack/stack.ts +1 -0
- package/src/types/data-structures/tree/index.ts +1 -0
- package/src/types/data-structures/tree/tree.ts +1 -0
- package/src/types/data-structures/trie/index.ts +1 -0
- package/src/types/data-structures/trie/trie.ts +1 -0
- package/src/types/helpers.ts +11 -1
- package/src/types/utils/utils.ts +1 -1
- package/src/types/utils/validate-type.ts +2 -2
- package/src/utils/utils.ts +7 -0
- package/test/config.js +4 -0
- package/test/config.ts +1 -0
- package/test/integration/avl-tree.test.ts +24 -22
- package/test/integration/bst.test.ts +52 -47
- package/test/integration/index.html +3 -4
- package/test/types/index.js +29 -0
- package/test/types/utils/big-o.js +2 -0
- package/test/types/utils/big-o.ts +1 -0
- package/test/types/utils/index.js +29 -0
- package/test/types/utils/index.ts +1 -0
- package/test/unit/data-structures/binary-tree/avl-tree.test.ts +184 -23
- package/test/unit/data-structures/binary-tree/binary-index-tree.test.ts +320 -0
- package/test/unit/data-structures/binary-tree/binary-tree.test.ts +393 -40
- package/test/unit/data-structures/binary-tree/bst.test.ts +506 -48
- package/test/unit/data-structures/binary-tree/overall.test.ts +8 -7
- package/test/unit/data-structures/binary-tree/rb-tree.test.ts +240 -41
- package/test/unit/data-structures/binary-tree/tree-multiset.test.ts +296 -215
- package/test/unit/data-structures/graph/abstract-graph.test.ts +97 -2
- package/test/unit/data-structures/graph/directed-graph.test.ts +76 -31
- package/test/unit/data-structures/graph/map-graph.test.ts +93 -12
- package/test/unit/data-structures/graph/overall.test.ts +2 -2
- package/test/unit/data-structures/graph/undirected-graph.test.ts +93 -3
- package/test/unit/data-structures/hash/coordinate-map.test.ts +20 -0
- package/test/unit/data-structures/hash/coordinate-set.test.ts +25 -0
- package/test/unit/data-structures/hash/hash-map.test.ts +2 -3
- package/test/unit/data-structures/hash/hash-table.test.ts +10 -8
- package/test/unit/data-structures/heap/heap.test.ts +218 -20
- package/test/unit/data-structures/heap/max-heap.test.ts +50 -42
- package/test/unit/data-structures/heap/min-heap.test.ts +38 -68
- package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +86 -27
- package/test/unit/data-structures/linked-list/linked-list.test.ts +4 -4
- package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +71 -27
- package/test/unit/data-structures/linked-list/skip-list.test.ts +33 -2
- package/test/unit/data-structures/matrix/matrix2d.test.ts +207 -0
- package/test/unit/data-structures/matrix/navigator.test.ts +167 -2
- package/test/unit/data-structures/matrix/vector2d.test.ts +171 -0
- package/test/unit/data-structures/priority-queue/max-priority-queue.test.ts +10 -11
- package/test/unit/data-structures/priority-queue/min-priority-queue.test.ts +1 -1
- package/test/unit/data-structures/priority-queue/priority-queue.test.ts +14 -30
- package/test/unit/data-structures/queue/deque.test.ts +303 -23
- package/test/unit/data-structures/queue/queue.test.ts +52 -8
- package/test/unit/data-structures/tree/tree.test.ts +2 -2
- package/test/unit/data-structures/trie/trie.test.ts +743 -13
- package/test/utils/big-o.js +212 -0
- package/test/utils/big-o.ts +201 -0
- package/test/utils/index.js +30 -0
- package/test/utils/index.ts +1 -1
- package/test/utils/number.js +14 -0
- package/tsconfig-base.json +27 -0
- package/tsconfig-cjs.json +9 -0
- package/tsup.config.js +18 -0
- package/umd/bundle.min.js +1 -1
- package/umd/bundle.min.js.LICENSE.txt +15 -0
- package/umd/bundle.min.js.map +1 -1
- package/dist/data-structures/binary-tree/aa-tree.d.ts +0 -2
- package/dist/data-structures/binary-tree/aa-tree.js +0 -7
- package/dist/data-structures/binary-tree/aa-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/abstract-binary-tree.d.ts +0 -527
- package/dist/data-structures/binary-tree/abstract-binary-tree.js +0 -1199
- package/dist/data-structures/binary-tree/abstract-binary-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/avl-tree.d.ts +0 -94
- package/dist/data-structures/binary-tree/avl-tree.js +0 -336
- package/dist/data-structures/binary-tree/avl-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/b-tree.d.ts +0 -2
- package/dist/data-structures/binary-tree/b-tree.js +0 -7
- package/dist/data-structures/binary-tree/b-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -46
- package/dist/data-structures/binary-tree/binary-indexed-tree.js +0 -74
- package/dist/data-structures/binary-tree/binary-indexed-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/binary-tree.d.ts +0 -31
- package/dist/data-structures/binary-tree/binary-tree.js +0 -41
- package/dist/data-structures/binary-tree/binary-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/bst.d.ts +0 -133
- package/dist/data-structures/binary-tree/bst.js +0 -554
- package/dist/data-structures/binary-tree/bst.js.map +0 -1
- package/dist/data-structures/binary-tree/index.d.ts +0 -12
- package/dist/data-structures/binary-tree/index.js +0 -29
- package/dist/data-structures/binary-tree/index.js.map +0 -1
- package/dist/data-structures/binary-tree/rb-tree.d.ts +0 -13
- package/dist/data-structures/binary-tree/rb-tree.js +0 -28
- package/dist/data-structures/binary-tree/rb-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/segment-tree.d.ts +0 -83
- package/dist/data-structures/binary-tree/segment-tree.js +0 -229
- package/dist/data-structures/binary-tree/segment-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/splay-tree.d.ts +0 -2
- package/dist/data-structures/binary-tree/splay-tree.js +0 -7
- package/dist/data-structures/binary-tree/splay-tree.js.map +0 -1
- package/dist/data-structures/binary-tree/tree-multiset.d.ts +0 -209
- package/dist/data-structures/binary-tree/tree-multiset.js +0 -669
- package/dist/data-structures/binary-tree/tree-multiset.js.map +0 -1
- package/dist/data-structures/binary-tree/two-three-tree.d.ts +0 -2
- package/dist/data-structures/binary-tree/two-three-tree.js +0 -7
- package/dist/data-structures/binary-tree/two-three-tree.js.map +0 -1
- package/dist/data-structures/graph/abstract-graph.d.ts +0 -332
- package/dist/data-structures/graph/abstract-graph.js +0 -925
- package/dist/data-structures/graph/abstract-graph.js.map +0 -1
- package/dist/data-structures/graph/directed-graph.d.ts +0 -200
- package/dist/data-structures/graph/directed-graph.js +0 -423
- package/dist/data-structures/graph/directed-graph.js.map +0 -1
- package/dist/data-structures/graph/index.js.map +0 -1
- package/dist/data-structures/graph/map-graph.d.ts +0 -79
- package/dist/data-structures/graph/map-graph.js +0 -112
- package/dist/data-structures/graph/map-graph.js.map +0 -1
- package/dist/data-structures/graph/undirected-graph.d.ts +0 -127
- package/dist/data-structures/graph/undirected-graph.js +0 -253
- package/dist/data-structures/graph/undirected-graph.js.map +0 -1
- package/dist/data-structures/hash/coordinate-map.d.ts +0 -45
- package/dist/data-structures/hash/coordinate-map.js +0 -66
- package/dist/data-structures/hash/coordinate-map.js.map +0 -1
- package/dist/data-structures/hash/coordinate-set.d.ts +0 -37
- package/dist/data-structures/hash/coordinate-set.js +0 -56
- package/dist/data-structures/hash/coordinate-set.js.map +0 -1
- package/dist/data-structures/hash/hash-map.d.ts +0 -56
- package/dist/data-structures/hash/hash-map.js +0 -172
- package/dist/data-structures/hash/hash-map.js.map +0 -1
- package/dist/data-structures/hash/hash-table.d.ts +0 -106
- package/dist/data-structures/hash/hash-table.js +0 -246
- package/dist/data-structures/hash/hash-table.js.map +0 -1
- package/dist/data-structures/hash/index.d.ts +0 -7
- package/dist/data-structures/hash/index.js +0 -24
- package/dist/data-structures/hash/index.js.map +0 -1
- package/dist/data-structures/hash/pair.d.ts +0 -2
- package/dist/data-structures/hash/pair.js +0 -7
- package/dist/data-structures/hash/pair.js.map +0 -1
- package/dist/data-structures/hash/tree-map.js.map +0 -1
- package/dist/data-structures/hash/tree-set.js.map +0 -1
- package/dist/data-structures/heap/heap.d.ts +0 -83
- package/dist/data-structures/heap/heap.js +0 -158
- package/dist/data-structures/heap/heap.js.map +0 -1
- package/dist/data-structures/heap/index.js.map +0 -1
- package/dist/data-structures/heap/max-heap.d.ts +0 -23
- package/dist/data-structures/heap/max-heap.js +0 -31
- package/dist/data-structures/heap/max-heap.js.map +0 -1
- package/dist/data-structures/heap/min-heap.d.ts +0 -24
- package/dist/data-structures/heap/min-heap.js +0 -32
- package/dist/data-structures/heap/min-heap.js.map +0 -1
- package/dist/data-structures/index.js.map +0 -1
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +0 -234
- package/dist/data-structures/linked-list/doubly-linked-list.js +0 -584
- package/dist/data-structures/linked-list/doubly-linked-list.js.map +0 -1
- package/dist/data-structures/linked-list/index.js.map +0 -1
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +0 -157
- package/dist/data-structures/linked-list/singly-linked-list.js +0 -449
- package/dist/data-structures/linked-list/singly-linked-list.js.map +0 -1
- package/dist/data-structures/linked-list/skip-linked-list.d.ts +0 -61
- package/dist/data-structures/linked-list/skip-linked-list.js +0 -143
- package/dist/data-structures/linked-list/skip-linked-list.js.map +0 -1
- package/dist/data-structures/matrix/index.js.map +0 -1
- package/dist/data-structures/matrix/matrix.d.ts +0 -21
- package/dist/data-structures/matrix/matrix.js.map +0 -1
- package/dist/data-structures/matrix/matrix2d.d.ts +0 -108
- package/dist/data-structures/matrix/matrix2d.js +0 -201
- package/dist/data-structures/matrix/matrix2d.js.map +0 -1
- package/dist/data-structures/matrix/navigator.d.ts +0 -52
- package/dist/data-structures/matrix/navigator.js.map +0 -1
- package/dist/data-structures/matrix/vector2d.d.ts +0 -201
- package/dist/data-structures/matrix/vector2d.js +0 -292
- package/dist/data-structures/matrix/vector2d.js.map +0 -1
- package/dist/data-structures/priority-queue/index.js.map +0 -1
- package/dist/data-structures/priority-queue/max-priority-queue.d.ts +0 -15
- package/dist/data-structures/priority-queue/max-priority-queue.js +0 -44
- package/dist/data-structures/priority-queue/max-priority-queue.js.map +0 -1
- package/dist/data-structures/priority-queue/min-priority-queue.d.ts +0 -15
- package/dist/data-structures/priority-queue/min-priority-queue.js +0 -45
- package/dist/data-structures/priority-queue/min-priority-queue.js.map +0 -1
- package/dist/data-structures/priority-queue/priority-queue.d.ts +0 -180
- package/dist/data-structures/priority-queue/priority-queue.js +0 -322
- package/dist/data-structures/priority-queue/priority-queue.js.map +0 -1
- package/dist/data-structures/queue/deque.d.ts +0 -165
- package/dist/data-structures/queue/deque.js +0 -277
- package/dist/data-structures/queue/deque.js.map +0 -1
- package/dist/data-structures/queue/index.js.map +0 -1
- package/dist/data-structures/queue/queue.d.ts +0 -107
- package/dist/data-structures/queue/queue.js +0 -171
- package/dist/data-structures/queue/queue.js.map +0 -1
- package/dist/data-structures/stack/index.js.map +0 -1
- package/dist/data-structures/stack/stack.d.ts +0 -63
- package/dist/data-structures/stack/stack.js +0 -92
- package/dist/data-structures/stack/stack.js.map +0 -1
- package/dist/data-structures/tree/index.js.map +0 -1
- package/dist/data-structures/tree/tree.d.ts +0 -14
- package/dist/data-structures/tree/tree.js +0 -61
- package/dist/data-structures/tree/tree.js.map +0 -1
- package/dist/data-structures/trie/index.js.map +0 -1
- package/dist/data-structures/trie/trie.d.ts +0 -61
- package/dist/data-structures/trie/trie.js +0 -211
- package/dist/data-structures/trie/trie.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interfaces/abstract-binary-tree.d.ts +0 -7
- package/dist/interfaces/abstract-binary-tree.js +0 -3
- package/dist/interfaces/abstract-binary-tree.js.map +0 -1
- package/dist/interfaces/abstract-graph.d.ts +0 -5
- package/dist/interfaces/abstract-graph.js.map +0 -1
- package/dist/interfaces/avl-tree.d.ts +0 -7
- package/dist/interfaces/avl-tree.js.map +0 -1
- package/dist/interfaces/binary-tree.d.ts +0 -6
- package/dist/interfaces/binary-tree.js.map +0 -1
- package/dist/interfaces/bst.d.ts +0 -6
- package/dist/interfaces/bst.js.map +0 -1
- package/dist/interfaces/directed-graph.d.ts +0 -3
- package/dist/interfaces/directed-graph.js +0 -3
- package/dist/interfaces/directed-graph.js.map +0 -1
- package/dist/interfaces/doubly-linked-list.js.map +0 -1
- package/dist/interfaces/heap.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -15
- package/dist/interfaces/index.js +0 -32
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/navigator.js.map +0 -1
- package/dist/interfaces/priority-queue.js.map +0 -1
- package/dist/interfaces/rb-tree.d.ts +0 -6
- package/dist/interfaces/rb-tree.js +0 -3
- package/dist/interfaces/rb-tree.js.map +0 -1
- package/dist/interfaces/segment-tree.js.map +0 -1
- package/dist/interfaces/singly-linked-list.js.map +0 -1
- package/dist/interfaces/tree-multiset.d.ts +0 -6
- package/dist/interfaces/tree-multiset.js.map +0 -1
- package/dist/interfaces/undirected-graph.d.ts +0 -3
- package/dist/interfaces/undirected-graph.js.map +0 -1
- package/dist/types/data-structures/abstract-binary-tree.d.ts +0 -34
- package/dist/types/data-structures/abstract-binary-tree.js +0 -25
- package/dist/types/data-structures/abstract-binary-tree.js.map +0 -1
- package/dist/types/data-structures/abstract-graph.d.ts +0 -11
- package/dist/types/data-structures/abstract-graph.js +0 -3
- package/dist/types/data-structures/abstract-graph.js.map +0 -1
- package/dist/types/data-structures/avl-tree.d.ts +0 -4
- package/dist/types/data-structures/avl-tree.js +0 -3
- package/dist/types/data-structures/avl-tree.js.map +0 -1
- package/dist/types/data-structures/binary-tree.d.ts +0 -4
- package/dist/types/data-structures/binary-tree.js +0 -3
- package/dist/types/data-structures/binary-tree.js.map +0 -1
- package/dist/types/data-structures/bst.d.ts +0 -13
- package/dist/types/data-structures/bst.js +0 -10
- package/dist/types/data-structures/bst.js.map +0 -1
- package/dist/types/data-structures/directed-graph.js.map +0 -1
- package/dist/types/data-structures/doubly-linked-list.js.map +0 -1
- package/dist/types/data-structures/hash.js +0 -3
- package/dist/types/data-structures/hash.js.map +0 -1
- package/dist/types/data-structures/heap.d.ts +0 -3
- package/dist/types/data-structures/heap.js.map +0 -1
- package/dist/types/data-structures/index.d.ts +0 -16
- package/dist/types/data-structures/index.js +0 -33
- package/dist/types/data-structures/index.js.map +0 -1
- package/dist/types/data-structures/map-graph.js.map +0 -1
- package/dist/types/data-structures/navigator.js.map +0 -1
- package/dist/types/data-structures/priority-queue.d.ts +0 -7
- package/dist/types/data-structures/priority-queue.js.map +0 -1
- package/dist/types/data-structures/rb-tree.d.ts +0 -8
- package/dist/types/data-structures/rb-tree.js +0 -9
- package/dist/types/data-structures/rb-tree.js.map +0 -1
- package/dist/types/data-structures/segment-tree.js.map +0 -1
- package/dist/types/data-structures/singly-linked-list.js.map +0 -1
- package/dist/types/data-structures/tree-multiset.d.ts +0 -4
- package/dist/types/data-structures/tree-multiset.js +0 -3
- package/dist/types/data-structures/tree-multiset.js.map +0 -1
- package/dist/types/helpers.js +0 -3
- package/dist/types/helpers.js.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/utils/index.js.map +0 -1
- package/dist/types/utils/utils.js.map +0 -1
- package/dist/types/utils/validate-type.js.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -19
- package/dist/utils/utils.js +0 -67
- package/dist/utils/utils.js.map +0 -1
- package/lib/data-structures/binary-tree/aa-tree.d.ts +0 -2
- package/lib/data-structures/binary-tree/aa-tree.js +0 -2
- package/lib/data-structures/binary-tree/abstract-binary-tree.d.ts +0 -527
- package/lib/data-structures/binary-tree/abstract-binary-tree.js +0 -1193
- package/lib/data-structures/binary-tree/avl-tree.d.ts +0 -94
- package/lib/data-structures/binary-tree/avl-tree.js +0 -330
- package/lib/data-structures/binary-tree/b-tree.d.ts +0 -2
- package/lib/data-structures/binary-tree/b-tree.js +0 -2
- package/lib/data-structures/binary-tree/binary-indexed-tree.d.ts +0 -46
- package/lib/data-structures/binary-tree/binary-indexed-tree.js +0 -69
- package/lib/data-structures/binary-tree/binary-tree.d.ts +0 -31
- package/lib/data-structures/binary-tree/binary-tree.js +0 -35
- package/lib/data-structures/binary-tree/bst.d.ts +0 -133
- package/lib/data-structures/binary-tree/bst.js +0 -548
- package/lib/data-structures/binary-tree/index.d.ts +0 -12
- package/lib/data-structures/binary-tree/index.js +0 -12
- package/lib/data-structures/binary-tree/rb-tree.d.ts +0 -13
- package/lib/data-structures/binary-tree/rb-tree.js +0 -22
- package/lib/data-structures/binary-tree/segment-tree.d.ts +0 -83
- package/lib/data-structures/binary-tree/segment-tree.js +0 -223
- package/lib/data-structures/binary-tree/splay-tree.d.ts +0 -2
- package/lib/data-structures/binary-tree/splay-tree.js +0 -2
- package/lib/data-structures/binary-tree/tree-multiset.d.ts +0 -209
- package/lib/data-structures/binary-tree/tree-multiset.js +0 -663
- package/lib/data-structures/binary-tree/two-three-tree.d.ts +0 -2
- package/lib/data-structures/binary-tree/two-three-tree.js +0 -2
- package/lib/data-structures/graph/abstract-graph.d.ts +0 -332
- package/lib/data-structures/graph/abstract-graph.js +0 -918
- package/lib/data-structures/graph/directed-graph.d.ts +0 -200
- package/lib/data-structures/graph/directed-graph.js +0 -416
- package/lib/data-structures/graph/index.js +0 -4
- package/lib/data-structures/graph/map-graph.d.ts +0 -79
- package/lib/data-structures/graph/map-graph.js +0 -105
- package/lib/data-structures/graph/undirected-graph.d.ts +0 -127
- package/lib/data-structures/graph/undirected-graph.js +0 -246
- package/lib/data-structures/hash/coordinate-map.d.ts +0 -45
- package/lib/data-structures/hash/coordinate-map.js +0 -61
- package/lib/data-structures/hash/coordinate-set.d.ts +0 -37
- package/lib/data-structures/hash/coordinate-set.js +0 -51
- package/lib/data-structures/hash/hash-map.d.ts +0 -56
- package/lib/data-structures/hash/hash-map.js +0 -167
- package/lib/data-structures/hash/hash-table.d.ts +0 -106
- package/lib/data-structures/hash/hash-table.js +0 -240
- package/lib/data-structures/hash/index.d.ts +0 -7
- package/lib/data-structures/hash/index.js +0 -7
- package/lib/data-structures/hash/pair.d.ts +0 -2
- package/lib/data-structures/hash/pair.js +0 -2
- package/lib/data-structures/hash/tree-map.js +0 -2
- package/lib/data-structures/hash/tree-set.js +0 -2
- package/lib/data-structures/heap/heap.d.ts +0 -83
- package/lib/data-structures/heap/heap.js +0 -152
- package/lib/data-structures/heap/index.js +0 -3
- package/lib/data-structures/heap/max-heap.d.ts +0 -23
- package/lib/data-structures/heap/max-heap.js +0 -26
- package/lib/data-structures/heap/min-heap.d.ts +0 -24
- package/lib/data-structures/heap/min-heap.js +0 -27
- package/lib/data-structures/index.js +0 -11
- package/lib/data-structures/linked-list/doubly-linked-list.d.ts +0 -234
- package/lib/data-structures/linked-list/doubly-linked-list.js +0 -578
- package/lib/data-structures/linked-list/index.js +0 -3
- package/lib/data-structures/linked-list/singly-linked-list.d.ts +0 -157
- package/lib/data-structures/linked-list/singly-linked-list.js +0 -443
- package/lib/data-structures/linked-list/skip-linked-list.d.ts +0 -61
- package/lib/data-structures/linked-list/skip-linked-list.js +0 -137
- package/lib/data-structures/matrix/index.js +0 -4
- package/lib/data-structures/matrix/matrix.d.ts +0 -21
- package/lib/data-structures/matrix/matrix.js +0 -24
- package/lib/data-structures/matrix/matrix2d.d.ts +0 -108
- package/lib/data-structures/matrix/matrix2d.js +0 -196
- package/lib/data-structures/matrix/navigator.d.ts +0 -52
- package/lib/data-structures/matrix/navigator.js +0 -101
- package/lib/data-structures/matrix/vector2d.d.ts +0 -201
- package/lib/data-structures/matrix/vector2d.js +0 -287
- package/lib/data-structures/priority-queue/max-priority-queue.d.ts +0 -15
- package/lib/data-structures/priority-queue/max-priority-queue.js +0 -39
- package/lib/data-structures/priority-queue/min-priority-queue.d.ts +0 -15
- package/lib/data-structures/priority-queue/min-priority-queue.js +0 -40
- package/lib/data-structures/priority-queue/priority-queue.d.ts +0 -180
- package/lib/data-structures/priority-queue/priority-queue.js +0 -317
- package/lib/data-structures/queue/deque.d.ts +0 -165
- package/lib/data-structures/queue/deque.js +0 -270
- package/lib/data-structures/queue/queue.d.ts +0 -107
- package/lib/data-structures/queue/queue.js +0 -165
- package/lib/data-structures/stack/stack.d.ts +0 -63
- package/lib/data-structures/stack/stack.js +0 -87
- package/lib/data-structures/tree/tree.d.ts +0 -14
- package/lib/data-structures/tree/tree.js +0 -56
- package/lib/data-structures/trie/trie.d.ts +0 -61
- package/lib/data-structures/trie/trie.js +0 -205
- package/lib/index.js +0 -4
- package/lib/interfaces/abstract-binary-tree.d.ts +0 -7
- package/lib/interfaces/abstract-graph.d.ts +0 -5
- package/lib/interfaces/avl-tree.d.ts +0 -7
- package/lib/interfaces/binary-tree.d.ts +0 -6
- package/lib/interfaces/bst.d.ts +0 -6
- package/lib/interfaces/directed-graph.d.ts +0 -3
- package/lib/interfaces/index.d.ts +0 -15
- package/lib/interfaces/index.js +0 -15
- package/lib/interfaces/rb-tree.d.ts +0 -6
- package/lib/interfaces/tree-multiset.d.ts +0 -6
- package/lib/interfaces/undirected-graph.d.ts +0 -3
- package/lib/types/data-structures/abstract-binary-tree.d.ts +0 -34
- package/lib/types/data-structures/abstract-binary-tree.js +0 -21
- package/lib/types/data-structures/abstract-graph.d.ts +0 -11
- package/lib/types/data-structures/avl-tree.d.ts +0 -4
- package/lib/types/data-structures/binary-tree.d.ts +0 -4
- package/lib/types/data-structures/bst.d.ts +0 -13
- package/lib/types/data-structures/bst.js +0 -6
- package/lib/types/data-structures/directed-graph.js +0 -6
- package/lib/types/data-structures/heap.d.ts +0 -3
- package/lib/types/data-structures/index.d.ts +0 -16
- package/lib/types/data-structures/index.js +0 -16
- package/lib/types/data-structures/priority-queue.d.ts +0 -7
- package/lib/types/data-structures/rb-tree.d.ts +0 -8
- package/lib/types/data-structures/rb-tree.js +0 -5
- package/lib/types/data-structures/tree-multiset.d.ts +0 -4
- package/lib/types/index.js +0 -3
- package/lib/types/utils/index.js +0 -2
- package/lib/utils/utils.d.ts +0 -19
- package/lib/utils/utils.js +0 -57
- package/scripts/rename_clear_files.sh +0 -29
- package/src/data-structures/binary-tree/aa-tree.ts +0 -1
- package/src/data-structures/binary-tree/abstract-binary-tree.ts +0 -1556
- package/src/data-structures/binary-tree/b-tree.ts +0 -1
- package/src/data-structures/binary-tree/splay-tree.ts +0 -1
- package/src/data-structures/binary-tree/two-three-tree.ts +0 -1
- package/src/data-structures/hash/pair.ts +0 -1
- package/src/interfaces/abstract-binary-tree.ts +0 -8
- package/src/interfaces/abstract-graph.ts +0 -7
- package/src/interfaces/avl-tree.ts +0 -8
- package/src/interfaces/bst.ts +0 -6
- package/src/interfaces/directed-graph.ts +0 -3
- package/src/interfaces/rb-tree.ts +0 -6
- package/src/interfaces/tree-multiset.ts +0 -7
- package/src/interfaces/undirected-graph.ts +0 -3
- package/src/types/data-structures/abstract-binary-tree.ts +0 -49
- package/src/types/data-structures/abstract-graph.ts +0 -11
- package/src/types/data-structures/avl-tree.ts +0 -5
- package/src/types/data-structures/binary-tree.ts +0 -5
- package/src/types/data-structures/bst.ts +0 -13
- package/src/types/data-structures/heap.ts +0 -5
- package/src/types/data-structures/navigator.ts +0 -13
- package/src/types/data-structures/priority-queue.ts +0 -9
- package/src/types/data-structures/rb-tree.ts +0 -8
- package/src/types/data-structures/tree-multiset.ts +0 -6
- package/test/utils/magnitude.ts +0 -21
- /package/dist/{data-structures → cjs/data-structures}/graph/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/graph/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-map.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-map.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-set.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/hash/tree-set.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/heap/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/linked-list/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/matrix.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/matrix/navigator.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/priority-queue/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/queue/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/stack/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/stack/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/tree/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/tree/index.js +0 -0
- /package/dist/{data-structures → cjs/data-structures}/trie/index.d.ts +0 -0
- /package/dist/{data-structures → cjs/data-structures}/trie/index.js +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{index.js → cjs/index.js} +0 -0
- /package/dist/{interfaces → cjs/interfaces}/binary-tree.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/doubly-linked-list.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/doubly-linked-list.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/heap.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/heap.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/navigator.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/navigator.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/priority-queue.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/priority-queue.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/segment-tree.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/segment-tree.js +0 -0
- /package/dist/{interfaces → cjs/interfaces}/singly-linked-list.d.ts +0 -0
- /package/dist/{interfaces → cjs/interfaces}/singly-linked-list.js +0 -0
- /package/dist/{interfaces → cjs/types/data-structures/binary-tree}/avl-tree.js +0 -0
- /package/dist/{types/data-structures/doubly-linked-list.d.ts → cjs/types/data-structures/binary-tree/binary-indexed-tree.d.ts} +0 -0
- /package/dist/{interfaces → cjs/types/data-structures/binary-tree}/bst.js +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/binary-tree}/segment-tree.d.ts +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/binary-tree}/segment-tree.js +0 -0
- /package/dist/{interfaces → cjs/types/data-structures/binary-tree}/tree-multiset.js +0 -0
- /package/dist/{interfaces → cjs/types/data-structures/graph}/abstract-graph.js +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/graph}/directed-graph.d.ts +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/graph}/directed-graph.js +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/graph}/map-graph.d.ts +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/graph}/map-graph.js +0 -0
- /package/dist/{types/data-structures/singly-linked-list.d.ts → cjs/types/data-structures/graph/undirected-graph.d.ts} +0 -0
- /package/dist/{interfaces → cjs/types/data-structures/graph}/undirected-graph.js +0 -0
- /package/dist/{types/helpers.d.ts → cjs/types/data-structures/hash/coordinate-map.d.ts} +0 -0
- /package/{lib/interfaces/abstract-binary-tree.js → dist/cjs/types/data-structures/hash/coordinate-set.d.ts} +0 -0
- /package/{lib/interfaces/abstract-graph.js → dist/cjs/types/data-structures/hash/hash-map.d.ts} +0 -0
- /package/{lib/interfaces/avl-tree.js → dist/cjs/types/data-structures/hash/hash-table.d.ts} +0 -0
- /package/dist/{types/data-structures/hash.d.ts → cjs/types/data-structures/hash/index.d.ts} +0 -0
- /package/{lib/interfaces/binary-tree.js → dist/cjs/types/data-structures/hash/tree-map.d.ts} +0 -0
- /package/{lib/interfaces/bst.js → dist/cjs/types/data-structures/hash/tree-set.d.ts} +0 -0
- /package/{lib/interfaces → dist/cjs/types/data-structures/heap}/heap.d.ts +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/heap}/heap.js +0 -0
- /package/{lib/interfaces/directed-graph.js → dist/cjs/types/data-structures/heap/max-heap.d.ts} +0 -0
- /package/{lib/interfaces/doubly-linked-list.d.ts → dist/cjs/types/data-structures/heap/min-heap.d.ts} +0 -0
- /package/{lib/types/data-structures → dist/cjs/types/data-structures/linked-list}/doubly-linked-list.d.ts +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/linked-list}/doubly-linked-list.js +0 -0
- /package/{lib/interfaces → dist/cjs/types/data-structures/linked-list}/singly-linked-list.d.ts +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/linked-list}/singly-linked-list.js +0 -0
- /package/{lib/interfaces/doubly-linked-list.js → dist/cjs/types/data-structures/linked-list/skip-linked-list.d.ts} +0 -0
- /package/{lib/interfaces/heap.js → dist/cjs/types/data-structures/matrix/matrix.d.ts} +0 -0
- /package/{lib/interfaces/navigator.d.ts → dist/cjs/types/data-structures/matrix/matrix2d.d.ts} +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/matrix}/navigator.d.ts +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/matrix}/navigator.js +0 -0
- /package/{lib/interfaces/navigator.js → dist/cjs/types/data-structures/matrix/vector2d.d.ts} +0 -0
- /package/{lib → dist/cjs/types}/data-structures/priority-queue/index.d.ts +0 -0
- /package/{lib/interfaces/priority-queue.d.ts → dist/cjs/types/data-structures/priority-queue/max-priority-queue.d.ts} +0 -0
- /package/{lib/interfaces/priority-queue.js → dist/cjs/types/data-structures/priority-queue/min-priority-queue.d.ts} +0 -0
- /package/{lib/interfaces/rb-tree.js → dist/cjs/types/data-structures/priority-queue/priority-queue.d.ts} +0 -0
- /package/dist/{types/data-structures → cjs/types/data-structures/priority-queue}/priority-queue.js +0 -0
- /package/{lib/interfaces/segment-tree.d.ts → dist/cjs/types/data-structures/queue/deque.d.ts} +0 -0
- /package/{lib → dist/cjs/types}/data-structures/queue/index.d.ts +0 -0
- /package/{lib/interfaces/segment-tree.js → dist/cjs/types/data-structures/queue/queue.d.ts} +0 -0
- /package/{lib → dist/cjs/types}/data-structures/stack/index.d.ts +0 -0
- /package/{lib/interfaces/singly-linked-list.js → dist/cjs/types/data-structures/stack/stack.d.ts} +0 -0
- /package/{lib → dist/cjs/types}/data-structures/tree/index.d.ts +0 -0
- /package/{lib/interfaces/tree-multiset.js → dist/cjs/types/data-structures/tree/tree.d.ts} +0 -0
- /package/{lib → dist/cjs/types}/data-structures/trie/index.d.ts +0 -0
- /package/{lib/interfaces/undirected-graph.js → dist/cjs/types/data-structures/trie/trie.d.ts} +0 -0
- /package/dist/{types → cjs/types}/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/index.js +0 -0
- /package/dist/{types → cjs/types}/utils/index.d.ts +0 -0
- /package/dist/{types → cjs/types}/utils/index.js +0 -0
- /package/dist/{types → cjs/types}/utils/utils.d.ts +0 -0
- /package/dist/{types → cjs/types}/utils/utils.js +0 -0
- /package/dist/{types → cjs/types}/utils/validate-type.d.ts +0 -0
- /package/dist/{types → cjs/types}/utils/validate-type.js +0 -0
- /package/dist/{utils → cjs/utils}/index.d.ts +0 -0
- /package/dist/{utils → cjs/utils}/index.js +0 -0
- /package/{lib → dist/mjs}/data-structures/graph/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/tree-map.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/hash/tree-set.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/heap/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/linked-list/index.d.ts +0 -0
- /package/{lib → dist/mjs}/data-structures/matrix/index.d.ts +0 -0
- /package/{lib/data-structures/priority-queue/index.js → dist/mjs/data-structures/priority-queue/index.d.ts} +0 -0
- /package/{lib/data-structures/queue/index.js → dist/mjs/data-structures/queue/index.d.ts} +0 -0
- /package/{lib/data-structures/stack/index.js → dist/mjs/data-structures/stack/index.d.ts} +0 -0
- /package/{lib/data-structures/tree/index.js → dist/mjs/data-structures/tree/index.d.ts} +0 -0
- /package/{lib/data-structures/trie/index.js → dist/mjs/data-structures/trie/index.d.ts} +0 -0
- /package/{lib → dist/mjs}/index.d.ts +0 -0
- /package/{lib/types/data-structures/abstract-graph.js → dist/mjs/interfaces/doubly-linked-list.d.ts} +0 -0
- /package/{lib/types/data-structures/avl-tree.js → dist/mjs/interfaces/heap.d.ts} +0 -0
- /package/{lib/types/data-structures/binary-tree.js → dist/mjs/interfaces/navigator.d.ts} +0 -0
- /package/{lib/types/data-structures/doubly-linked-list.js → dist/mjs/interfaces/priority-queue.d.ts} +0 -0
- /package/{lib/types/data-structures/hash.js → dist/mjs/interfaces/segment-tree.d.ts} +0 -0
- /package/{lib/types/data-structures → dist/mjs/interfaces}/singly-linked-list.d.ts +0 -0
- /package/{lib/types/data-structures/heap.js → dist/mjs/types/data-structures/binary-tree/binary-indexed-tree.d.ts} +0 -0
- /package/{lib/types/data-structures → dist/mjs/types/data-structures/binary-tree}/segment-tree.d.ts +0 -0
- /package/{lib/types/data-structures → dist/mjs/types/data-structures/graph}/directed-graph.d.ts +0 -0
- /package/{lib/types/data-structures → dist/mjs/types/data-structures/graph}/map-graph.d.ts +0 -0
- /package/{lib/types/data-structures/map-graph.js → dist/mjs/types/data-structures/graph/undirected-graph.d.ts} +0 -0
- /package/{lib/types/data-structures/navigator.js → dist/mjs/types/data-structures/hash/coordinate-map.d.ts} +0 -0
- /package/{lib/types/data-structures/priority-queue.js → dist/mjs/types/data-structures/hash/coordinate-set.d.ts} +0 -0
- /package/{lib/types/data-structures/segment-tree.js → dist/mjs/types/data-structures/hash/hash-map.d.ts} +0 -0
- /package/{lib/types/data-structures/singly-linked-list.js → dist/mjs/types/data-structures/hash/hash-table.d.ts} +0 -0
- /package/{lib/types/data-structures/hash.d.ts → dist/mjs/types/data-structures/hash/index.d.ts} +0 -0
- /package/{lib/types/data-structures/tree-multiset.js → dist/mjs/types/data-structures/hash/tree-map.d.ts} +0 -0
- /package/{lib/types/helpers.d.ts → dist/mjs/types/data-structures/hash/tree-set.d.ts} +0 -0
- /package/{lib/types/helpers.js → dist/mjs/types/data-structures/heap/heap.d.ts} +0 -0
- /package/{lib/types/utils/utils.js → dist/mjs/types/data-structures/heap/max-heap.d.ts} +0 -0
- /package/{lib/types/utils/validate-type.js → dist/mjs/types/data-structures/heap/min-heap.d.ts} +0 -0
- /package/{src/types/data-structures/doubly-linked-list.ts → dist/mjs/types/data-structures/linked-list/doubly-linked-list.d.ts} +0 -0
- /package/{src/types/data-structures/singly-linked-list.ts → dist/mjs/types/data-structures/linked-list/singly-linked-list.d.ts} +0 -0
- /package/{lib/types/data-structures → dist/mjs/types/data-structures/matrix}/navigator.d.ts +0 -0
- /package/{lib → dist/mjs}/types/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/utils/index.d.ts +0 -0
- /package/{lib → dist/mjs}/types/utils/utils.d.ts +0 -0
- /package/{lib → dist/mjs}/types/utils/validate-type.d.ts +0 -0
- /package/{lib → dist/mjs}/utils/index.d.ts +0 -0
- /package/src/types/data-structures/{segment-tree.ts → binary-tree/segment-tree.ts} +0 -0
- /package/src/types/data-structures/{directed-graph.ts → graph/directed-graph.ts} +0 -0
- /package/src/types/data-structures/{map-graph.ts → graph/map-graph.ts} +0 -0
- /package/src/types/data-structures/{hash.ts → hash/index.ts} +0 -0
- /package/{lib/utils/index.js → test/types/index.ts} +0 -0
|
@@ -1,5 +1,100 @@
|
|
|
1
|
+
import {AbstractEdge, AbstractGraph, AbstractVertex, VertexKey} from '../../../../src';
|
|
2
|
+
|
|
3
|
+
class MyVertex<V = any> extends AbstractVertex<V> {
|
|
4
|
+
data?: V;
|
|
5
|
+
|
|
6
|
+
constructor(key: VertexKey, value?: V) {
|
|
7
|
+
super(key, value);
|
|
8
|
+
this.data = value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class MyEdge<E = any> extends AbstractEdge<E> {
|
|
13
|
+
data?: E;
|
|
14
|
+
src: VertexKey;
|
|
15
|
+
dest: VertexKey;
|
|
16
|
+
|
|
17
|
+
constructor(srcOrV1: VertexKey, destOrV2: VertexKey, weight?: number, value?: E) {
|
|
18
|
+
super(weight, value);
|
|
19
|
+
this.src = srcOrV1;
|
|
20
|
+
this.dest = destOrV2;
|
|
21
|
+
this.data = value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class MyGraph<
|
|
26
|
+
V = any,
|
|
27
|
+
E = any,
|
|
28
|
+
VO extends MyVertex<V> = MyVertex<V>,
|
|
29
|
+
EO extends MyEdge<E> = MyEdge<E>
|
|
30
|
+
> extends AbstractGraph<V, E, VO, EO> {
|
|
31
|
+
createVertex(key: VertexKey, value?: V): VO {
|
|
32
|
+
return new MyVertex(key, value) as VO;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
createEdge(srcOrV1: VertexKey, destOrV2: VertexKey, weight?: number, value?: E): EO {
|
|
36
|
+
return new MyEdge(srcOrV1, destOrV2, weight, value) as EO;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
deleteEdge(edge: EO): EO | null {
|
|
40
|
+
return edge;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getEdge(srcOrKey: VertexKey, destOrKey: VertexKey): EO | null {
|
|
44
|
+
return new MyEdge(srcOrKey, destOrKey) as EO;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
degreeOf(vertexOrKey: VO | VertexKey): number {
|
|
48
|
+
return 1 ?? Number(vertexOrKey);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
edgeSet(): EO[] {
|
|
52
|
+
return [new MyEdge('a', 'b') as EO];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
edgesOf(vertexOrKey: VO | VertexKey): EO[] {
|
|
56
|
+
const a = typeof vertexOrKey === 'string' ? vertexOrKey : 'a';
|
|
57
|
+
return [new MyEdge(a, 'b') as EO];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getNeighbors(vertexOrKey: VO | VertexKey): VO[] {
|
|
61
|
+
const a = typeof vertexOrKey === 'string' ? vertexOrKey : 'a';
|
|
62
|
+
return [new MyVertex(a, 'b') as VO];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getEndsOfEdge(edge: EO): [VO, VO] | null {
|
|
66
|
+
return edge ? null : null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
protected _addEdgeOnly(edge: EO): boolean {
|
|
70
|
+
return edge ? true : true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
1
74
|
describe('AbstractGraph Operation Test', () => {
|
|
2
|
-
|
|
3
|
-
|
|
75
|
+
const myGraph: MyGraph<number, string> = new MyGraph<number, string>();
|
|
76
|
+
|
|
77
|
+
beforeEach(() => {});
|
|
78
|
+
it('should edge cases', function () {
|
|
79
|
+
myGraph.addVertex('A', 1);
|
|
80
|
+
myGraph.addVertex('B', 2);
|
|
81
|
+
myGraph.addVertex('C', 3);
|
|
82
|
+
myGraph.addVertex('D', 4);
|
|
83
|
+
|
|
84
|
+
const vA = myGraph.getVertex('A');
|
|
85
|
+
// const vB = myGraph.getVertex('B');
|
|
86
|
+
// const vC = myGraph.getVertex('C');
|
|
87
|
+
// const vD = myGraph.getVertex('D');
|
|
88
|
+
|
|
89
|
+
const eAB = new MyEdge('A', 'B');
|
|
90
|
+
// const eBC = new MyEdge('B', 'C');
|
|
91
|
+
// const eCD = new MyEdge('C', 'D');
|
|
92
|
+
vA!.key = vA?.key || 1;
|
|
93
|
+
vA!.value = vA?.value ?? 2;
|
|
94
|
+
|
|
95
|
+
eAB!.value = eAB.value;
|
|
96
|
+
const hs = eAB.hashCode;
|
|
97
|
+
|
|
98
|
+
expect(hs.length).toBe(36);
|
|
4
99
|
});
|
|
5
100
|
});
|
|
@@ -22,25 +22,30 @@ describe('DirectedGraph Operation Test', () => {
|
|
|
22
22
|
const vertex1 = new DirectedVertex('A');
|
|
23
23
|
const vertex2 = new DirectedVertex('B');
|
|
24
24
|
const edge = new DirectedEdge('A', 'B');
|
|
25
|
+
edge.src = edge.src;
|
|
26
|
+
edge.dest = edge.dest;
|
|
25
27
|
|
|
26
28
|
graph.addVertex(vertex1);
|
|
27
29
|
graph.addVertex(vertex2);
|
|
28
30
|
graph.addEdge(edge);
|
|
29
31
|
|
|
32
|
+
expect(graph.outEdgeMap.size).toBe(1);
|
|
33
|
+
expect(graph.inEdgeMap.size).toBe(1);
|
|
30
34
|
expect(graph.hasEdge('A', 'B')).toBe(true);
|
|
31
35
|
expect(graph.hasEdge('B', 'A')).toBe(false);
|
|
32
36
|
});
|
|
33
37
|
|
|
34
|
-
it('should
|
|
38
|
+
it('should delete edges', () => {
|
|
35
39
|
const vertex1 = new DirectedVertex('A');
|
|
36
|
-
const vertex2 = new DirectedVertex('B');
|
|
40
|
+
// const vertex2 = new DirectedVertex('B');
|
|
41
|
+
graph.createVertex('B');
|
|
37
42
|
const edge = new DirectedEdge('A', 'B');
|
|
38
43
|
|
|
39
44
|
graph.addVertex(vertex1);
|
|
40
|
-
graph.addVertex(
|
|
45
|
+
graph.addVertex('B');
|
|
41
46
|
graph.addEdge(edge);
|
|
42
47
|
|
|
43
|
-
expect(graph.
|
|
48
|
+
expect(graph.deleteEdge(edge)).toBe(edge);
|
|
44
49
|
expect(graph.hasEdge('A', 'B')).toBe(false);
|
|
45
50
|
});
|
|
46
51
|
|
|
@@ -49,65 +54,103 @@ describe('DirectedGraph Operation Test', () => {
|
|
|
49
54
|
const vertexB = new DirectedVertex('B');
|
|
50
55
|
const vertexC = new DirectedVertex('C');
|
|
51
56
|
const edgeAB = new DirectedEdge('A', 'B');
|
|
52
|
-
|
|
57
|
+
graph.createEdge('B', 'C');
|
|
53
58
|
|
|
54
59
|
graph.addVertex(vertexA);
|
|
55
60
|
graph.addVertex(vertexB);
|
|
56
61
|
graph.addVertex(vertexC);
|
|
57
62
|
graph.addEdge(edgeAB);
|
|
58
|
-
graph.addEdge(
|
|
63
|
+
graph.addEdge('B', 'C');
|
|
64
|
+
|
|
65
|
+
expect(graph.getEdgeSrc(edgeAB)).toBe(vertexA);
|
|
59
66
|
|
|
60
67
|
const topologicalOrder = graph.topologicalSort();
|
|
61
68
|
if (topologicalOrder) expect(topologicalOrder).toEqual(['A', 'B', 'C']);
|
|
69
|
+
|
|
70
|
+
graph.deleteEdgesBetween('A', 'B');
|
|
71
|
+
|
|
72
|
+
const topologicalOrder1 = graph.topologicalSort();
|
|
73
|
+
if (topologicalOrder1) expect(topologicalOrder1).toEqual(['B', 'C', 'A']);
|
|
74
|
+
|
|
75
|
+
expect(graph.incomingEdgesOf(vertexC)?.length).toBe(1);
|
|
76
|
+
expect(graph.degreeOf(vertexA)).toBe(0);
|
|
77
|
+
expect(graph.inDegreeOf(vertexC)).toBe(1);
|
|
78
|
+
expect(graph.outDegreeOf(vertexC)).toBe(0);
|
|
79
|
+
expect(graph.edgesOf(vertexC)?.length).toBe(1);
|
|
80
|
+
|
|
81
|
+
expect(graph.tarjan(true, true, true, true)?.dfnMap.size).toBe(3);
|
|
82
|
+
expect(graph.bellmanFord(vertexC, true, true, true)?.paths.length).toBe(3);
|
|
83
|
+
expect(graph.getMinPathBetween('B', 'C', true)?.length).toBe(2);
|
|
84
|
+
expect(graph.setEdgeWeight('B', 'C', 100)).toBe(true);
|
|
85
|
+
expect(graph.getMinCostBetween('B', 'C', true)).toBe(100);
|
|
86
|
+
expect(graph.getMinCostBetween('B', 'C')).toBe(1);
|
|
87
|
+
expect(graph.getAllPathsBetween('B', 'C')?.length).toBe(1);
|
|
88
|
+
expect(graph.deleteVertex(vertexB)).toBe(true);
|
|
89
|
+
expect(graph.getAllPathsBetween('B', 'C')?.length).toBe(0);
|
|
90
|
+
|
|
91
|
+
expect(graph.removeManyVertices([vertexB, vertexC])).toBe(true);
|
|
62
92
|
});
|
|
63
93
|
});
|
|
64
94
|
|
|
65
|
-
class MyVertex<V
|
|
66
|
-
constructor(key: VertexKey,
|
|
67
|
-
super(key,
|
|
68
|
-
this._data =
|
|
95
|
+
class MyVertex<V = any> extends DirectedVertex<V> {
|
|
96
|
+
constructor(key: VertexKey, value?: V) {
|
|
97
|
+
super(key, value);
|
|
98
|
+
this._data = value;
|
|
69
99
|
}
|
|
70
100
|
|
|
71
|
-
|
|
101
|
+
protected _data: V | undefined;
|
|
72
102
|
|
|
73
|
-
get data():
|
|
103
|
+
get data(): V | undefined {
|
|
74
104
|
return this._data;
|
|
75
105
|
}
|
|
76
106
|
|
|
77
|
-
set data(value:
|
|
107
|
+
set data(value: V | undefined) {
|
|
78
108
|
this._data = value;
|
|
79
109
|
}
|
|
80
110
|
}
|
|
81
111
|
|
|
82
|
-
class MyEdge<E
|
|
83
|
-
constructor(v1: VertexKey, v2: VertexKey, weight?: number,
|
|
84
|
-
super(v1, v2, weight,
|
|
85
|
-
this._data =
|
|
112
|
+
class MyEdge<E = any> extends DirectedEdge<E> {
|
|
113
|
+
constructor(v1: VertexKey, v2: VertexKey, weight?: number, value?: E) {
|
|
114
|
+
super(v1, v2, weight, value);
|
|
115
|
+
this._data = value;
|
|
86
116
|
}
|
|
87
117
|
|
|
88
|
-
|
|
118
|
+
protected _data: E | undefined;
|
|
89
119
|
|
|
90
|
-
get data():
|
|
120
|
+
get data(): E | undefined {
|
|
91
121
|
return this._data;
|
|
92
122
|
}
|
|
93
123
|
|
|
94
|
-
set data(value:
|
|
124
|
+
set data(value: E | undefined) {
|
|
95
125
|
this._data = value;
|
|
96
126
|
}
|
|
97
127
|
}
|
|
98
128
|
|
|
99
|
-
class MyDirectedGraph<
|
|
100
|
-
|
|
101
|
-
|
|
129
|
+
class MyDirectedGraph<
|
|
130
|
+
V = any,
|
|
131
|
+
E = any,
|
|
132
|
+
VO extends MyVertex<V> = MyVertex<V>,
|
|
133
|
+
EO extends MyEdge<E> = MyEdge<E>
|
|
134
|
+
> extends DirectedGraph<V, E, VO, EO> {
|
|
135
|
+
createVertex(key: VertexKey, value: V): VO {
|
|
136
|
+
return new MyVertex(key, value) as VO;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
createEdge(src: VertexKey, dest: VertexKey, weight?: number, value?: E): EO {
|
|
140
|
+
return new MyEdge(src, dest, weight ?? 1, value) as EO;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
setInEdgeMap(value: Map<VO, EO[]>) {
|
|
144
|
+
this._inEdgeMap = value;
|
|
102
145
|
}
|
|
103
146
|
|
|
104
|
-
|
|
105
|
-
|
|
147
|
+
setOutEdgeMap(value: Map<VO, EO[]>) {
|
|
148
|
+
this._outEdgeMap = value;
|
|
106
149
|
}
|
|
107
150
|
}
|
|
108
151
|
|
|
109
152
|
describe('Inherit from DirectedGraph and perform operations', () => {
|
|
110
|
-
let myGraph = new MyDirectedGraph<
|
|
153
|
+
let myGraph = new MyDirectedGraph<string, string>();
|
|
111
154
|
beforeEach(() => {
|
|
112
155
|
myGraph = new MyDirectedGraph();
|
|
113
156
|
});
|
|
@@ -129,6 +172,8 @@ describe('Inherit from DirectedGraph and perform operations', () => {
|
|
|
129
172
|
myGraph.addVertex(2, 'data2');
|
|
130
173
|
myGraph.addEdge(1, 2, 10, 'edge-data1-2');
|
|
131
174
|
myGraph.addEdge(new MyEdge(2, 1, 20, 'edge-data2-1'));
|
|
175
|
+
myGraph.setInEdgeMap(myGraph.inEdgeMap);
|
|
176
|
+
myGraph.setOutEdgeMap(myGraph.outEdgeMap);
|
|
132
177
|
|
|
133
178
|
expect(myGraph.edgeSet().length).toBe(2);
|
|
134
179
|
// TODO
|
|
@@ -147,7 +192,7 @@ describe('Inherit from DirectedGraph and perform operations', () => {
|
|
|
147
192
|
expect(edge1).toBeInstanceOf(MyEdge);
|
|
148
193
|
if (edge1) {
|
|
149
194
|
expect(edge1.data).toBe('val1');
|
|
150
|
-
expect(edge1?.
|
|
195
|
+
expect(edge1?.value).toBe('val1');
|
|
151
196
|
expect(edge1).toBeInstanceOf(MyEdge);
|
|
152
197
|
expect(edge1.src).toBe(1);
|
|
153
198
|
expect(edge1).toEqual(edge2);
|
|
@@ -164,12 +209,12 @@ describe('Inherit from DirectedGraph and perform operations', () => {
|
|
|
164
209
|
myGraph.addVertex(2, 'data2');
|
|
165
210
|
myGraph.addEdge(1, 2, 10, 'edge-data1-2');
|
|
166
211
|
|
|
167
|
-
const removedEdge = myGraph.
|
|
212
|
+
const removedEdge = myGraph.deleteEdgeSrcToDest(1, 2);
|
|
168
213
|
const edgeAfterRemoval = myGraph.getEdge(1, 2);
|
|
169
214
|
|
|
170
215
|
expect(removedEdge).toBeInstanceOf(MyEdge);
|
|
171
216
|
if (removedEdge) {
|
|
172
|
-
removedEdge && expect(removedEdge.
|
|
217
|
+
removedEdge && expect(removedEdge.value).toBe('edge-data1-2');
|
|
173
218
|
removedEdge && expect(removedEdge.src).toBe(1);
|
|
174
219
|
}
|
|
175
220
|
expect(edgeAfterRemoval).toBeNull();
|
|
@@ -204,7 +249,7 @@ describe('Inherit from DirectedGraph and perform operations', () => {
|
|
|
204
249
|
});
|
|
205
250
|
|
|
206
251
|
describe('Inherit from DirectedGraph and perform operations test2.', () => {
|
|
207
|
-
const myGraph = new MyDirectedGraph<
|
|
252
|
+
const myGraph = new MyDirectedGraph<string, string>();
|
|
208
253
|
|
|
209
254
|
it('should test graph operations', () => {
|
|
210
255
|
const vertex1 = new MyVertex(1, 'data1');
|
|
@@ -233,7 +278,7 @@ describe('Inherit from DirectedGraph and perform operations test2.', () => {
|
|
|
233
278
|
expect(myGraph.getEdge(2, 1)).toBeTruthy();
|
|
234
279
|
expect(myGraph.getEdge(1, '100')).toBeFalsy();
|
|
235
280
|
|
|
236
|
-
myGraph.
|
|
281
|
+
myGraph.deleteEdgeSrcToDest(1, 2);
|
|
237
282
|
expect(myGraph.getEdge(1, 2)).toBeFalsy();
|
|
238
283
|
|
|
239
284
|
myGraph.addEdge(3, 1, 3, 'edge-data-3-1');
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {MapGraph, MapVertex} from '../../../../src';
|
|
1
|
+
import {MapEdge, MapGraph, MapVertex} from '../../../../src';
|
|
2
2
|
|
|
3
3
|
describe('MapGraph Operation Test', () => {
|
|
4
4
|
it('dijkstra shortest path', () => {
|
|
5
5
|
const mapGraph = new MapGraph([5.500338, 100.173665]);
|
|
6
6
|
|
|
7
|
-
mapGraph.addVertex(new MapVertex('Surin', 5.466724, 100.274805));
|
|
8
|
-
mapGraph.addVertex(new MapVertex('Batu Feringgi Beach', 5.475141, 100.27667));
|
|
9
|
-
mapGraph.addVertex(new MapVertex('Lotus', 5.459044, 100.308767));
|
|
10
|
-
mapGraph.addVertex(new MapVertex('The Breeza', 5.454197, 100.307859));
|
|
11
|
-
mapGraph.addVertex(new MapVertex('Hard Rock Hotel', 5.46785, 100.241876));
|
|
12
|
-
mapGraph.addVertex(new MapVertex('Mira', 5.456749, 100.28665));
|
|
13
|
-
mapGraph.addVertex(new MapVertex('Penang Bible Church', 5.428683, 100.314825));
|
|
14
|
-
mapGraph.addVertex(new MapVertex('Queensbay', 5.33276, 100.306651));
|
|
15
|
-
mapGraph.addVertex(new MapVertex('Saanen Goat Farm', 5.405738, 100.207699));
|
|
16
|
-
mapGraph.addVertex(new MapVertex('Trinity Auto', 5.401126, 100.303739));
|
|
17
|
-
mapGraph.addVertex(new MapVertex('Penang Airport', 5.293185, 100.265772));
|
|
7
|
+
mapGraph.addVertex(new MapVertex('Surin', '', 5.466724, 100.274805));
|
|
8
|
+
mapGraph.addVertex(new MapVertex('Batu Feringgi Beach', '', 5.475141, 100.27667));
|
|
9
|
+
mapGraph.addVertex(new MapVertex('Lotus', '', 5.459044, 100.308767));
|
|
10
|
+
mapGraph.addVertex(new MapVertex('The Breeza', '', 5.454197, 100.307859));
|
|
11
|
+
mapGraph.addVertex(new MapVertex('Hard Rock Hotel', '', 5.46785, 100.241876));
|
|
12
|
+
mapGraph.addVertex(new MapVertex('Mira', '', 5.456749, 100.28665));
|
|
13
|
+
mapGraph.addVertex(new MapVertex('Penang Bible Church', '', 5.428683, 100.314825));
|
|
14
|
+
mapGraph.addVertex(new MapVertex('Queensbay', '', 5.33276, 100.306651));
|
|
15
|
+
mapGraph.addVertex(new MapVertex('Saanen Goat Farm', '', 5.405738, 100.207699));
|
|
16
|
+
mapGraph.addVertex(new MapVertex('Trinity Auto', '', 5.401126, 100.303739));
|
|
17
|
+
mapGraph.addVertex(new MapVertex('Penang Airport', '', 5.293185, 100.265772));
|
|
18
18
|
mapGraph.addEdge('Surin', 'Lotus', 4.7);
|
|
19
19
|
mapGraph.addEdge('Lotus', 'The Breeza', 1);
|
|
20
20
|
mapGraph.addEdge('Batu Feringgi Beach', 'Hard Rock Hotel', 5.2);
|
|
@@ -43,3 +43,84 @@ describe('MapGraph Operation Test', () => {
|
|
|
43
43
|
expect(surinToSaanenGoatFarmViaDij?.minDist).toBe(25.2);
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
+
|
|
47
|
+
describe('MapGraph', () => {
|
|
48
|
+
let mapGraph: MapGraph<string, string>;
|
|
49
|
+
|
|
50
|
+
beforeEach(() => {
|
|
51
|
+
// Create a new MapGraph instance before each test
|
|
52
|
+
mapGraph = new MapGraph<string, string>([0, 0], [100, 100]);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Test adding vertices to the graph
|
|
56
|
+
it('should add vertices to the graph', () => {
|
|
57
|
+
const locationA = new MapVertex('A', 'Location A', 10, 20);
|
|
58
|
+
const locationB = new MapVertex('B', 'Location B', 30, 40);
|
|
59
|
+
|
|
60
|
+
mapGraph.addVertex(locationA);
|
|
61
|
+
mapGraph.addVertex(locationB);
|
|
62
|
+
|
|
63
|
+
expect(mapGraph.hasVertex('A')).toBe(true);
|
|
64
|
+
expect(mapGraph.hasVertex('B')).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Test adding edges to the graph
|
|
68
|
+
it('should add edges to the graph', () => {
|
|
69
|
+
const locationA = new MapVertex('A', 'Location A', 10, 20);
|
|
70
|
+
const locationB = new MapVertex('B', 'Location B', 30, 40);
|
|
71
|
+
const edgeAB = new MapEdge('A', 'B', 50, 'Edge from A to B');
|
|
72
|
+
|
|
73
|
+
mapGraph.addVertex(locationA);
|
|
74
|
+
mapGraph.addVertex(locationB);
|
|
75
|
+
mapGraph.addEdge(edgeAB);
|
|
76
|
+
|
|
77
|
+
expect(mapGraph.hasEdge('A', 'B')).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Test getting neighbors of a vertex
|
|
81
|
+
it('should return the neighbors of a vertex', () => {
|
|
82
|
+
const locationA = new MapVertex('A', 'Location A', 10, 20);
|
|
83
|
+
locationA.lat = locationA.lat;
|
|
84
|
+
locationA.long = locationA.long;
|
|
85
|
+
const locationB = mapGraph.createVertex('B', 'Location B', 30, 40);
|
|
86
|
+
|
|
87
|
+
const locationC = new MapVertex('C', 'Location C', 50, 60);
|
|
88
|
+
const edgeAB = new MapEdge('A', 'B', 50, 'Edge from A to B');
|
|
89
|
+
const edgeBC = new MapEdge('B', 'C', 60, 'Edge from B to C');
|
|
90
|
+
|
|
91
|
+
expect(mapGraph.origin).toEqual([0, 0]);
|
|
92
|
+
expect(mapGraph.bottomRight).toEqual([100, 100]);
|
|
93
|
+
|
|
94
|
+
mapGraph.addVertex(locationA);
|
|
95
|
+
mapGraph.addVertex(locationB);
|
|
96
|
+
mapGraph.addVertex(locationC);
|
|
97
|
+
mapGraph.addEdge(edgeAB);
|
|
98
|
+
mapGraph.addEdge(edgeBC);
|
|
99
|
+
|
|
100
|
+
const neighborsOfA = mapGraph.getNeighbors('A');
|
|
101
|
+
const neighborsOfB = mapGraph.getNeighbors('B');
|
|
102
|
+
|
|
103
|
+
expect(neighborsOfA).toEqual([locationB]);
|
|
104
|
+
expect(neighborsOfB).toEqual([locationC]);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
// Test finding the shortest path between locations
|
|
108
|
+
it('should find the shortest path between two locations', () => {
|
|
109
|
+
const locationA = new MapVertex('A', 'Location A', 10, 20);
|
|
110
|
+
const locationB = new MapVertex('B', 'Location B', 30, 40);
|
|
111
|
+
const locationC = new MapVertex('C', 'Location C', 50, 60);
|
|
112
|
+
const edgeAB = new MapEdge('A', 'B', 50, 'Edge from A to B');
|
|
113
|
+
const edgeBC = new MapEdge('B', 'C', 60, 'Edge from B to C');
|
|
114
|
+
|
|
115
|
+
mapGraph.addVertex(locationA);
|
|
116
|
+
mapGraph.addVertex(locationB);
|
|
117
|
+
mapGraph.addVertex(locationC);
|
|
118
|
+
mapGraph.addEdge(edgeAB);
|
|
119
|
+
mapGraph.addEdge(edgeBC);
|
|
120
|
+
|
|
121
|
+
const shortestPath = mapGraph.dijkstra('A', 'C');
|
|
122
|
+
|
|
123
|
+
expect(shortestPath?.minPath.length).toEqual(0);
|
|
124
|
+
expect(shortestPath?.distMap.size).toBe(3);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
@@ -20,7 +20,7 @@ describe('Overall Graph Operation Test', () => {
|
|
|
20
20
|
expect(graph.hasEdge('A', 'B')).toBe(true); // true
|
|
21
21
|
expect(graph.hasEdge('B', 'A')).toBe(false); // false
|
|
22
22
|
|
|
23
|
-
graph.
|
|
23
|
+
graph.deleteEdgeSrcToDest('A', 'B');
|
|
24
24
|
graph.hasEdge('A', 'B'); // false
|
|
25
25
|
expect(graph.hasEdge('A', 'B')).toBe(false); // false
|
|
26
26
|
|
|
@@ -38,7 +38,7 @@ describe('Overall Graph Operation Test', () => {
|
|
|
38
38
|
graph.addVertex('B');
|
|
39
39
|
graph.addVertex('C');
|
|
40
40
|
graph.addVertex('D');
|
|
41
|
-
graph.
|
|
41
|
+
graph.deleteVertex('C');
|
|
42
42
|
graph.addEdge('A', 'B');
|
|
43
43
|
graph.addEdge('B', 'D');
|
|
44
44
|
|
|
@@ -7,6 +7,14 @@ describe('UndirectedGraph Operation Test', () => {
|
|
|
7
7
|
graph = new UndirectedGraph();
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
+
it('should edge cases', () => {
|
|
11
|
+
expect(graph.deleteEdge(new UndirectedEdge('c', 'd'))).toBe(null);
|
|
12
|
+
expect(graph.deleteEdgeBetween('c', 'd')).toBe(null);
|
|
13
|
+
expect(graph.degreeOf('c')).toBe(0);
|
|
14
|
+
expect(graph.edgesOf('c').length).toBe(0);
|
|
15
|
+
expect(graph.getEndsOfEdge(new UndirectedEdge('c', 'd'))).toBe(null);
|
|
16
|
+
});
|
|
17
|
+
|
|
10
18
|
it('should add vertices', () => {
|
|
11
19
|
const vertex1 = new UndirectedVertex('A');
|
|
12
20
|
const vertex2 = new UndirectedVertex('B');
|
|
@@ -31,7 +39,7 @@ describe('UndirectedGraph Operation Test', () => {
|
|
|
31
39
|
expect(graph.hasEdge('B', 'A')).toBe(true);
|
|
32
40
|
});
|
|
33
41
|
|
|
34
|
-
it('should
|
|
42
|
+
it('should delete edges', () => {
|
|
35
43
|
const vertex1 = new UndirectedVertex('A');
|
|
36
44
|
const vertex2 = new UndirectedVertex('B');
|
|
37
45
|
const edge = new UndirectedEdge('A', 'B');
|
|
@@ -40,7 +48,7 @@ describe('UndirectedGraph Operation Test', () => {
|
|
|
40
48
|
graph.addVertex(vertex2);
|
|
41
49
|
graph.addEdge(edge);
|
|
42
50
|
|
|
43
|
-
expect(graph.
|
|
51
|
+
expect(graph.deleteEdge(edge)).toBe(edge);
|
|
44
52
|
expect(graph.hasEdge('A', 'B')).toBe(false);
|
|
45
53
|
});
|
|
46
54
|
|
|
@@ -49,7 +57,7 @@ describe('UndirectedGraph Operation Test', () => {
|
|
|
49
57
|
graph.addVertex('B');
|
|
50
58
|
graph.addVertex('C');
|
|
51
59
|
graph.addVertex('D');
|
|
52
|
-
graph.
|
|
60
|
+
graph.deleteVertex('C');
|
|
53
61
|
graph.addEdge('A', 'B');
|
|
54
62
|
graph.addEdge('B', 'D');
|
|
55
63
|
|
|
@@ -57,3 +65,85 @@ describe('UndirectedGraph Operation Test', () => {
|
|
|
57
65
|
expect(Array.from(dijkstraResult?.seen ?? []).map(vertex => vertex.key)).toEqual(['A', 'B', 'D']);
|
|
58
66
|
});
|
|
59
67
|
});
|
|
68
|
+
|
|
69
|
+
describe('UndirectedGraph', () => {
|
|
70
|
+
let undirectedGraph: UndirectedGraph<string, string>;
|
|
71
|
+
|
|
72
|
+
beforeEach(() => {
|
|
73
|
+
// Create a new UndirectedGraph instance before each test
|
|
74
|
+
undirectedGraph = new UndirectedGraph<string, string>();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Test adding vertices to the graph
|
|
78
|
+
it('should add vertices to the graph', () => {
|
|
79
|
+
const vertexA = new UndirectedVertex('A', 'Location A');
|
|
80
|
+
const vertexB = new UndirectedVertex('B', 'Location B');
|
|
81
|
+
|
|
82
|
+
undirectedGraph.addVertex(vertexA);
|
|
83
|
+
undirectedGraph.addVertex(vertexB);
|
|
84
|
+
|
|
85
|
+
expect(undirectedGraph.hasVertex('A')).toBe(true);
|
|
86
|
+
expect(undirectedGraph.hasVertex('B')).toBe(true);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Test adding edges to the graph
|
|
90
|
+
it('should add edges to the graph', () => {
|
|
91
|
+
const vertexA = new UndirectedVertex('A', 'Location A');
|
|
92
|
+
const vertexB = new UndirectedVertex('B', 'Location B');
|
|
93
|
+
const edgeAB = new UndirectedEdge('A', 'B', 1, 'Edge between A and B');
|
|
94
|
+
|
|
95
|
+
undirectedGraph.addVertex(vertexA);
|
|
96
|
+
undirectedGraph.addVertex(vertexB);
|
|
97
|
+
undirectedGraph.addEdge(edgeAB);
|
|
98
|
+
|
|
99
|
+
expect(undirectedGraph.hasEdge('A', 'B')).toBe(true);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Test getting neighbors of a vertex
|
|
103
|
+
it('should return the neighbors of a vertex', () => {
|
|
104
|
+
const vertexA = new UndirectedVertex('A', 'Location A');
|
|
105
|
+
const vertexB = new UndirectedVertex('B', 'Location B');
|
|
106
|
+
const vertexC = new UndirectedVertex('C', 'Location C');
|
|
107
|
+
const edgeAB = new UndirectedEdge('A', 'B', 1, 'Edge between A and B');
|
|
108
|
+
const edgeBC = new UndirectedEdge('B', 'C', 2, 'Edge between B and C');
|
|
109
|
+
|
|
110
|
+
undirectedGraph.addVertex(vertexA);
|
|
111
|
+
undirectedGraph.addVertex(vertexB);
|
|
112
|
+
undirectedGraph.addVertex(vertexC);
|
|
113
|
+
undirectedGraph.addEdge(edgeAB);
|
|
114
|
+
undirectedGraph.addEdge(edgeBC);
|
|
115
|
+
|
|
116
|
+
const neighborsOfA = undirectedGraph.getNeighbors('A');
|
|
117
|
+
const neighborsOfB = undirectedGraph.getNeighbors('B');
|
|
118
|
+
|
|
119
|
+
expect(neighborsOfA).toEqual([vertexB]);
|
|
120
|
+
expect(neighborsOfB).toEqual([vertexA, vertexC]);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Test degree of a vertex
|
|
124
|
+
it('should return the degree of a vertex', () => {
|
|
125
|
+
const vertexA = new UndirectedVertex('A', 'Location A');
|
|
126
|
+
const vertexB = new UndirectedVertex('B', 'Location B');
|
|
127
|
+
const vertexC = new UndirectedVertex('C', 'Location C');
|
|
128
|
+
const edgeAB = new UndirectedEdge('A', 'B', 3, 'Edge between A and B');
|
|
129
|
+
const edgeBC = new UndirectedEdge('B', 'C', 4, 'Edge between B and C');
|
|
130
|
+
|
|
131
|
+
edgeAB.vertices = edgeAB.vertices;
|
|
132
|
+
expect(undirectedGraph.edges.size).toBe(0);
|
|
133
|
+
undirectedGraph.addVertex(vertexA);
|
|
134
|
+
undirectedGraph.addVertex(vertexB);
|
|
135
|
+
undirectedGraph.addVertex(vertexC);
|
|
136
|
+
undirectedGraph.addEdge(edgeAB);
|
|
137
|
+
undirectedGraph.addEdge(edgeBC);
|
|
138
|
+
|
|
139
|
+
const degreeOfA = undirectedGraph.degreeOf('A');
|
|
140
|
+
const degreeOfB = undirectedGraph.degreeOf('B');
|
|
141
|
+
const degreeOfC = undirectedGraph.degreeOf('C');
|
|
142
|
+
expect(undirectedGraph.edgeSet().length).toBe(2);
|
|
143
|
+
expect(undirectedGraph.getEndsOfEdge(edgeBC)?.length).toBe(2);
|
|
144
|
+
|
|
145
|
+
expect(degreeOfA).toBe(1);
|
|
146
|
+
expect(degreeOfB).toBe(2);
|
|
147
|
+
expect(degreeOfC).toBe(1);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -52,3 +52,23 @@ describe('CoordinateMap', () => {
|
|
|
52
52
|
expect(retrievedValue).toBe(value);
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
|
+
|
|
56
|
+
describe('CoordinateMap', () => {
|
|
57
|
+
class MyCoordinateMap<V = any> extends CoordinateMap<V> {
|
|
58
|
+
constructor(joint?: string) {
|
|
59
|
+
super(joint);
|
|
60
|
+
this._joint = joint += '-';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const cMap = new MyCoordinateMap<number>('*');
|
|
65
|
+
|
|
66
|
+
beforeEach(() => {
|
|
67
|
+
cMap.set([0, 0], 0);
|
|
68
|
+
cMap.set([0, 1], 1);
|
|
69
|
+
cMap.set([1, 1], 11);
|
|
70
|
+
});
|
|
71
|
+
it('should joint to be *-', () => {
|
|
72
|
+
expect(cMap.joint).toBe('*-');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -39,3 +39,28 @@ describe('CoordinateSet', () => {
|
|
|
39
39
|
expect(hasValue).toBe(true);
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
|
+
|
|
43
|
+
describe('MyCoordinateSet', () => {
|
|
44
|
+
class MyCoordinateSet extends CoordinateSet {
|
|
45
|
+
constructor(joint?: string) {
|
|
46
|
+
super(joint);
|
|
47
|
+
this._joint = joint += '-';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const mySet = new MyCoordinateSet('*');
|
|
52
|
+
|
|
53
|
+
beforeEach(() => {
|
|
54
|
+
mySet.add([0, 0]);
|
|
55
|
+
mySet.add([0, 1]);
|
|
56
|
+
mySet.add([1, 1]);
|
|
57
|
+
});
|
|
58
|
+
it('should joint to be *-', () => {
|
|
59
|
+
expect(mySet.joint).toBe('*-');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should has, delete', () => {
|
|
63
|
+
mySet.delete([0, 1]);
|
|
64
|
+
expect(mySet.has([0, 1])).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
@@ -28,7 +28,6 @@ describe('HashMap', () => {
|
|
|
28
28
|
|
|
29
29
|
it('should handle key collisions', () => {
|
|
30
30
|
// Force a collision by setting two different keys to the same bucket
|
|
31
|
-
hashMap.hashFn = () => 0; // Override hash function to return the same index
|
|
32
31
|
hashMap.set('key1', 1);
|
|
33
32
|
hashMap.set('key2', 2);
|
|
34
33
|
|
|
@@ -36,11 +35,11 @@ describe('HashMap', () => {
|
|
|
36
35
|
expect(hashMap.get('key2')).toBe(2);
|
|
37
36
|
});
|
|
38
37
|
|
|
39
|
-
it('should
|
|
38
|
+
it('should delete values', () => {
|
|
40
39
|
hashMap.set('one', 1);
|
|
41
40
|
hashMap.set('two', 2);
|
|
42
41
|
|
|
43
|
-
hashMap.
|
|
42
|
+
hashMap.delete('one');
|
|
44
43
|
expect(hashMap.get('one')).toBeUndefined();
|
|
45
44
|
expect(hashMap.size).toBe(1);
|
|
46
45
|
});
|