data-structure-typed 1.34.9 → 1.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  2. package/.github/ISSUE_TEMPLATE/custom.md +10 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. package/.github/workflows/ci.yml +3 -0
  5. package/CHANGELOG.md +3 -1
  6. package/CONTRIBUTING.md +18 -0
  7. package/lib/interfaces/abstract-binary-tree.d.ts +1 -78
  8. package/lib/interfaces/abstract-graph.d.ts +2 -14
  9. package/lib/interfaces/avl-tree.d.ts +0 -3
  10. package/lib/interfaces/binary-tree.d.ts +4 -2
  11. package/lib/interfaces/bst.d.ts +0 -11
  12. package/lib/interfaces/directed-graph.d.ts +0 -9
  13. package/lib/interfaces/rb-tree.d.ts +2 -3
  14. package/lib/interfaces/tree-multiset.d.ts +5 -4
  15. package/lib/interfaces/undirected-graph.d.ts +0 -2
  16. package/package.json +7 -7
  17. package/src/interfaces/abstract-binary-tree.ts +2 -170
  18. package/src/interfaces/abstract-graph.ts +2 -26
  19. package/src/interfaces/avl-tree.ts +1 -20
  20. package/src/interfaces/binary-tree.ts +3 -2
  21. package/src/interfaces/bst.ts +1 -26
  22. package/src/interfaces/directed-graph.ts +1 -18
  23. package/src/interfaces/rb-tree.ts +2 -5
  24. package/src/interfaces/tree-multiset.ts +4 -4
  25. package/src/interfaces/undirected-graph.ts +1 -4
  26. package/test/integration/avl-tree.test.ts +4 -4
  27. package/test/integration/bst.test.ts +8 -8
  28. package/test/unit/data-structures/graph/directed-graph.test.ts +5 -5
  29. package/test/unit/data-structures/graph/overall.test.ts +2 -2
  30. package/test/unit/data-structures/linked-list/doubly-linked-list.test.ts +1 -1
  31. package/test/unit/data-structures/linked-list/singly-linked-list.test.ts +1 -1
  32. package/test/unit/data-structures/graph/index.ts +0 -2
  33. package/test/unit/data-structures/linked-list/index.ts +0 -4
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: Custom issue template
3
+ about: Describe this issue template's purpose here.
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -44,6 +44,9 @@ jobs:
44
44
  - name: Build and documentation
45
45
  run: npm run build
46
46
 
47
+ - name: Update Individuals
48
+ run: npm run update:individuals
49
+
47
50
  - name: Run tests
48
51
  run: npm test
49
52
 
package/CHANGELOG.md CHANGED
@@ -8,7 +8,9 @@ All notable changes to this project will be documented in this file.
8
8
  - [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
9
9
  - [`auto-changelog`](https://github.com/CookPete/auto-changelog)
10
10
 
11
- ## [v1.34.9](https://github.com/zrwusa/data-structure-typed/compare/v1.34.1...main) (upcoming)
11
+ ## [v1.35.1](https://github.com/zrwusa/data-structure-typed/compare/v1.35.0...main) (upcoming)
12
+
13
+ ## [v1.35.0](https://github.com/zrwusa/data-structure-typed/compare/v1.34.1...v1.35.0) (11 October 2023)
12
14
 
13
15
  ## [v1.34.1](https://github.com/zrwusa/data-structure-typed/compare/v1.33.4...v1.34.1) (6 October 2023)
14
16
 
package/CONTRIBUTING.md CHANGED
@@ -0,0 +1,18 @@
1
+ ## Contributing
2
+
3
+ **General Rules**
4
+
5
+ - As much as possible, try to follow the existing format of markdown and code.
6
+ - Don't forget to run `npm run lint` and `npm test` before submitting pull requests.
7
+ - Make sure that **100%** of your code is covered by tests.
8
+
9
+
10
+ **Contributing New Data Structures**
11
+
12
+ - Make your pull requests to be **specific** and **focused**. Instead of
13
+ contributing "several data structures" all at once contribute them all
14
+ one by one separately (i.e. one pull request for "RBTree", another one
15
+ for "AATree" and so on).
16
+ - Provide **README.md** for each of the data structure **with explanations** of
17
+ the algorithm and **with links** to further readings.
18
+ - Describe what you do in code using **comments**.
@@ -1,84 +1,7 @@
1
- import { AbstractBinaryTreeNodeProperties, AbstractBinaryTreeNodeProperty, BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName, DFSOrderPattern, FamilyPosition, LoopType, NodeOrPropertyName } from '../types';
1
+ import { BinaryTreeNodeKey } from '../types';
2
2
  import { AbstractBinaryTreeNode } from '../data-structures';
3
3
  export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {
4
- key: BinaryTreeNodeKey;
5
- val: T | undefined;
6
- get left(): NEIGHBOR | null | undefined;
7
- set left(v: NEIGHBOR | null | undefined);
8
- get right(): NEIGHBOR | null | undefined;
9
- set right(v: NEIGHBOR | null | undefined);
10
- parent: NEIGHBOR | null | undefined;
11
- get familyPosition(): FamilyPosition;
12
4
  }
13
5
  export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N>> {
14
6
  createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N | null;
15
- get loopType(): LoopType;
16
- get visitedKey(): BinaryTreeNodeKey[];
17
- get visitedVal(): Array<N['val']>;
18
- get visitedNode(): N[];
19
- get root(): N | null;
20
- get size(): number;
21
- swapLocation(srcNode: N, destNode: N): N;
22
- clear(): void;
23
- isEmpty(): boolean;
24
- add(key: BinaryTreeNodeKey | N, val?: N['val']): N | null | undefined;
25
- addMany(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N['val'][]): (N | null | undefined)[];
26
- refill(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N[] | Array<N['val']>): boolean;
27
- remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
28
- getDepth(node: N): number;
29
- getHeight(beginRoot?: N | null): number;
30
- getMinHeight(beginRoot?: N | null): number;
31
- isPerfectlyBalanced(beginRoot?: N | null): boolean;
32
- getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
33
- has(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): boolean;
34
- get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
35
- getPathToRoot(node: N): N[];
36
- getLeftMost(): N | null;
37
- getLeftMost(node: N): N;
38
- getLeftMost(node?: N | null): N | null;
39
- getRightMost(): N | null;
40
- getRightMost(node: N): N;
41
- getRightMost(node?: N | null): N | null;
42
- isSubtreeBST(node: N | null): boolean;
43
- isBST(): boolean;
44
- getSubTreeSize(subTreeRoot: N | null | undefined): number;
45
- subTreeSum(subTreeRoot: N, propertyName?: BinaryTreeNodePropertyName): number;
46
- subTreeAdd(subTreeRoot: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
47
- bfs(): BinaryTreeNodeKey[];
48
- bfs(nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
49
- bfs(nodeOrPropertyName: 'val'): N['val'][];
50
- bfs(nodeOrPropertyName: 'node'): N[];
51
- bfs(nodeOrPropertyName: 'count'): number[];
52
- bfs(nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
53
- dfs(): BinaryTreeNodeKey[];
54
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
55
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
56
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
57
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
58
- dfs(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
59
- dfsIterative(): BinaryTreeNodeKey[];
60
- dfsIterative(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
61
- dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
62
- dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N['val'][];
63
- dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
64
- dfsIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
65
- levelIterative(node: N | null): BinaryTreeNodeKey[];
66
- levelIterative(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
67
- levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
68
- levelIterative(node: N | null, nodeOrPropertyName?: 'node'): N[];
69
- levelIterative(node: N | null, nodeOrPropertyName?: 'count'): number[];
70
- levelIterative(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
71
- listLevels(node: N | null): BinaryTreeNodeKey[][];
72
- listLevels(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[][];
73
- listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
74
- listLevels(node: N | null, nodeOrPropertyName?: 'node'): N[][];
75
- listLevels(node: N | null, nodeOrPropertyName?: 'count'): number[][];
76
- listLevels(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperty<N>[][];
77
- getPredecessor(node: N): N;
78
- morris(): BinaryTreeNodeKey[];
79
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
80
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
81
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
82
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
83
- morris(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
84
7
  }
@@ -1,17 +1,5 @@
1
1
  import { VertexKey } from '../types';
2
2
  export interface IAbstractGraph<V, E> {
3
- hasVertex(vertexOrKey: V | VertexKey): boolean;
4
- addVertex(key: VertexKey, val?: V): boolean;
5
- removeVertex(vertexOrKey: V | VertexKey): boolean;
6
- removeAllVertices(vertices: V[] | VertexKey[]): boolean;
7
- degreeOf(vertexOrKey: V | VertexKey): number;
8
- edgesOf(vertexOrKey: V | VertexKey): E[];
9
- hasEdge(src: V | VertexKey, dest: V | VertexKey): boolean;
10
- getEdge(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
11
- edgeSet(): E[];
12
- addEdge(src: V | VertexKey, dest: V | VertexKey, weight: number, val: E): boolean;
13
- removeEdge(edge: E): E | null;
14
- setEdgeWeight(srcOrKey: V | VertexKey, destOrKey: V | VertexKey, weight: number): boolean;
15
- getMinPathBetween(v1: V | VertexKey, v2: V | VertexKey, isWeight?: boolean): V[] | null;
16
- getNeighbors(vertexOrKey: V | VertexKey): V[];
3
+ createVertex(key: VertexKey, val?: V): V;
4
+ createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): E;
17
5
  }
@@ -1,10 +1,7 @@
1
1
  import { AVLTreeNode } from '../data-structures';
2
2
  import { IBST, IBSTNode } from './bst';
3
- import { BinaryTreeDeletedResult, BinaryTreeNodeKey } from '../types';
4
3
  export interface IAVLTreeNode<T, NEIGHBOR extends IAVLTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
5
4
  height: number;
6
5
  }
7
6
  export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {
8
- add(key: BinaryTreeNodeKey, val?: N['val'] | null): N | null | undefined;
9
- remove(key: BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
10
7
  }
@@ -1,4 +1,6 @@
1
1
  import { BinaryTreeNode } from '../data-structures';
2
2
  import { IAbstractBinaryTree, IAbstractBinaryTreeNode } from './abstract-binary-tree';
3
- export type IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> = IAbstractBinaryTreeNode<T, NEIGHBOR>;
4
- export type IBinaryTree<N extends BinaryTreeNode<N['val'], N>> = IAbstractBinaryTree<N>;
3
+ export interface IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> extends IAbstractBinaryTreeNode<T, NEIGHBOR> {
4
+ }
5
+ export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> extends IAbstractBinaryTree<N> {
6
+ }
@@ -1,17 +1,6 @@
1
1
  import { BSTNode } from '../data-structures';
2
2
  import { IBinaryTree, IBinaryTreeNode } from './binary-tree';
3
- import { BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName } from '../types';
4
3
  export interface IBSTNode<T, NEIGHBOR extends IBSTNode<T, NEIGHBOR>> extends IBinaryTreeNode<T, NEIGHBOR> {
5
4
  }
6
5
  export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {
7
- createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
8
- add(key: BinaryTreeNodeKey, val?: N['val'] | null, count?: number): N | null | undefined;
9
- get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
10
- lastKey(): BinaryTreeNodeKey;
11
- remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
12
- getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
13
- lesserSum(key: BinaryTreeNodeKey, propertyName?: BinaryTreeNodePropertyName): number;
14
- allGreaterNodesAdd(node: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
15
- perfectlyBalance(): boolean;
16
- isAVLBalanced(): boolean;
17
6
  }
@@ -1,12 +1,3 @@
1
- import { VertexKey } from '../types';
2
1
  import { IAbstractGraph } from './abstract-graph';
3
2
  export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {
4
- incomingEdgesOf(vertex: V): E[];
5
- outgoingEdgesOf(vertex: V): E[];
6
- inDegreeOf(vertexOrKey: V | VertexKey): number;
7
- outDegreeOf(vertexOrKey: V | VertexKey): number;
8
- getEdgeSrc(e: E): V | null;
9
- getEdgeDest(e: E): V | null;
10
- removeEdgeSrcToDest(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
11
- removeEdgesBetween(v1: V | VertexKey, v2: V | VertexKey): E[];
12
3
  }
@@ -1,7 +1,6 @@
1
1
  import { RBTreeNode } from '../data-structures';
2
2
  import { IBST, IBSTNode } from './bst';
3
- import { BinaryTreeNodeKey } from '../types';
4
- export type IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
3
+ export interface IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
4
+ }
5
5
  export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {
6
- createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
7
6
  }
@@ -1,5 +1,6 @@
1
1
  import { TreeMultisetNode } from '../data-structures';
2
- import { IBSTNode } from './bst';
3
- import { IAVLTree } from './avl-tree';
4
- export type ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
5
- export type ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> = IAVLTree<N>;
2
+ import { IAVLTree, IAVLTreeNode } from './avl-tree';
3
+ export interface ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> extends IAVLTreeNode<T, NEIGHBOR> {
4
+ }
5
+ export interface ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> extends IAVLTree<N> {
6
+ }
@@ -1,5 +1,3 @@
1
- import { VertexKey } from '../types';
2
1
  import { IAbstractGraph } from './abstract-graph';
3
2
  export interface IUNDirectedGraph<V, E> extends IAbstractGraph<V, E> {
4
- removeEdgeBetween(v1: V | VertexKey, v2: V | VertexKey): E | null;
5
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-structure-typed",
3
- "version": "1.34.9",
3
+ "version": "1.35.1",
4
4
  "description": "Data Structures of Javascript & TypeScript. Binary Tree, BST, Graph, Heap, Priority Queue, Linked List, Queue, Deque, Stack, AVL Tree, Tree Multiset, Trie, Directed Graph, Undirected Graph, Singly Linked List, Doubly Linked List, Max Heap, Max Priority Queue, Min Heap, Min Priority Queue.",
5
5
  "main": "dist/index.js",
6
6
  "module": "lib/index.js",
@@ -22,13 +22,13 @@
22
22
  "fix:src": "npm run lint:src && npm run format:src",
23
23
  "fix:test": "npm run lint:test && npm run format:test",
24
24
  "fix": "npm run fix:src && npm run fix:test",
25
- "update:test-deps": "npm i avl-tree-typed binary-tree-typed bst-typed heap-typed --save-dev",
25
+ "update:individuals": "npm i avl-tree-typed binary-tree-typed bst-typed heap-typed --save-dev",
26
26
  "install:individuals": "npm i avl-tree-typed binary-tree-typed bst-typed deque-typed directed-graph-typed doubly-linked-list-typed graph-typed heap-typed linked-list-typed max-heap-typed max-priority-queue-typed min-heap-typed min-priority-queue-typed priority-queue-typed singly-linked-list-typed stack-typed tree-multiset-typed trie-typed undirected-graph-typed queue-typed --save-dev",
27
27
  "test": "jest",
28
28
  "check:deps": "dependency-cruiser src",
29
29
  "changelog": "auto-changelog",
30
30
  "coverage:badge": "istanbul-badges-readme",
31
- "ci": "env && npm run lint && npm run build && npm run test && git fetch --tags && npm run changelog"
31
+ "ci": "env && npm run lint && npm run build && npm run update:individuals && npm run test && git fetch --tags && npm run changelog"
32
32
  },
33
33
  "repository": {
34
34
  "type": "git",
@@ -50,17 +50,17 @@
50
50
  "@typescript-eslint/eslint-plugin": "^6.7.4",
51
51
  "@typescript-eslint/parser": "^6.7.4",
52
52
  "auto-changelog": "^2.4.0",
53
- "avl-tree-typed": "^1.34.8",
53
+ "avl-tree-typed": "^1.35.0",
54
54
  "benchmark": "^2.1.4",
55
- "binary-tree-typed": "^1.34.8",
56
- "bst-typed": "^1.34.8",
55
+ "binary-tree-typed": "^1.35.0",
56
+ "bst-typed": "^1.35.0",
57
57
  "dependency-cruiser": "^14.1.0",
58
58
  "eslint": "^8.50.0",
59
59
  "eslint-config-prettier": "^9.0.0",
60
60
  "eslint-import-resolver-alias": "^1.1.2",
61
61
  "eslint-import-resolver-typescript": "^3.6.1",
62
62
  "eslint-plugin-import": "^2.28.1",
63
- "heap-typed": "^1.34.8",
63
+ "heap-typed": "^1.35.0",
64
64
  "istanbul-badges-readme": "^1.8.5",
65
65
  "jest": "^29.7.0",
66
66
  "prettier": "^3.0.3",
@@ -1,176 +1,8 @@
1
- import {
2
- AbstractBinaryTreeNodeProperties,
3
- AbstractBinaryTreeNodeProperty,
4
- BinaryTreeDeletedResult,
5
- BinaryTreeNodeKey,
6
- BinaryTreeNodePropertyName,
7
- DFSOrderPattern,
8
- FamilyPosition,
9
- LoopType,
10
- NodeOrPropertyName
11
- } from '../types';
1
+ import {BinaryTreeNodeKey} from '../types';
12
2
  import {AbstractBinaryTreeNode} from '../data-structures';
13
3
 
14
- export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {
15
- key: BinaryTreeNodeKey;
16
-
17
- val: T | undefined;
18
-
19
- get left(): NEIGHBOR | null | undefined;
20
-
21
- set left(v: NEIGHBOR | null | undefined);
22
-
23
- get right(): NEIGHBOR | null | undefined;
24
-
25
- set right(v: NEIGHBOR | null | undefined);
26
-
27
- parent: NEIGHBOR | null | undefined;
28
-
29
- get familyPosition(): FamilyPosition;
30
- }
4
+ export interface IAbstractBinaryTreeNode<T, NEIGHBOR extends IAbstractBinaryTreeNode<T, NEIGHBOR>> {}
31
5
 
32
6
  export interface IAbstractBinaryTree<N extends AbstractBinaryTreeNode<N['val'], N>> {
33
7
  createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N | null;
34
-
35
- get loopType(): LoopType;
36
-
37
- get visitedKey(): BinaryTreeNodeKey[];
38
-
39
- get visitedVal(): Array<N['val']>;
40
-
41
- get visitedNode(): N[];
42
-
43
- get root(): N | null;
44
-
45
- get size(): number;
46
-
47
- swapLocation(srcNode: N, destNode: N): N;
48
-
49
- clear(): void;
50
-
51
- isEmpty(): boolean;
52
-
53
- add(key: BinaryTreeNodeKey | N, val?: N['val']): N | null | undefined;
54
-
55
- addMany(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N['val'][]): (N | null | undefined)[];
56
-
57
- refill(keysOrNodes: (BinaryTreeNodeKey | N | null)[], data?: N[] | Array<N['val']>): boolean;
58
-
59
- remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
60
-
61
- getDepth(node: N): number;
62
-
63
- getHeight(beginRoot?: N | null): number;
64
-
65
- getMinHeight(beginRoot?: N | null): number;
66
-
67
- isPerfectlyBalanced(beginRoot?: N | null): boolean;
68
-
69
- getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
70
-
71
- has(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): boolean;
72
-
73
- get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
74
-
75
- getPathToRoot(node: N): N[];
76
-
77
- getLeftMost(): N | null;
78
-
79
- getLeftMost(node: N): N;
80
-
81
- getLeftMost(node?: N | null): N | null;
82
-
83
- getRightMost(): N | null;
84
-
85
- getRightMost(node: N): N;
86
-
87
- getRightMost(node?: N | null): N | null;
88
-
89
- isSubtreeBST(node: N | null): boolean;
90
-
91
- isBST(): boolean;
92
-
93
- getSubTreeSize(subTreeRoot: N | null | undefined): number;
94
-
95
- // --- start additional methods ---
96
-
97
- subTreeSum(subTreeRoot: N, propertyName?: BinaryTreeNodePropertyName): number;
98
-
99
- subTreeAdd(subTreeRoot: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
100
-
101
- bfs(): BinaryTreeNodeKey[];
102
-
103
- bfs(nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
104
-
105
- bfs(nodeOrPropertyName: 'val'): N['val'][];
106
-
107
- bfs(nodeOrPropertyName: 'node'): N[];
108
-
109
- bfs(nodeOrPropertyName: 'count'): number[];
110
-
111
- bfs(nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
112
-
113
- dfs(): BinaryTreeNodeKey[];
114
-
115
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
116
-
117
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
118
-
119
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
120
-
121
- dfs(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
122
-
123
- dfs(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
124
-
125
- dfsIterative(): BinaryTreeNodeKey[];
126
-
127
- dfsIterative(pattern: DFSOrderPattern): BinaryTreeNodeKey[];
128
-
129
- dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'key'): BinaryTreeNodeKey[];
130
-
131
- dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'val'): N['val'][];
132
-
133
- dfsIterative(pattern: DFSOrderPattern, nodeOrPropertyName: 'node'): N[];
134
-
135
- dfsIterative(pattern?: DFSOrderPattern, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
136
-
137
- levelIterative(node: N | null): BinaryTreeNodeKey[];
138
-
139
- levelIterative(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
140
-
141
- levelIterative(node: N | null, nodeOrPropertyName?: 'val'): N['val'][];
142
-
143
- levelIterative(node: N | null, nodeOrPropertyName?: 'node'): N[];
144
-
145
- levelIterative(node: N | null, nodeOrPropertyName?: 'count'): number[];
146
-
147
- levelIterative(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
148
-
149
- listLevels(node: N | null): BinaryTreeNodeKey[][];
150
-
151
- listLevels(node: N | null, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[][];
152
-
153
- listLevels(node: N | null, nodeOrPropertyName?: 'val'): N['val'][][];
154
-
155
- listLevels(node: N | null, nodeOrPropertyName?: 'node'): N[][];
156
-
157
- listLevels(node: N | null, nodeOrPropertyName?: 'count'): number[][];
158
-
159
- listLevels(node: N | null, nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperty<N>[][];
160
-
161
- getPredecessor(node: N): N;
162
-
163
- morris(): BinaryTreeNodeKey[];
164
-
165
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'key'): BinaryTreeNodeKey[];
166
-
167
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'val'): N[];
168
-
169
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'node'): N[];
170
-
171
- morris(pattern?: DFSOrderPattern, nodeOrPropertyName?: 'count'): number[];
172
-
173
- morris(pattern?: 'in' | 'pre' | 'post', nodeOrPropertyName?: NodeOrPropertyName): AbstractBinaryTreeNodeProperties<N>;
174
-
175
- // --- end additional methods ---
176
8
  }
@@ -1,31 +1,7 @@
1
1
  import {VertexKey} from '../types';
2
2
 
3
3
  export interface IAbstractGraph<V, E> {
4
- hasVertex(vertexOrKey: V | VertexKey): boolean;
4
+ createVertex(key: VertexKey, val?: V): V;
5
5
 
6
- addVertex(key: VertexKey, val?: V): boolean;
7
-
8
- removeVertex(vertexOrKey: V | VertexKey): boolean;
9
-
10
- removeAllVertices(vertices: V[] | VertexKey[]): boolean;
11
-
12
- degreeOf(vertexOrKey: V | VertexKey): number;
13
-
14
- edgesOf(vertexOrKey: V | VertexKey): E[];
15
-
16
- hasEdge(src: V | VertexKey, dest: V | VertexKey): boolean;
17
-
18
- getEdge(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
19
-
20
- edgeSet(): E[];
21
-
22
- addEdge(src: V | VertexKey, dest: V | VertexKey, weight: number, val: E): boolean;
23
-
24
- removeEdge(edge: E): E | null;
25
-
26
- setEdgeWeight(srcOrKey: V | VertexKey, destOrKey: V | VertexKey, weight: number): boolean;
27
-
28
- getMinPathBetween(v1: V | VertexKey, v2: V | VertexKey, isWeight?: boolean): V[] | null;
29
-
30
- getNeighbors(vertexOrKey: V | VertexKey): V[];
6
+ createEdge(srcOrV1: VertexKey | string, destOrV2: VertexKey | string, weight?: number, val?: E): E;
31
7
  }
@@ -1,27 +1,8 @@
1
1
  import {AVLTreeNode} from '../data-structures';
2
2
  import {IBST, IBSTNode} from './bst';
3
- import {BinaryTreeDeletedResult, BinaryTreeNodeKey} from '../types';
4
3
 
5
4
  export interface IAVLTreeNode<T, NEIGHBOR extends IAVLTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {
6
5
  height: number;
7
6
  }
8
7
 
9
- export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {
10
- add(key: BinaryTreeNodeKey, val?: N['val'] | null): N | null | undefined;
11
-
12
- remove(key: BinaryTreeNodeKey): BinaryTreeDeletedResult<N>[];
13
-
14
- // _balanceFactor(node: N): number
15
- //
16
- // _updateHeight(node: N): void
17
- //
18
- // _balancePath(node: N): void
19
- //
20
- // _balanceLL(A: N): void
21
- //
22
- // _balanceLR(A: N): void
23
- //
24
- // _balanceRR(A: N): void
25
- //
26
- // _balanceRL(A: N): void
27
- }
8
+ export interface IAVLTree<N extends AVLTreeNode<N['val'], N>> extends IBST<N> {}
@@ -1,6 +1,7 @@
1
1
  import {BinaryTreeNode} from '../data-structures';
2
2
  import {IAbstractBinaryTree, IAbstractBinaryTreeNode} from './abstract-binary-tree';
3
3
 
4
- export type IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>> = IAbstractBinaryTreeNode<T, NEIGHBOR>;
4
+ export interface IBinaryTreeNode<T, NEIGHBOR extends IBinaryTreeNode<T, NEIGHBOR>>
5
+ extends IAbstractBinaryTreeNode<T, NEIGHBOR> {}
5
6
 
6
- export type IBinaryTree<N extends BinaryTreeNode<N['val'], N>> = IAbstractBinaryTree<N>;
7
+ export interface IBinaryTree<N extends BinaryTreeNode<N['val'], N>> extends IAbstractBinaryTree<N> {}
@@ -1,31 +1,6 @@
1
1
  import {BSTNode} from '../data-structures';
2
2
  import {IBinaryTree, IBinaryTreeNode} from './binary-tree';
3
- import {BinaryTreeDeletedResult, BinaryTreeNodeKey, BinaryTreeNodePropertyName} from '../types';
4
3
 
5
4
  export interface IBSTNode<T, NEIGHBOR extends IBSTNode<T, NEIGHBOR>> extends IBinaryTreeNode<T, NEIGHBOR> {}
6
5
 
7
- export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {
8
- createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
9
-
10
- add(key: BinaryTreeNodeKey, val?: N['val'] | null, count?: number): N | null | undefined;
11
-
12
- get(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName): N | null;
13
-
14
- lastKey(): BinaryTreeNodeKey;
15
-
16
- remove(key: BinaryTreeNodeKey, ignoreCount?: boolean): BinaryTreeDeletedResult<N>[];
17
-
18
- getNodes(nodeProperty: BinaryTreeNodeKey | N, propertyName?: BinaryTreeNodePropertyName, onlyOne?: boolean): N[];
19
-
20
- // --- start additional functions
21
-
22
- lesserSum(key: BinaryTreeNodeKey, propertyName?: BinaryTreeNodePropertyName): number;
23
-
24
- allGreaterNodesAdd(node: N, delta: number, propertyName?: BinaryTreeNodePropertyName): boolean;
25
-
26
- perfectlyBalance(): boolean;
27
-
28
- isAVLBalanced(): boolean;
29
-
30
- // --- end additional functions
31
- }
6
+ export interface IBST<N extends BSTNode<N['val'], N>> extends IBinaryTree<N> {}
@@ -1,20 +1,3 @@
1
- import {VertexKey} from '../types';
2
1
  import {IAbstractGraph} from './abstract-graph';
3
2
 
4
- export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {
5
- incomingEdgesOf(vertex: V): E[];
6
-
7
- outgoingEdgesOf(vertex: V): E[];
8
-
9
- inDegreeOf(vertexOrKey: V | VertexKey): number;
10
-
11
- outDegreeOf(vertexOrKey: V | VertexKey): number;
12
-
13
- getEdgeSrc(e: E): V | null;
14
-
15
- getEdgeDest(e: E): V | null;
16
-
17
- removeEdgeSrcToDest(srcOrKey: V | VertexKey, destOrKey: V | VertexKey): E | null;
18
-
19
- removeEdgesBetween(v1: V | VertexKey, v2: V | VertexKey): E[];
20
- }
3
+ export interface IDirectedGraph<V, E> extends IAbstractGraph<V, E> {}
@@ -1,9 +1,6 @@
1
1
  import {RBTreeNode} from '../data-structures';
2
2
  import {IBST, IBSTNode} from './bst';
3
- import {BinaryTreeNodeKey} from '../types';
4
3
 
5
- export type IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
4
+ export interface IRBTreeNode<T, NEIGHBOR extends IRBTreeNode<T, NEIGHBOR>> extends IBSTNode<T, NEIGHBOR> {}
6
5
 
7
- export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {
8
- createNode(key: BinaryTreeNodeKey, val?: N['val'], count?: number): N;
9
- }
6
+ export interface IRBTree<N extends RBTreeNode<N['val'], N>> extends IBST<N> {}
@@ -1,7 +1,7 @@
1
1
  import {TreeMultisetNode} from '../data-structures';
2
- import {IBSTNode} from './bst';
3
- import {IAVLTree} from './avl-tree';
2
+ import {IAVLTree, IAVLTreeNode} from './avl-tree';
4
3
 
5
- export type ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>> = IBSTNode<T, NEIGHBOR>;
4
+ export interface ITreeMultisetNode<T, NEIGHBOR extends ITreeMultisetNode<T, NEIGHBOR>>
5
+ extends IAVLTreeNode<T, NEIGHBOR> {}
6
6
 
7
- export type ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> = IAVLTree<N>;
7
+ export interface ITreeMultiset<N extends TreeMultisetNode<N['val'], N>> extends IAVLTree<N> {}
@@ -1,6 +1,3 @@
1
- import {VertexKey} from '../types';
2
1
  import {IAbstractGraph} from './abstract-graph';
3
2
 
4
- export interface IUNDirectedGraph<V, E> extends IAbstractGraph<V, E> {
5
- removeEdgeBetween(v1: V | VertexKey, v2: V | VertexKey): E | null;
6
- }
3
+ export interface IUNDirectedGraph<V, E> extends IAbstractGraph<V, E> {}
@@ -31,12 +31,12 @@ describe('AVL Tree Test', () => {
31
31
  // node15 has type problem. After the uniform design, the generics of containers (DirectedGraph, BST) are based on the type of value. However, this design has a drawback: when I attempt to inherit from the Vertex or BSTNode classes, the types of the results obtained by all methods are those of the parent class.
32
32
  expect(node15?.val).toBe(15);
33
33
 
34
- const dfs = tree.DFS('in', 'node');
34
+ const dfs = tree.dfs('in', 'node');
35
35
  expect(dfs[0].key).toBe(1);
36
36
  expect(dfs[dfs.length - 1].key).toBe(16);
37
37
 
38
38
  tree.perfectlyBalance();
39
- const bfs = tree.BFS('node');
39
+ const bfs = tree.bfs('node');
40
40
  expect(tree.isPerfectlyBalanced()).toBe(true);
41
41
  expect(bfs[0].key).toBe(8);
42
42
  expect(bfs[bfs.length - 1].key).toBe(16);
@@ -95,12 +95,12 @@ describe('AVL Tree Test', () => {
95
95
  expect(tree.getHeight()).toBe(1);
96
96
 
97
97
  expect(tree.isAVLBalanced()).toBe(true);
98
- const lastBFSIds = tree.BFS();
98
+ const lastBFSIds = tree.bfs();
99
99
  expect(lastBFSIds[0]).toBe(12);
100
100
  expect(lastBFSIds[1]).toBe(2);
101
101
  expect(lastBFSIds[2]).toBe(16);
102
102
 
103
- const lastBFSNodes = tree.BFS('node');
103
+ const lastBFSNodes = tree.bfs('node');
104
104
  expect(lastBFSNodes[0].key).toBe(12);
105
105
  expect(lastBFSNodes[1].key).toBe(2);
106
106
  expect(lastBFSNodes[2].key).toBe(16);
@@ -44,14 +44,14 @@ describe('Individual package BST operations test', () => {
44
44
  const node11 = bst.get(11);
45
45
  expect(node11).toBeInstanceOf(BSTNode);
46
46
 
47
- const dfsInorderNodes = bst.DFS('in', 'node');
47
+ const dfsInorderNodes = bst.dfs('in', 'node');
48
48
  expect(dfsInorderNodes[0].key).toBe(1);
49
49
  expect(dfsInorderNodes[dfsInorderNodes.length - 1].key).toBe(16);
50
50
 
51
51
  bst.perfectlyBalance();
52
52
  expect(bst.isPerfectlyBalanced()).toBe(true);
53
53
 
54
- const bfsNodesAfterBalanced = bst.BFS('node');
54
+ const bfsNodesAfterBalanced = bst.bfs('node');
55
55
  expect(bfsNodesAfterBalanced[0].key).toBe(8);
56
56
  expect(bfsNodesAfterBalanced[bfsNodesAfterBalanced.length - 1].key).toBe(16);
57
57
 
@@ -169,12 +169,12 @@ describe('Individual package BST operations test', () => {
169
169
 
170
170
  expect(bst.isAVLBalanced()).toBe(false);
171
171
 
172
- const bfsIDs = bst.BFS();
172
+ const bfsIDs = bst.bfs();
173
173
  expect(bfsIDs[0]).toBe(2);
174
174
  expect(bfsIDs[1]).toBe(12);
175
175
  expect(bfsIDs[2]).toBe(16);
176
176
 
177
- const bfsNodes = bst.BFS('node');
177
+ const bfsNodes = bst.bfs('node');
178
178
  expect(bfsNodes[0].key).toBe(2);
179
179
  expect(bfsNodes[1].key).toBe(12);
180
180
  expect(bfsNodes[2].key).toBe(16);
@@ -242,14 +242,14 @@ describe('Individual package BST operations test', () => {
242
242
  const node11 = objBST.get(11);
243
243
  expect(node11).toBeInstanceOf(BSTNode);
244
244
 
245
- const dfsInorderNodes = objBST.DFS('in', 'node');
245
+ const dfsInorderNodes = objBST.dfs('in', 'node');
246
246
  expect(dfsInorderNodes[0].key).toBe(1);
247
247
  expect(dfsInorderNodes[dfsInorderNodes.length - 1].key).toBe(16);
248
248
 
249
249
  objBST.perfectlyBalance();
250
250
  expect(objBST.isPerfectlyBalanced()).toBe(true);
251
251
 
252
- const bfsNodesAfterBalanced = objBST.BFS('node');
252
+ const bfsNodesAfterBalanced = objBST.bfs('node');
253
253
  expect(bfsNodesAfterBalanced[0].key).toBe(8);
254
254
  expect(bfsNodesAfterBalanced[bfsNodesAfterBalanced.length - 1].key).toBe(16);
255
255
 
@@ -367,12 +367,12 @@ describe('Individual package BST operations test', () => {
367
367
 
368
368
  expect(objBST.isAVLBalanced()).toBe(false);
369
369
 
370
- const bfsIDs = objBST.BFS();
370
+ const bfsIDs = objBST.bfs();
371
371
  expect(bfsIDs[0]).toBe(2);
372
372
  expect(bfsIDs[1]).toBe(12);
373
373
  expect(bfsIDs[2]).toBe(16);
374
374
 
375
- const bfsNodes = objBST.BFS('node');
375
+ const bfsNodes = objBST.bfs('node');
376
376
  expect(bfsNodes[0].key).toBe(2);
377
377
  expect(bfsNodes[1].key).toBe(12);
378
378
  expect(bfsNodes[2].key).toBe(16);
@@ -1,4 +1,4 @@
1
- import {DirectedEdge, DirectedGraph, DirectedVertex, VertexId} from '../../../../src';
1
+ import {DirectedEdge, DirectedGraph, DirectedVertex, VertexKey} from '../../../../src';
2
2
 
3
3
  describe('DirectedGraph Operation Test', () => {
4
4
  let graph: DirectedGraph;
@@ -63,7 +63,7 @@ describe('DirectedGraph Operation Test', () => {
63
63
  });
64
64
 
65
65
  class MyVertex<V extends string> extends DirectedVertex<V> {
66
- constructor(key: VertexId, val?: V) {
66
+ constructor(key: VertexKey, val?: V) {
67
67
  super(key, val);
68
68
  this._data = val;
69
69
  }
@@ -80,7 +80,7 @@ class MyVertex<V extends string> extends DirectedVertex<V> {
80
80
  }
81
81
 
82
82
  class MyEdge<E extends string> extends DirectedEdge<E> {
83
- constructor(v1: VertexId, v2: VertexId, weight?: number, val?: E) {
83
+ constructor(v1: VertexKey, v2: VertexKey, weight?: number, val?: E) {
84
84
  super(v1, v2, weight, val);
85
85
  this._data = val;
86
86
  }
@@ -97,11 +97,11 @@ class MyEdge<E extends string> extends DirectedEdge<E> {
97
97
  }
98
98
 
99
99
  class MyDirectedGraph<V extends MyVertex<string>, E extends MyEdge<string>> extends DirectedGraph<V, E> {
100
- createVertex(key: VertexId, val: V['val']): V {
100
+ createVertex(key: VertexKey, val: V['val']): V {
101
101
  return new MyVertex(key, val) as V;
102
102
  }
103
103
 
104
- createEdge(src: VertexId, dest: VertexId, weight?: number, val?: E['val']): E {
104
+ createEdge(src: VertexKey, dest: VertexKey, weight?: number, val?: E['val']): E {
105
105
  return new MyEdge(src, dest, weight ?? 1, val) as E;
106
106
  }
107
107
  }
@@ -29,8 +29,8 @@ describe('Overall Graph Operation Test', () => {
29
29
  graph.addEdge('A', 'B');
30
30
  graph.addEdge('B', 'C');
31
31
 
32
- const topologicalOrderIds = graph.topologicalSort();
33
- expect(topologicalOrderIds).toEqual(['A', 'B', 'C']);
32
+ const topologicalOrderKeys = graph.topologicalSort();
33
+ expect(topologicalOrderKeys).toEqual(['A', 'B', 'C']);
34
34
  });
35
35
  it('Overall UndirectedGraph Operation Test', () => {
36
36
  const graph = new UndirectedGraph();
@@ -349,7 +349,7 @@ describe('DoublyLinkedList Performance Test', () => {
349
349
  for (let i = 0; i < magnitude.LINEAR; i++) {
350
350
  list.unshift(i);
351
351
  }
352
- expect(performance.now() - startPushTime).toBeLessThan(bigO.LINEAR * 10);
352
+ expect(performance.now() - startPushTime).toBeLessThan(bigO.LINEAR * 20);
353
353
 
354
354
  expect(list.length).toBeGreaterThan(0);
355
355
  const startPopTime = performance.now();
@@ -384,7 +384,7 @@ describe('SinglyLinkedList Performance Test', () => {
384
384
  for (let i = 0; i < magnitude.LINEAR; i++) {
385
385
  list.push(i);
386
386
  }
387
- expect(performance.now() - startPushTime).toBeLessThan(bigO.LINEAR * 10);
387
+ expect(performance.now() - startPushTime).toBeLessThan(bigO.LINEAR * 20);
388
388
 
389
389
  const startPopTime = performance.now();
390
390
 
@@ -1,2 +0,0 @@
1
- export * from './directed-graph.test';
2
- export * from './undirected-graph.test';
@@ -1,4 +0,0 @@
1
- export * from './singly-linked-list.test';
2
- export * from './doubly-linked-list.test';
3
- export * from './linked-list.test';
4
- export * from './skip-linked-list.test';