Lably
Skip to content

Exact cover

Partition into subsets from a given family

  • 17 min read
  • 6 chapters

Related on Lably

Through Mathematics, Combinatorics and Subset

The exact cover problem to find an exact cover is a kind of constraint satisfaction problem. The elements of S represent choices and the elements of X represent constraints. It is NP-hard and has a variety of applications, ranging from the optimization of airline flight schedules, cloud computing, and electronic circuit design.

An exact cover problem involves the relation contains between subsets and elements. But an exact cover problem can be represented by any heterogeneous relation between a set of choices and a set of constraints. For example, an exact cover problem is equivalent to an exact hitting set problem, an incidence matrix, or a bipartite graph.

In computer science, the exact cover problem is a decision problem to determine if an exact cover exists. The exact cover problem is NP-complete and is one of Karp's 21 NP-complete problems. It is NP-complete even when each subset in S contains exactly three elements; this restricted problem is known as exact cover by 3-sets, often abbreviated X3C.

Knuth's Algorithm X is an algorithm that finds all solutions to an exact cover problem. DLX is the name given to Algorithm X when it is implemented efficiently using Donald Knuth's Dancing Links technique on a computer.

The exact cover problem can be generalized slightly to involve not only exactly-once constraints but also at-most-once constraints.

Finding Pentomino tilings and solving Sudoku are noteworthy examples of exact cover problems. The n queens problem is a generalized exact cover problem.

Formal definition

Given a collection S of subsets of a set X, an exact cover of X is a subcollection S∗ of S that satisfies two conditions:

  • The intersection of any two distinct subsets in S∗ is empty, i.e., the subsets in S∗ are pairwise disjoint. In other words, each element in X is contained in at most one subset in S∗.
  • The union of the subsets in S∗ is X, i.e., the subsets in S∗ cover X. In other words, each element in X is contained in at least one subset in S∗.

In short, an exact cover is exact in the sense that each element in X is contained in exactly one subset in S∗.

Equivalently, an exact cover of X is a subcollection S∗ of S that partitions X.

For an exact cover of X to exist, it is necessary that:

  • The union of the subsets in S is X. In other words, each element in X is contained in at least one subset in S.

If the empty set ∅ is contained in S, then it makes no difference whether or not it is in any exact cover. Thus it is typical to assume that:

  • The empty set is not in S∗. In other words, each subset in S∗ contains at least one element.

Sign in to keep reading

5 more chapters are free with a Lably account.

More in Computing and communication