Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

dlx

jlaire12.7kMIT0.2.1

Knuth's Dancing Links algorithm for the exact cover problem

dancing links, dlx, exact cover, algorithm

readme

dlx

An implementation of Knuth's Dancing Links algorithm for the exact cover problem.

Usage:

var dlx = require("dlx");
var matrix = [
    [0, 0, 1, 0, 1, 1, 0],
    [1, 0, 0, 1, 0, 0, 1],
    [0, 1, 1, 0, 0, 1, 0],
    [1, 0, 0, 1, 0, 0, 0],
    [0, 1, 0, 0, 0, 0, 1],
    [0, 0, 0, 1, 1, 0, 1],
];

var solutions = dlx.solve(matrix);
// solutions == [[0, 3, 4]];

Install dependencies: npm install

Run tests: npm test