Files
JavaScript/Backtracking/tests/MColoringProblem.test.js
Vedas Dixit fb134b10b0 Implemented M Coloring Problem (#1562)
* Implemented M Coloring Problem

* Implemented M Coloring Problem

* Switch to a functional approach instead of class-based.
Use proper JSDoc comments.
Refine the comments and remove redundancies.

* Updated Documentation in README.md

* Proper JSDoc comment

---------

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
Co-authored-by: Lars Müller <34514239+appgurueu@users.noreply.github.com>
2023-10-24 06:48:59 +00:00

24 lines
524 B
JavaScript

import { mColoring } from '../MColoringProblem';
describe('MColoringProblem', () => {
it('should color a triangle with 3 colors', () => {
const graph = [
[0, 1, 1],
[1, 0, 1],
[1, 1, 0]
];
const solution = mColoring(graph, 3);
expect(solution).not.toBeNull();
});
it('should not color a triangle with 2 colors', () => {
const graph = [
[0, 1, 1],
[1, 0, 1],
[1, 1, 0]
];
const solution = mColoring(graph, 2);
expect(solution).toBeNull();
});
});