mirror of
https://github.com/zrwusa/data-structure-typed.git
synced 2024-11-23 12:54:04 +00:00
[graph] test case refined
This commit is contained in:
parent
a85ea70cee
commit
3596ca53a7
|
@ -161,15 +161,16 @@ describe('UndirectedGraph', () => {
|
|||
const allPaths = graph.getAllPathsBetween('Intersection_1','Intersection_5');
|
||||
expect(allPaths.length).toBe(1000);
|
||||
const minWeightedPathDFS = graph.getMinPathBetween('Intersection_1','Intersection_5', true, true);
|
||||
expect(minWeightedPathDFS?.[0]?.key).toBe('Intersection_1');
|
||||
expect(minWeightedPathDFS?.[5]?.key).toBe('Intersection_42');
|
||||
expect(minWeightedPathDFS?.[8]?.key).toBe('Intersection_18');
|
||||
expect(minWeightedPathDFS?.[27]?.key).toBe('Intersection_6');
|
||||
const minWeightedPath = graph.dijkstra('Intersection_1','Intersection_5', true, true);
|
||||
expect(minWeightedPathDFS?.[0].key).toBe('Intersection_1');
|
||||
expect(minWeightedPathDFS?.[5].key).toBe('Intersection_42');
|
||||
expect(minWeightedPathDFS?.[8].key).toBe('Intersection_18');
|
||||
expect(minWeightedPathDFS?.[31].key).toBe('Intersection_5');
|
||||
expect(minWeightedPath?.minPath?.[0].key).toBe('Intersection_1')
|
||||
expect(minWeightedPath?.minPath?.[1].key).toBe('Intersection_2')
|
||||
expect(minWeightedPath?.minPath?.[2].key).toBe('Intersection_3')
|
||||
expect(minWeightedPath?.minPath?.[3].key).toBe('Intersection_4')
|
||||
expect(minWeightedPath?.minPath?.[4].key).toBe('Intersection_5')
|
||||
|
||||
expect(minWeightedPath?.minPath?.[0]?.key).toBe('Intersection_1')
|
||||
expect(minWeightedPath?.minPath?.[1]?.key).toBe('Intersection_2')
|
||||
expect(minWeightedPath?.minPath?.[2]?.key).toBe('Intersection_3')
|
||||
expect(minWeightedPath?.minPath?.[3]?.key).toBe('Intersection_4')
|
||||
expect(minWeightedPath?.minPath?.[4]?.key).toBe('Intersection_5')
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue