Given a collection of ordered sets, find minimal order-preserving superset

170 Views Asked by At

Say I have some collection of ordered sets $C = \{S_i\}$. Is there an efficient way to determine the minimal ordered set $S^*$ such that each of the original $S_i \subseteq S^*$, with order preserved?

Simple example: $C = \{\{a, b, c\}, \{b, d, f\}, \{b, c, d\}\}$, then $S^* = \{a, b, c, d, f\}$

More complex example: $C = \{\{a, b, c\}, \{b, c, d\}, \{x, a, d\}, \{b, b, a, c\}, \{y, b, c, b\}\}$, then one solution is $S^* = \{y, x, a, b, c, b, a, c, d \}$.

Another example: $C = \{\{a, b, c\}, \{b, a, c\}, \{c, a, b\}, \{b, c, a\}, \{c, b, c\}, \{b, b, c\}\}$, $S^* = \{b, c, a, b, c\}$

The naïve solution is to just concatenate the $S_i$. When $\cap S_i = \emptyset$, then of course this happens to also be the minimal solution.

Perhaps finding some traversal of a digraph representing all elements and their ordering?

1

There are 1 best solutions below

0
On

I've found out that this is known as the shortest common supersequence problem. Research and papers on the topic can be found online using this search term.