7

I have some reasonably small finite posets (on less than 20 points) and would like to iterate over all "downsets" in the poset, where a downset is a set closed under ≤ (so if x in X, and y ≤ x, then y in X). A downset can be specified (and for my purposes, is specified) by an antichain (a set of incomparable elements, the maximum elements of the downset).

I would therefore like to iterate over all antichains in the poset. The poset is small enough to iterate over all subsets, but I think one can do much better than this.

What are some efficient algorithms to iterate over the antichains of a finite poset?

The poset can be given (at your choice) by its transitive reduction (“Hasse diagram” or “covering relation”) or by the list of principle downsets.

Jack Schmidt
  • 56,967
  • Here is a paper that proves that the problem is #P-complete, which means that for large posets there is no general algorithm that would work fast (unless...): http://epubs.siam.org/doi/abs/10.1137/0212053 – domotorp Nov 20 '17 at 08:19

1 Answers1

4

The obvious greedy backtracking approach seems to work quite well here. Order all elements arbitrarily. For each element in order try not putting it in the anti-chain, and after your done with those possibilities try putting it in the anti-chain; in either case continue recursively with the next element until all elements are either in or out. The trick that makes this faster than just trying all subsets, is that every time you do put an element $x$ into the subset, you can filter the remaining elements by throwing out those that are comparable with $x$. The elements thrown out are not considered at all while $x$ is "in". It is useful to store the set of remaining (incomparable) elements at the point when $x$ was added, as you can restore it as the set of candidates whenever backtracking at a later point in time when $x$ is the last element that remains in the antichain.

At no point your search tree will go into a sterile branch (with no solutions), because the elements that are in so far do constitute a valid antichain. This means the running time is bounded by a constant (the depth) times the number of anti-chains that are there to be found; one cannot hope to do better unless there is some mathematical argument that counts the antichains without generating them.