dlx

Knuth's Dancing Links algorithm for the exact cover problem

npm install dlx
5 downloads in the last week
9 downloads in the last month

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

npm loves you