# dlx

> Knuth's Dancing Links algorithm for the exact cover problem

Latest version **0.2.1** (published 2013-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install dlx
pnpm add dlx
yarn add dlx
bun add dlx
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2013-05-28 |
| First published | 2013-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Johannes Laire |
| Maintainers | jlaire |
| Keywords | dancing links, dlx, exact cover, algorithm |

## Links

- npm: https://www.npmjs.com/package/dlx
- Repository: https://github.com/jlaire/dlx.js
- npm.io page: https://npm.io/package/dlx

## Dependencies (1)

- [underscore](https://npm.io/package/underscore.md) *

## Recent versions

- 0.2.1 (latest) — 2013-05-28
- 0.2.0 — 2013-05-27
- 0.1.1 — 2013-05-27
- 0.1.0 — 2013-05-27

## README

dlx
===

An implementation of Knuth's Dancing Links algorithm for the exact cover
problem. Many combinatoric problems, such as Sudoku and N-queens, can be
reduced to exact cover problems and solved with the same algorithm.

Given a two-dimensional array of booleans, the problem is to select a subset of
the rows that sums to [1, 1, 1, ..., 1]. In other words: for every column of
the matrix, exactly one of the chosen rows must contain a one.

Usage:
```
var dlx = require("dlx");
var problem = [
	[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(problem);
// solutions is [[0, 3, 4]]
```

Run tests:
```
$ npm install
$ npm test
```

See more:

- [Dancing Links on Wikipedia](http://en.wikipedia.org/wiki/Dancing_Links)
- [Knuth's paper (PDF)](http://arxiv.org/pdf/cs.DS/0011047.pdf)

---
_Source: https://npm.io/package/dlx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
