mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-12-19 06:58:15 +08:00
* 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>
24 lines
524 B
JavaScript
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();
|
|
});
|
|
});
|