Fix tests.

This commit is contained in:
Oleksii Trekhleb 2018-08-17 10:31:18 +03:00
parent 980601295d
commit 983492115d
2 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ describe('prim', () => {
expect(minimumSpanningTree.getWeight()).toBe(24); expect(minimumSpanningTree.getWeight()).toBe(24);
expect(minimumSpanningTree.getAllVertices().length).toBe(graph.getAllVertices().length); expect(minimumSpanningTree.getAllVertices().length).toBe(graph.getAllVertices().length);
expect(minimumSpanningTree.getAllEdges().length).toBe(graph.getAllVertices().length - 1); expect(minimumSpanningTree.getAllEdges().length).toBe(graph.getAllVertices().length - 1);
expect(minimumSpanningTree.toString()).toBe('A,B,D,C,E,F,G'); expect(minimumSpanningTree.toString()).toBe('A,B,C,E,D,F,G');
}); });
it('should find minimum spanning tree for simple graph', () => { it('should find minimum spanning tree for simple graph', () => {

View File

@ -257,9 +257,9 @@ export default class Heap {
nextIndex = this.getLeftChildIndex(currentIndex); nextIndex = this.getLeftChildIndex(currentIndex);
} }
if (!this.pairIsInCorrectOrder( if (this.pairIsInCorrectOrder(
this.heapContainer[nextIndex],
this.heapContainer[currentIndex], this.heapContainer[currentIndex],
this.heapContainer[nextIndex],
)) { )) {
break; break;
} }