directed-graph-typed 1.34.3 → 1.34.5
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/coverage/clover.xml +7 -3
- package/coverage/coverage-final.json +2 -1
- package/coverage/coverage-summary.json +2 -1
- package/coverage/lcov-report/index.html +25 -10
- package/coverage/lcov-report/index.ts.html +109 -0
- package/coverage/lcov.info +16 -0
- package/dist/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/test/index.test.ts +516 -2
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
4
|
-
<metrics statements="
|
|
2
|
+
<coverage generated="1696760545910" clover="3.2.0">
|
|
3
|
+
<project timestamp="1696760545910" name="All files">
|
|
4
|
+
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="3" coveredmethods="3" elements="4" coveredelements="4" complexity="0" loc="1" ncloc="1" packages="1" files="1" classes="1"/>
|
|
5
|
+
<file name="index.ts" path="/Users/revone/projects/data-structure-typed-individuals/directed-graph-typed/src/index.ts">
|
|
6
|
+
<metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="3" coveredmethods="3"/>
|
|
7
|
+
<line num="8" count="11" type="stmt"/>
|
|
8
|
+
</file>
|
|
5
9
|
</project>
|
|
6
10
|
</coverage>
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
{}
|
|
1
|
+
{"/Users/revone/projects/data-structure-typed-individuals/directed-graph-typed/src/index.ts": {"path":"/Users/revone/projects/data-structure-typed-individuals/directed-graph-typed/src/index.ts","statementMap":{"0":{"start":{"line":8,"column":0},"end":{"line":8,"column":9}},"1":{"start":{"line":8,"column":9},"end":{"line":8,"column":25}},"2":{"start":{"line":8,"column":25},"end":{"line":8,"column":39}},"3":{"start":{"line":8,"column":39},"end":{"line":8,"column":93}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":8,"column":9},"end":{"line":8,"column":23}},"loc":{"start":{"line":8,"column":9},"end":{"line":8,"column":25}}},"1":{"name":"(anonymous_1)","decl":{"start":{"line":8,"column":25},"end":{"line":8,"column":37}},"loc":{"start":{"line":8,"column":25},"end":{"line":8,"column":39}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":8,"column":39},"end":{"line":8,"column":52}},"loc":{"start":{"line":8,"column":39},"end":{"line":8,"column":93}}}},"branchMap":{},"s":{"0":1,"1":11,"2":6,"3":6},"f":{"0":10,"1":5,"2":5},"b":{}}
|
|
2
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
{"total": {"lines":{"total":
|
|
1
|
+
{"total": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"statements":{"total":4,"covered":4,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}}
|
|
2
|
+
,"/Users/revone/projects/data-structure-typed-individuals/directed-graph-typed/src/index.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":4,"covered":4,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
|
|
2
3
|
}
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">100% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>4/4</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">100% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
35
|
<span class='fraction'>0/0</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>3/3</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">100% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>1/1</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
</div>
|
|
64
|
-
<div class='status-line
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
65
|
<div class="pad1">
|
|
66
66
|
<table class="coverage-summary">
|
|
67
67
|
<thead>
|
|
@@ -78,7 +78,22 @@
|
|
|
78
78
|
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
79
79
|
</tr>
|
|
80
80
|
</thead>
|
|
81
|
-
<tbody
|
|
81
|
+
<tbody><tr>
|
|
82
|
+
<td class="file high" data-value="index.ts"><a href="index.ts.html">index.ts</a></td>
|
|
83
|
+
<td data-value="100" class="pic high">
|
|
84
|
+
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
85
|
+
</td>
|
|
86
|
+
<td data-value="100" class="pct high">100%</td>
|
|
87
|
+
<td data-value="4" class="abs high">4/4</td>
|
|
88
|
+
<td data-value="100" class="pct high">100%</td>
|
|
89
|
+
<td data-value="0" class="abs high">0/0</td>
|
|
90
|
+
<td data-value="100" class="pct high">100%</td>
|
|
91
|
+
<td data-value="3" class="abs high">3/3</td>
|
|
92
|
+
<td data-value="100" class="pct high">100%</td>
|
|
93
|
+
<td data-value="1" class="abs high">1/1</td>
|
|
94
|
+
</tr>
|
|
95
|
+
|
|
96
|
+
</tbody>
|
|
82
97
|
</table>
|
|
83
98
|
</div>
|
|
84
99
|
<div class='push'></div><!-- for sticky footer -->
|
|
@@ -86,7 +101,7 @@
|
|
|
86
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
87
102
|
Code coverage generated by
|
|
88
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
89
|
-
at 2023-10-
|
|
104
|
+
at 2023-10-08T10:22:25.926Z
|
|
90
105
|
</div>
|
|
91
106
|
<script src="prettify.js"></script>
|
|
92
107
|
<script>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<title>Code coverage report for index.ts</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<style type='text/css'>
|
|
13
|
+
.coverage-summary .sorter {
|
|
14
|
+
background-image: url(sort-arrow-sprite.png);
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class='wrapper'>
|
|
21
|
+
<div class='pad1'>
|
|
22
|
+
<h1><a href="index.html">All files</a> index.ts</h1>
|
|
23
|
+
<div class='clearfix'>
|
|
24
|
+
|
|
25
|
+
<div class='fl pad1y space-right2'>
|
|
26
|
+
<span class="strong">100% </span>
|
|
27
|
+
<span class="quiet">Statements</span>
|
|
28
|
+
<span class='fraction'>4/4</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div class='fl pad1y space-right2'>
|
|
33
|
+
<span class="strong">100% </span>
|
|
34
|
+
<span class="quiet">Branches</span>
|
|
35
|
+
<span class='fraction'>0/0</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class='fl pad1y space-right2'>
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
|
+
<span class="quiet">Functions</span>
|
|
42
|
+
<span class='fraction'>3/3</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div class='fl pad1y space-right2'>
|
|
47
|
+
<span class="strong">100% </span>
|
|
48
|
+
<span class="quiet">Lines</span>
|
|
49
|
+
<span class='fraction'>1/1</span>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<p class="quiet">
|
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
+
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input oninput="onInput()" type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
|
+
<pre><table class="coverage">
|
|
66
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
|
68
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
|
69
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
|
70
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
|
71
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
|
72
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
|
73
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
|
74
|
+
<a name='L9'></a><a href='#L9'>9</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
75
|
+
<span class="cline-any cline-neutral"> </span>
|
|
76
|
+
<span class="cline-any cline-neutral"> </span>
|
|
77
|
+
<span class="cline-any cline-neutral"> </span>
|
|
78
|
+
<span class="cline-any cline-neutral"> </span>
|
|
79
|
+
<span class="cline-any cline-neutral"> </span>
|
|
80
|
+
<span class="cline-any cline-neutral"> </span>
|
|
81
|
+
<span class="cline-any cline-yes">11x</span>
|
|
82
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
|
83
|
+
* data-structure-typed
|
|
84
|
+
*
|
|
85
|
+
* @author Tyler Zeng
|
|
86
|
+
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
87
|
+
* @license MIT License
|
|
88
|
+
*/
|
|
89
|
+
export { DirectedVertex, DirectedEdge, DirectedGraph, VertexId } from 'data-structure-typed';
|
|
90
|
+
</pre></td></tr></table></pre>
|
|
91
|
+
|
|
92
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
93
|
+
</div><!-- /wrapper -->
|
|
94
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
95
|
+
Code coverage generated by
|
|
96
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
97
|
+
at 2023-10-08T10:22:25.926Z
|
|
98
|
+
</div>
|
|
99
|
+
<script src="prettify.js"></script>
|
|
100
|
+
<script>
|
|
101
|
+
window.onload = function () {
|
|
102
|
+
prettyPrint();
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
105
|
+
<script src="sorter.js"></script>
|
|
106
|
+
<script src="block-navigation.js"></script>
|
|
107
|
+
</body>
|
|
108
|
+
</html>
|
|
109
|
+
|
package/coverage/lcov.info
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
export { DirectedVertex, DirectedEdge, DirectedGraph } from 'data-structure-typed';
|
|
8
|
+
export { DirectedVertex, DirectedEdge, DirectedGraph, VertexId } from 'data-structure-typed';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "directed-graph-typed",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.5",
|
|
4
4
|
"description": "Directed Graph. Javascript & Typescript Data Structure.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -146,6 +146,6 @@
|
|
|
146
146
|
"typescript": "^4.9.5"
|
|
147
147
|
},
|
|
148
148
|
"dependencies": {
|
|
149
|
-
"data-structure-typed": "^1.34.
|
|
149
|
+
"data-structure-typed": "^1.34.5"
|
|
150
150
|
}
|
|
151
151
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
-
export { DirectedVertex, DirectedEdge, DirectedGraph } from 'data-structure-typed';
|
|
8
|
+
export { DirectedVertex, DirectedEdge, DirectedGraph, VertexId } from 'data-structure-typed';
|
package/test/index.test.ts
CHANGED
|
@@ -1,5 +1,519 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import {DirectedEdge, DirectedGraph, DirectedVertex, VertexId} from '../src';
|
|
2
|
+
|
|
3
|
+
describe('DirectedGraph Operation Test', () => {
|
|
4
|
+
let graph: DirectedGraph;
|
|
5
|
+
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
graph = new DirectedGraph();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should add vertices', () => {
|
|
11
|
+
const vertex1 = new DirectedVertex('A');
|
|
12
|
+
const vertex2 = new DirectedVertex('B');
|
|
13
|
+
|
|
14
|
+
graph.addVertex(vertex1);
|
|
15
|
+
graph.addVertex(vertex2);
|
|
16
|
+
|
|
17
|
+
expect(graph.hasVertex(vertex1)).toBe(true);
|
|
18
|
+
expect(graph.hasVertex(vertex2)).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should add edges', () => {
|
|
22
|
+
const vertex1 = new DirectedVertex('A');
|
|
23
|
+
const vertex2 = new DirectedVertex('B');
|
|
24
|
+
const edge = new DirectedEdge('A', 'B');
|
|
25
|
+
|
|
26
|
+
graph.addVertex(vertex1);
|
|
27
|
+
graph.addVertex(vertex2);
|
|
28
|
+
graph.addEdge(edge);
|
|
29
|
+
|
|
30
|
+
expect(graph.hasEdge('A', 'B')).toBe(true);
|
|
31
|
+
expect(graph.hasEdge('B', 'A')).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should remove edges', () => {
|
|
35
|
+
const vertex1 = new DirectedVertex('A');
|
|
36
|
+
const vertex2 = new DirectedVertex('B');
|
|
37
|
+
const edge = new DirectedEdge('A', 'B');
|
|
38
|
+
|
|
39
|
+
graph.addVertex(vertex1);
|
|
40
|
+
graph.addVertex(vertex2);
|
|
41
|
+
graph.addEdge(edge);
|
|
42
|
+
|
|
43
|
+
expect(graph.removeEdge(edge)).toBe(edge);
|
|
44
|
+
expect(graph.hasEdge('A', 'B')).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should perform topological sort', () => {
|
|
48
|
+
const vertexA = new DirectedVertex('A');
|
|
49
|
+
const vertexB = new DirectedVertex('B');
|
|
50
|
+
const vertexC = new DirectedVertex('C');
|
|
51
|
+
const edgeAB = new DirectedEdge('A', 'B');
|
|
52
|
+
const edgeBC = new DirectedEdge('B', 'C');
|
|
53
|
+
|
|
54
|
+
graph.addVertex(vertexA);
|
|
55
|
+
graph.addVertex(vertexB);
|
|
56
|
+
graph.addVertex(vertexC);
|
|
57
|
+
graph.addEdge(edgeAB);
|
|
58
|
+
graph.addEdge(edgeBC);
|
|
59
|
+
|
|
60
|
+
const topologicalOrder = graph.topologicalSort();
|
|
61
|
+
if (topologicalOrder) expect(topologicalOrder).toEqual(['A', 'B', 'C']);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
class MyVertex<V extends string> extends DirectedVertex<V> {
|
|
66
|
+
constructor(id: VertexId, val?: V) {
|
|
67
|
+
super(id, val);
|
|
68
|
+
this._data = val;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private _data: string | undefined;
|
|
72
|
+
|
|
73
|
+
get data(): string | undefined {
|
|
74
|
+
return this._data;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
set data(value: string | undefined) {
|
|
78
|
+
this._data = value;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
class MyEdge<E extends string> extends DirectedEdge<E> {
|
|
83
|
+
constructor(v1: VertexId, v2: VertexId, weight?: number, val?: E) {
|
|
84
|
+
super(v1, v2, weight, val);
|
|
85
|
+
this._data = val;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private _data: string | undefined;
|
|
89
|
+
|
|
90
|
+
get data(): string | undefined {
|
|
91
|
+
return this._data;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
set data(value: string | undefined) {
|
|
95
|
+
this._data = value;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
class MyDirectedGraph<V extends MyVertex<string>, E extends MyEdge<string>> extends DirectedGraph<V, E> {
|
|
100
|
+
createVertex(id: VertexId, val: V['val']): V {
|
|
101
|
+
return new MyVertex(id, val) as V;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
createEdge(src: VertexId, dest: VertexId, weight?: number, val?: E['val']): E {
|
|
105
|
+
return new MyEdge(src, dest, weight ?? 1, val) as E;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
describe('Inherit from DirectedGraph and perform operations', () => {
|
|
110
|
+
let myGraph = new MyDirectedGraph<MyVertex<string>, MyEdge<string>>();
|
|
111
|
+
beforeEach(() => {
|
|
112
|
+
myGraph = new MyDirectedGraph();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('Add vertices', () => {
|
|
116
|
+
myGraph.addVertex(1, 'data1');
|
|
117
|
+
myGraph.addVertex(2, 'data2');
|
|
118
|
+
myGraph.addVertex(3, 'data3');
|
|
119
|
+
myGraph.addVertex(4, 'data4');
|
|
120
|
+
myGraph.addVertex(5, 'data5');
|
|
121
|
+
myGraph.addVertex(new MyVertex(6, 'data6'));
|
|
122
|
+
myGraph.addVertex(new MyVertex(7, 'data7'));
|
|
123
|
+
myGraph.addVertex(new MyVertex(8, 'data8'));
|
|
124
|
+
myGraph.addVertex(new MyVertex(9, 'data9'));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('Add edges', () => {
|
|
128
|
+
myGraph.addVertex(1, 'data1');
|
|
129
|
+
myGraph.addVertex(2, 'data2');
|
|
130
|
+
myGraph.addEdge(1, 2, 10, 'edge-data1-2');
|
|
131
|
+
myGraph.addEdge(new MyEdge(2, 1, 20, 'edge-data2-1'));
|
|
132
|
+
|
|
133
|
+
expect(myGraph.edgeSet().length).toBe(2);
|
|
134
|
+
// TODO
|
|
135
|
+
expect(myGraph.getEdge(1, 2)).toBeInstanceOf(MyEdge);
|
|
136
|
+
expect(myGraph.getEdge(2, 1)).toBeInstanceOf(MyEdge);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('Get edge', () => {
|
|
140
|
+
myGraph.addVertex(1, 'val1');
|
|
141
|
+
myGraph.addVertex(2, 'val1');
|
|
142
|
+
myGraph.addEdge(1, 2, 1, 'val1');
|
|
143
|
+
const edge1 = myGraph.getEdge(1, 2);
|
|
144
|
+
const edge2 = myGraph.getEdge(myGraph.getVertex(1), myGraph.getVertex(2));
|
|
145
|
+
const edge3 = myGraph.getEdge(1, '100');
|
|
146
|
+
// edge1.data 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.
|
|
147
|
+
expect(edge1).toBeInstanceOf(MyEdge);
|
|
148
|
+
if (edge1) {
|
|
149
|
+
expect(edge1.data).toBe('val1');
|
|
150
|
+
expect(edge1?.val).toBe('val1');
|
|
151
|
+
expect(edge1).toBeInstanceOf(MyEdge);
|
|
152
|
+
expect(edge1.src).toBe(1);
|
|
153
|
+
expect(edge1).toEqual(edge2);
|
|
154
|
+
expect(edge3).toBeNull();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('Edge set and vertex set', () => {
|
|
3
159
|
expect(true).toBeTruthy();
|
|
4
160
|
});
|
|
161
|
+
|
|
162
|
+
it('Remove edge between vertices', () => {
|
|
163
|
+
myGraph.addVertex(1, 'data1');
|
|
164
|
+
myGraph.addVertex(2, 'data2');
|
|
165
|
+
myGraph.addEdge(1, 2, 10, 'edge-data1-2');
|
|
166
|
+
|
|
167
|
+
const removedEdge = myGraph.removeEdgeSrcToDest(1, 2);
|
|
168
|
+
const edgeAfterRemoval = myGraph.getEdge(1, 2);
|
|
169
|
+
|
|
170
|
+
expect(removedEdge).toBeInstanceOf(MyEdge);
|
|
171
|
+
if (removedEdge) {
|
|
172
|
+
removedEdge && expect(removedEdge.val).toBe('edge-data1-2');
|
|
173
|
+
removedEdge && expect(removedEdge.src).toBe(1);
|
|
174
|
+
}
|
|
175
|
+
expect(edgeAfterRemoval).toBeNull();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('Topological sort', () => {
|
|
179
|
+
const sorted = myGraph.topologicalSort();
|
|
180
|
+
|
|
181
|
+
expect(sorted).toBeInstanceOf(Array);
|
|
182
|
+
if (sorted && sorted.length > 0) {
|
|
183
|
+
expect(sorted.length).toBe(9);
|
|
184
|
+
if (sorted[0] instanceof MyVertex) expect(sorted[0].data).toBe('data9');
|
|
185
|
+
sorted[3] instanceof MyVertex && expect(sorted[3].data).toBe('data6');
|
|
186
|
+
sorted[8] instanceof MyVertex && expect(sorted[8].id).toBe(1);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('Minimum path between vertices', () => {
|
|
191
|
+
myGraph.addVertex(new MyVertex(1, 'data1'));
|
|
192
|
+
myGraph.addVertex(new MyVertex(2, 'data2'));
|
|
193
|
+
myGraph.addEdge(new MyEdge(1, 2, 10, 'edge-data1-2'));
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('All paths between vertices', () => {
|
|
197
|
+
// Add vertices and edges as needed for this test
|
|
198
|
+
myGraph.addVertex(new MyVertex(1, 'data1'));
|
|
199
|
+
myGraph.addVertex(new MyVertex(2, 'data2'));
|
|
200
|
+
myGraph.addEdge(new MyEdge(1, 2, 10, 'edge-data1-2'));
|
|
201
|
+
|
|
202
|
+
// Add expect statements here to verify the allPaths
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe('Inherit from DirectedGraph and perform operations test2.', () => {
|
|
207
|
+
const myGraph = new MyDirectedGraph<MyVertex<string>, MyEdge<string>>();
|
|
208
|
+
|
|
209
|
+
it('should test graph operations', () => {
|
|
210
|
+
const vertex1 = new MyVertex(1, 'data1');
|
|
211
|
+
const vertex2 = new MyVertex(2, 'data2');
|
|
212
|
+
const vertex3 = new MyVertex(3, 'data3');
|
|
213
|
+
const vertex4 = new MyVertex(4, 'data4');
|
|
214
|
+
const vertex5 = new MyVertex(5, 'data5');
|
|
215
|
+
const vertex6 = new MyVertex(6, 'data6');
|
|
216
|
+
const vertex7 = new MyVertex(7, 'data7');
|
|
217
|
+
const vertex8 = new MyVertex(8, 'data8');
|
|
218
|
+
const vertex9 = new MyVertex(9, 'data9');
|
|
219
|
+
myGraph.addVertex(vertex1);
|
|
220
|
+
myGraph.addVertex(vertex2);
|
|
221
|
+
myGraph.addVertex(vertex3);
|
|
222
|
+
myGraph.addVertex(vertex4);
|
|
223
|
+
myGraph.addVertex(vertex5);
|
|
224
|
+
myGraph.addVertex(vertex6);
|
|
225
|
+
myGraph.addVertex(vertex7);
|
|
226
|
+
myGraph.addVertex(vertex8);
|
|
227
|
+
myGraph.addVertex(vertex9);
|
|
228
|
+
|
|
229
|
+
myGraph.addEdge(new MyEdge(1, 2, 10, 'edge-data1-2'));
|
|
230
|
+
myGraph.addEdge(new MyEdge(2, 1, 20, 'edge-data2-1'));
|
|
231
|
+
|
|
232
|
+
expect(myGraph.getEdge(1, 2)).toBeTruthy();
|
|
233
|
+
expect(myGraph.getEdge(2, 1)).toBeTruthy();
|
|
234
|
+
expect(myGraph.getEdge(1, '100')).toBeFalsy();
|
|
235
|
+
|
|
236
|
+
myGraph.removeEdgeSrcToDest(1, 2);
|
|
237
|
+
expect(myGraph.getEdge(1, 2)).toBeFalsy();
|
|
238
|
+
|
|
239
|
+
myGraph.addEdge(3, 1, 3, 'edge-data-3-1');
|
|
240
|
+
|
|
241
|
+
myGraph.addEdge(1, 9, 19, 'edge-data1-9');
|
|
242
|
+
|
|
243
|
+
myGraph.addEdge(9, 7, 97, 'edge-data9-7');
|
|
244
|
+
|
|
245
|
+
myGraph.addEdge(7, 9, 79, 'edge-data7-9');
|
|
246
|
+
|
|
247
|
+
myGraph.addEdge(1, 4, 14, 'edge-data1-4');
|
|
248
|
+
|
|
249
|
+
myGraph.addEdge(4, 7, 47, 'edge-data4-7');
|
|
250
|
+
|
|
251
|
+
myGraph.addEdge(1, 2, 12, 'edge-data1-2');
|
|
252
|
+
|
|
253
|
+
myGraph.addEdge(2, 3, 23, 'edge-data2-3');
|
|
254
|
+
|
|
255
|
+
myGraph.addEdge(3, 5, 35, 'edge-data3-5');
|
|
256
|
+
|
|
257
|
+
myGraph.addEdge(5, 7, 57, 'edge-data5-7');
|
|
258
|
+
|
|
259
|
+
myGraph.addEdge(new MyEdge(7, 3, 73, 'edge-data7-3'));
|
|
260
|
+
const topologicalSorted = myGraph.topologicalSort();
|
|
261
|
+
expect(topologicalSorted).toBeNull();
|
|
262
|
+
|
|
263
|
+
const minPath1to7 = myGraph.getMinPathBetween(1, 7);
|
|
264
|
+
|
|
265
|
+
expect(minPath1to7).toBeInstanceOf(Array);
|
|
266
|
+
if (minPath1to7 && minPath1to7.length > 0) {
|
|
267
|
+
expect(minPath1to7).toHaveLength(3);
|
|
268
|
+
expect(minPath1to7[0]).toBeInstanceOf(MyVertex);
|
|
269
|
+
expect(minPath1to7[0].id).toBe(1);
|
|
270
|
+
expect(minPath1to7[1].id).toBe(9);
|
|
271
|
+
expect(minPath1to7[2].id).toBe(7);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const fordResult1 = myGraph.bellmanFord(1);
|
|
275
|
+
expect(fordResult1).toBeTruthy();
|
|
276
|
+
expect(fordResult1.hasNegativeCycle).toBeUndefined();
|
|
277
|
+
const {distMap, preMap, paths, min, minPath} = fordResult1;
|
|
278
|
+
expect(distMap).toBeInstanceOf(Map);
|
|
279
|
+
expect(distMap.size).toBe(9);
|
|
280
|
+
expect(distMap.get(vertex1)).toBe(0);
|
|
281
|
+
expect(distMap.get(vertex2)).toBe(12);
|
|
282
|
+
expect(distMap.get(vertex3)).toBe(35);
|
|
283
|
+
expect(distMap.get(vertex4)).toBe(14);
|
|
284
|
+
expect(distMap.get(vertex5)).toBe(70);
|
|
285
|
+
expect(distMap.get(vertex6)).toBe(Infinity);
|
|
286
|
+
expect(distMap.get(vertex7)).toBe(61);
|
|
287
|
+
expect(distMap.get(vertex8)).toBe(Infinity);
|
|
288
|
+
expect(distMap.get(vertex9)).toBe(19);
|
|
289
|
+
|
|
290
|
+
expect(preMap).toBeInstanceOf(Map);
|
|
291
|
+
expect(preMap.size).toBe(0);
|
|
292
|
+
|
|
293
|
+
expect(paths).toBeInstanceOf(Array);
|
|
294
|
+
expect(paths.length).toBe(0);
|
|
295
|
+
expect(min).toBe(Infinity);
|
|
296
|
+
expect(minPath).toBeInstanceOf(Array);
|
|
297
|
+
|
|
298
|
+
const floydResult = myGraph.floyd();
|
|
299
|
+
expect(floydResult).toBeTruthy();
|
|
300
|
+
if (floydResult) {
|
|
301
|
+
const {costs, predecessor} = floydResult;
|
|
302
|
+
expect(costs).toBeInstanceOf(Array);
|
|
303
|
+
expect(costs.length).toBe(9);
|
|
304
|
+
expect(costs[0]).toEqual([32, 12, 35, 14, 70, Infinity, 61, Infinity, 19]);
|
|
305
|
+
expect(costs[1]).toEqual([20, 32, 23, 34, 58, Infinity, 81, Infinity, 39]);
|
|
306
|
+
expect(costs[2]).toEqual([3, 15, 38, 17, 35, Infinity, 64, Infinity, 22]);
|
|
307
|
+
expect(costs[3]).toEqual([123, 135, 120, 137, 155, Infinity, 47, Infinity, 126]);
|
|
308
|
+
expect(costs[4]).toEqual([133, 145, 130, 147, 165, Infinity, 57, Infinity, 136]);
|
|
309
|
+
expect(costs[5]).toEqual([
|
|
310
|
+
Infinity,
|
|
311
|
+
Infinity,
|
|
312
|
+
Infinity,
|
|
313
|
+
Infinity,
|
|
314
|
+
Infinity,
|
|
315
|
+
Infinity,
|
|
316
|
+
Infinity,
|
|
317
|
+
Infinity,
|
|
318
|
+
Infinity
|
|
319
|
+
]);
|
|
320
|
+
expect(costs[6]).toEqual([76, 88, 73, 90, 108, Infinity, 137, Infinity, 79]);
|
|
321
|
+
expect(costs[7]).toEqual([
|
|
322
|
+
Infinity,
|
|
323
|
+
Infinity,
|
|
324
|
+
Infinity,
|
|
325
|
+
Infinity,
|
|
326
|
+
Infinity,
|
|
327
|
+
Infinity,
|
|
328
|
+
Infinity,
|
|
329
|
+
Infinity,
|
|
330
|
+
Infinity
|
|
331
|
+
]);
|
|
332
|
+
expect(costs[8]).toEqual([173, 185, 170, 187, 205, Infinity, 97, Infinity, 176]);
|
|
333
|
+
|
|
334
|
+
expect(predecessor).toBeInstanceOf(Array);
|
|
335
|
+
expect(predecessor.length).toBe(9);
|
|
336
|
+
expect(predecessor[0]).toEqual([vertex2, null, vertex2, null, vertex3, null, vertex4, null, null]);
|
|
337
|
+
expect(predecessor[1]).toEqual([null, vertex1, null, vertex1, vertex3, null, vertex4, null, vertex1]);
|
|
338
|
+
expect(predecessor[5]).toEqual([null, null, null, null, null, null, null, null, null]);
|
|
339
|
+
expect(predecessor[7]).toEqual([null, null, null, null, null, null, null, null, null]);
|
|
340
|
+
expect(predecessor[8]).toEqual([vertex7, vertex7, vertex7, vertex7, vertex7, null, null, null, vertex7]);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const dijkstraRes12tt = myGraph.dijkstra(1, 2, true, true);
|
|
344
|
+
|
|
345
|
+
expect(dijkstraRes12tt).toBeTruthy();
|
|
346
|
+
if (dijkstraRes12tt) {
|
|
347
|
+
const {distMap, minDist, minPath, paths} = dijkstraRes12tt;
|
|
348
|
+
expect(distMap).toBeInstanceOf(Map);
|
|
349
|
+
expect(distMap.size).toBe(9);
|
|
350
|
+
expect(distMap.get(vertex1)).toBe(0);
|
|
351
|
+
expect(distMap.get(vertex2)).toBe(12);
|
|
352
|
+
expect(distMap.get(vertex3)).toBe(Infinity);
|
|
353
|
+
expect(distMap.get(vertex4)).toBe(14);
|
|
354
|
+
expect(distMap.get(vertex5)).toBe(Infinity);
|
|
355
|
+
expect(distMap.get(vertex6)).toBe(Infinity);
|
|
356
|
+
expect(distMap.get(vertex7)).toBe(Infinity);
|
|
357
|
+
expect(distMap.get(vertex8)).toBe(Infinity);
|
|
358
|
+
expect(distMap.get(vertex9)).toBe(19);
|
|
359
|
+
|
|
360
|
+
expect(minDist).toBe(12);
|
|
361
|
+
expect(minPath).toBeInstanceOf(Array);
|
|
362
|
+
expect(minPath.length).toBe(2);
|
|
363
|
+
expect(minPath[0]).toBe(vertex1);
|
|
364
|
+
expect(minPath[1]).toBe(vertex2);
|
|
365
|
+
|
|
366
|
+
expect(paths).toBeInstanceOf(Array);
|
|
367
|
+
expect(paths.length).toBe(9);
|
|
368
|
+
expect(paths[0]).toBeInstanceOf(Array);
|
|
369
|
+
expect(paths[0][0]).toBe(vertex1);
|
|
370
|
+
|
|
371
|
+
expect(paths[1]).toBeInstanceOf(Array);
|
|
372
|
+
expect(paths[1][0]).toBe(vertex1);
|
|
373
|
+
expect(paths[1][1]).toBe(vertex2);
|
|
374
|
+
|
|
375
|
+
expect(paths[2]).toBeInstanceOf(Array);
|
|
376
|
+
expect(paths[2][0]).toBe(vertex3);
|
|
377
|
+
expect(paths[3]).toBeInstanceOf(Array);
|
|
378
|
+
expect(paths[3][0]).toBe(vertex1);
|
|
379
|
+
expect(paths[3][1]).toBe(vertex4);
|
|
380
|
+
expect(paths[4]).toBeInstanceOf(Array);
|
|
381
|
+
expect(paths[4][0]).toBe(vertex5);
|
|
382
|
+
|
|
383
|
+
expect(paths[5]).toBeInstanceOf(Array);
|
|
384
|
+
expect(paths[5][0]).toBe(vertex6);
|
|
385
|
+
expect(paths[6]).toBeInstanceOf(Array);
|
|
386
|
+
expect(paths[6][0]).toBe(vertex7);
|
|
387
|
+
expect(paths[7]).toBeInstanceOf(Array);
|
|
388
|
+
expect(paths[7][0]).toBe(vertex8);
|
|
389
|
+
expect(paths[8]).toBeInstanceOf(Array);
|
|
390
|
+
expect(paths[8][0]).toBe(vertex1);
|
|
391
|
+
expect(paths[8][1]).toBe(vertex9);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const dijkstraRes1ntt = myGraph.dijkstra(1, null, true, true);
|
|
395
|
+
|
|
396
|
+
expect(dijkstraRes1ntt).toBeTruthy();
|
|
397
|
+
if (dijkstraRes1ntt) {
|
|
398
|
+
const {distMap, minDist, minPath, paths} = dijkstraRes1ntt;
|
|
399
|
+
expect(distMap).toBeInstanceOf(Map);
|
|
400
|
+
expect(distMap.size).toBe(9);
|
|
401
|
+
expect(distMap.get(vertex1)).toBe(0);
|
|
402
|
+
expect(distMap.get(vertex2)).toBe(12);
|
|
403
|
+
expect(distMap.get(vertex3)).toBe(35);
|
|
404
|
+
expect(distMap.get(vertex4)).toBe(14);
|
|
405
|
+
expect(distMap.get(vertex5)).toBe(70);
|
|
406
|
+
expect(distMap.get(vertex6)).toBe(Infinity);
|
|
407
|
+
expect(distMap.get(vertex7)).toBe(61);
|
|
408
|
+
expect(distMap.get(vertex8)).toBe(Infinity);
|
|
409
|
+
expect(distMap.get(vertex9)).toBe(19);
|
|
410
|
+
|
|
411
|
+
expect(minDist).toBe(12);
|
|
412
|
+
expect(minPath).toBeInstanceOf(Array);
|
|
413
|
+
expect(minPath.length).toBe(2);
|
|
414
|
+
expect(minPath[0]).toBe(vertex1);
|
|
415
|
+
expect(minPath[1]).toBe(vertex2);
|
|
416
|
+
|
|
417
|
+
expect(paths).toBeInstanceOf(Array);
|
|
418
|
+
expect(paths.length).toBe(9);
|
|
419
|
+
expect(paths[0]).toBeInstanceOf(Array);
|
|
420
|
+
expect(paths[0][0]).toBe(vertex1);
|
|
421
|
+
|
|
422
|
+
expect(paths[1]).toBeInstanceOf(Array);
|
|
423
|
+
expect(paths[1][0]).toBe(vertex1);
|
|
424
|
+
expect(paths[1][1]).toBe(vertex2);
|
|
425
|
+
|
|
426
|
+
expect(paths[2]).toBeInstanceOf(Array);
|
|
427
|
+
expect(paths[2][0]).toBe(vertex1);
|
|
428
|
+
expect(paths[2][1]).toBe(vertex2);
|
|
429
|
+
expect(paths[2][2]).toBe(vertex3);
|
|
430
|
+
|
|
431
|
+
expect(paths[3]).toBeInstanceOf(Array);
|
|
432
|
+
expect(paths[3][0]).toBe(vertex1);
|
|
433
|
+
expect(paths[3][1]).toBe(vertex4);
|
|
434
|
+
|
|
435
|
+
expect(paths[4]).toBeInstanceOf(Array);
|
|
436
|
+
expect(paths[4][0]).toBe(vertex1);
|
|
437
|
+
expect(paths[4][1]).toBe(vertex2);
|
|
438
|
+
expect(paths[4][2]).toBe(vertex3);
|
|
439
|
+
expect(paths[4][3]).toBe(vertex5);
|
|
440
|
+
|
|
441
|
+
expect(paths[5]).toBeInstanceOf(Array);
|
|
442
|
+
expect(paths[5][0]).toBe(vertex6);
|
|
443
|
+
|
|
444
|
+
expect(paths[6]).toBeInstanceOf(Array);
|
|
445
|
+
expect(paths[6][0]).toBe(vertex1);
|
|
446
|
+
expect(paths[6][1]).toBe(vertex4);
|
|
447
|
+
expect(paths[6][2]).toBe(vertex7);
|
|
448
|
+
|
|
449
|
+
expect(paths[7]).toBeInstanceOf(Array);
|
|
450
|
+
expect(paths[7][0]).toBe(vertex8);
|
|
451
|
+
|
|
452
|
+
expect(paths[8]).toBeInstanceOf(Array);
|
|
453
|
+
expect(paths[8][0]).toBe(vertex1);
|
|
454
|
+
expect(paths[8][1]).toBe(vertex9);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const dijkstraWithoutHeapRes1ntt = myGraph.dijkstraWithoutHeap(1, null, true, true);
|
|
458
|
+
expect(dijkstraWithoutHeapRes1ntt).toBeTruthy();
|
|
459
|
+
if (dijkstraWithoutHeapRes1ntt) {
|
|
460
|
+
const {distMap, minDist, minPath, paths} = dijkstraWithoutHeapRes1ntt;
|
|
461
|
+
expect(distMap).toBeInstanceOf(Map);
|
|
462
|
+
expect(distMap.size).toBe(9);
|
|
463
|
+
expect(distMap.get(vertex1)).toBe(0);
|
|
464
|
+
expect(distMap.get(vertex2)).toBe(12);
|
|
465
|
+
expect(distMap.get(vertex3)).toBe(35);
|
|
466
|
+
expect(distMap.get(vertex4)).toBe(14);
|
|
467
|
+
expect(distMap.get(vertex5)).toBe(70);
|
|
468
|
+
expect(distMap.get(vertex6)).toBe(Infinity);
|
|
469
|
+
expect(distMap.get(vertex7)).toBe(61);
|
|
470
|
+
expect(distMap.get(vertex8)).toBe(Infinity);
|
|
471
|
+
expect(distMap.get(vertex9)).toBe(19);
|
|
472
|
+
|
|
473
|
+
expect(minDist).toBe(12);
|
|
474
|
+
expect(minPath).toBeInstanceOf(Array);
|
|
475
|
+
expect(minPath.length).toBe(2);
|
|
476
|
+
expect(minPath[0]).toBe(vertex1);
|
|
477
|
+
expect(minPath[1]).toBe(vertex2);
|
|
478
|
+
|
|
479
|
+
expect(paths).toBeInstanceOf(Array);
|
|
480
|
+
expect(paths.length).toBe(9);
|
|
481
|
+
expect(paths[0]).toBeInstanceOf(Array);
|
|
482
|
+
expect(paths[0][0]).toBe(vertex1);
|
|
483
|
+
|
|
484
|
+
expect(paths[1]).toBeInstanceOf(Array);
|
|
485
|
+
expect(paths[1][0]).toBe(vertex1);
|
|
486
|
+
expect(paths[1][1]).toBe(vertex2);
|
|
487
|
+
|
|
488
|
+
expect(paths[2]).toBeInstanceOf(Array);
|
|
489
|
+
expect(paths[2][0]).toBe(vertex1);
|
|
490
|
+
expect(paths[2][1]).toBe(vertex2);
|
|
491
|
+
expect(paths[2][2]).toBe(vertex3);
|
|
492
|
+
|
|
493
|
+
expect(paths[3]).toBeInstanceOf(Array);
|
|
494
|
+
expect(paths[3][0]).toBe(vertex1);
|
|
495
|
+
expect(paths[3][1]).toBe(vertex4);
|
|
496
|
+
|
|
497
|
+
expect(paths[4]).toBeInstanceOf(Array);
|
|
498
|
+
expect(paths[4][0]).toBe(vertex1);
|
|
499
|
+
expect(paths[4][1]).toBe(vertex2);
|
|
500
|
+
expect(paths[4][2]).toBe(vertex3);
|
|
501
|
+
expect(paths[4][3]).toBe(vertex5);
|
|
502
|
+
|
|
503
|
+
expect(paths[5]).toBeInstanceOf(Array);
|
|
504
|
+
expect(paths[5][0]).toBe(vertex6);
|
|
505
|
+
|
|
506
|
+
expect(paths[6]).toBeInstanceOf(Array);
|
|
507
|
+
expect(paths[6][0]).toBe(vertex1);
|
|
508
|
+
expect(paths[6][1]).toBe(vertex4);
|
|
509
|
+
expect(paths[6][2]).toBe(vertex7);
|
|
510
|
+
|
|
511
|
+
expect(paths[7]).toBeInstanceOf(Array);
|
|
512
|
+
expect(paths[7][0]).toBe(vertex8);
|
|
513
|
+
|
|
514
|
+
expect(paths[8]).toBeInstanceOf(Array);
|
|
515
|
+
expect(paths[8][0]).toBe(vertex1);
|
|
516
|
+
expect(paths[8][1]).toBe(vertex9);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
5
519
|
});
|