nelsyeung / dlx

Knuth's Algorithm X using Dancing Links written with ES6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DLX

Knuth's Algorithm X using Dancing Links written with ES6. The solver code are commented to match the original paper to make it easier to learn and understand.

Getting started

npm install @nelsyeung/dlx

Usage

import dlx from 'dlx';

const 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],
];

const solution = dlx(matrix); // [4, 1, 5]

License

MIT license

About

Knuth's Algorithm X using Dancing Links written with ES6

License:MIT License


Languages

Language:JavaScript 100.0%