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>
This commit is contained in:
Vedas Dixit
2023-10-24 12:18:59 +05:30
committed by GitHub
parent 7d7f109e6f
commit fb134b10b0
3 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
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();
});
});