Next Article in Journal
Freeway Traffic Congestion Reduction and Environment Regulation via Model Predictive Control
Previous Article in Journal
A New Coding Paradigm for the Primitive Relay Channel

Algorithms 2019, 12(10), 219; https://doi.org/10.3390/a12100219

Article
On Finding Two Posets that Cover Given Linear Orders
1
Department of Computer Science, University of the Philippines Diliman, Quezon City 1101, Philippines
2
Department of Information Sytems and Computer Science, Ateneo De Manila University, Quezon City 1108, Philippines
*
Author to whom correspondence should be addressed.
Received: 13 August 2019 / Accepted: 17 October 2019 / Published: 19 October 2019

Abstract

:
The Poset Cover Problem is an optimization problem where the goal is to determine a minimum set of posets that covers a given set of linear orders. This problem is relevant in the field of data mining, specifically in determining directed networks or models that explain the ordering of objects in a large sequential dataset. It is already known that the decision version of the problem is NP-Hard while its variation where the goal is to determine only a single poset that covers the input is in P. In this study, we investigate the variation, which we call the 2-Poset Cover Problem, where the goal is to determine two posets, if they exist, that cover the given linear orders. We derive properties on posets, which leads to an exact solution for the 2-Poset Cover Problem. Although the algorithm runs in exponential-time, it is still significantly faster than a brute-force solution. Moreover, we show that when the posets being considered are tree-posets, the running-time of the algorithm becomes polynomial, which proves that the more restricted variation, which we called the 2-Tree-Poset Cover Problem, is also in P.
Keywords:
partial order; poset; linear extensions; algorithm; complexity

1. Introduction

A poset is a fundamental concept in mathematics that formalizes the notion of ordering in a collection of objects. Formally, a poset P = ( V , P ) is a pair consisting of a finite set V and a binary relation P V × V that is reflexive, antisymmetric and transitive. In this paper, we only consider strict posets, written here as P = ( V , < P ) , where the binary relation is antisymmetric and transitive but irreflexive. An example of a strict poset is shown in Figure 1a. From here on, all posets being discussed refer to strict posets.
Every poset P = ( V , < P ) also corresponds to a directed acyclic graph (DAG) G = ( V , A ) having the vertex set V and the edge set A = { ( u , v ) | ( u , v ) < P } . However, a poset is more commonly illustrated using a Hasse diagram that corresponds to the transitive reduction of the DAG. Figure 1b shows the Hasse diagram H ( P ) of the poset P defined in Figure 1a.
The binary relation in a poset is called a partial order since not all pairs need to be related. For the case wherein all pairs are related, the binary relation is called a total order, and the poset is said to be a totally ordered set or a linear order. Formally, a linear order L = ( V , < L ) is a poset where for all distinct elements u , v V , either u < L v or v < L u . Basically, we can treat a linear order as a permutation of the elements in V. Moreover, a linear order L = ( V , < L ) is said to be a linear extension of poset P if and only if < P < L . The set of all linear extensions of P is denoted by L ( P ) . For example, Figure 1c shows the set of linear extensions of the poset P in Figure 1a.
Generating the linear extension of a poset, which is also equivalent to getting all the topological sorting of a directed acyclic graph, is a well studied problem. Algorithms [1,2] on this show that we can generate each successive linear extension or topological sorting in polynomial-time. The reverse problem where the given is a set of linear extensions, or more technically a set of linear orders, and the goal is to determine the set of posets that generate the given linear orders is the Poset Cover Problem. Formally, the Poset Cover Problem is defined as follows [3]:
  • Poset Cover Problem
  • Instance: A set Y = { L 1 , L 2 , , L m } of linear orders over the set V = { 1 , 2 , 3 , , n } .
  • Solution: A set P * = { P 1 , P 2 , , P k } of posets where P i P * L ( P i ) = Y and k is minimum.
The Poset Cover Problem finds application in data mining where there is a massive set of sequential data and the goal is to determine directed networks that explain the ordering of objects in the sequential data. A simple example of this is in marketing, when the business wants to generate a directed process model from the logs of customers’ purchases of their products. The logs can be treated as linear orders of the products. Determining directed process models, which explains the purchasing behavior of the customers, can then be represented as getting a set of posets that generate the linear orders (logs). The process model can then be used to predict other customers’ future purchases, and the business could develop marketing campaigns from it. Similar to this kind of data mining, the problem is also relevant in other areas such as in neuroscience [4], chemical engineering [5], epidemiology [6], paleontology [7,8], and systems biology [9].
The decision version of the Poset Cover Problem has been shown to be NP-Hard [3]. To deepen the knowledge about the Poset Cover Problem, efforts in the past have focused on studying constrained cases of the problem and trying to draw boundaries of the cases that are in P and cases that are NP-Hard. There are essentially two ways in which the problem can be restricted or constrained. The first is to consider only a specific number of posets, say k. The problem when k = 1 , or the 1-Poset Cover Problem, is in P [10]. The computational complexity of the problem when k = 2 , or the 2-Poset Cover Problem, is not yet known. What have been devised are heuristics for the 2-Poset Cover Problem [11]. The other way of restricting the problem is to consider only a specific class of posets according to their Hasse diagram, such as a tree-poset. The poset in Figure 1 is an example of a tree-poset since its Hasse diagram is a tree. The restricted cases of the Poset Cover Problem are similarly important as there may also be instances wherein the class of posets to be reconstructed are known. For example in paleontology, the goal is to construct evolutionary ordering of fossil sites from sequential data about the taxa that occur in each site [7,8]. Evolutionary orderings are usually expressed using trees because evolution starts with an origin and branches out to descendants. Other classes of posets that have been studied are hammock posets and leveled posets [10]. The 2-Tree-Poset Cover Problem then is a contrained variation where the goal is to determine if there exist two tree-posets that cover exactly all of the given set of linear orders.
In our study, we derived properties on posets, which lead to an exact solution for the 2-Poset Cover Problem. The algorithm runs in exponential time. However, if the posets to be considered are tree-posets, the running time of the algorithm becomes polynomial. This proves that the 2-Tree-Poset Cover Problem is also in P.

2. Definitions

We first define here the terms and notations used in the discussion of results.
Definition 1.
ancestors(v,P)
Given a poset P = ( V , < P ) and v V , the a n c e s t o r s ( v , P ) is the set of elements in poset P that precedes v, i.e., a n c e s t o r s ( v , P ) = { a V | a < P v } .
Definition 2.
descendants(v,P)
Given a poset P = ( V , < P ) and v V , the d e s c e n d a n t s ( v , P ) is the set of elements in poset P that succeeds v, i.e., d e s c e n d a n t s ( v , P ) = { d V | v < P d } .
Definition 3.
cover relation P
Given a poset P = ( V , < P ) , its cover relation is P = { ( u , v ) | u < P v and there is no w V where u < P w < P v } .
Definition 4.
cover
The term cover is used in many instances for different objects in the discussion.
Given two elements u , v V of poset P, we say that u covers v if and only if u P v . In this instance, ( u , v ) are also said to be cover pairs in P.
Given a set of linear orders Y and poset P, we say that P covers Y if and only if L ( P ) = Y .
Given a set of linear orders Y and a set of posets P * , we say that P * covers Y if and only if P i P * L ( P i ) = Y .
Definition 5.
Hasse Diagram of Poset H ( P )
A poset P = ( V , < P ) corresponds to a Hasse diagram H ( P ) , which is a directed acyclic graph G with the elements in V as nodes and pairs in the cover relation of P as edges, i.e., G = ( V , P ) .
Definition 6.
Tree Poset
A tree-poset P = ( V , < P ) is a poset whose Hasse diagram is a rooted directed tree with each non-root node being covered by exactly one node.
Definition 7.
parent(v,P)
Given a tree-poset P = ( V , < P ) and v V such that v is not the root node, p a r e n t ( v , P ) is the element u that covers v, i.e., p a r e n t ( v , P ) = u if and only if u P v .
Definition 8.
2-Poset Cover Problem
Instance: A set Y = { L 1 , L 2 , , L m } of linear orders over the set V = { 1 , 2 , 3 , , n } .
Question: Does there exist a pair of distinct posets P 1 = ( V , < P 1 ) and P 2 = ( V , < P 2 ) such that L ( P 1 ) L ( P 2 ) = Y and L ( P 1 ) is neither a subset nor a superset of L ( P 2 ) ?
Definition 9.
2-Tree-Poset Cover Problem
Instance: A set Y = { L 1 , L 2 , , L m } of linear orders over the set V = { 1 , 2 , 3 , , n } .
Question: Does there exist a pair of distinct tree-posets P 1 = ( V , < P 1 ) and P 2 = ( V , < P 2 ) such that L ( P 1 ) L ( P 2 ) = Y and L ( P 1 ) is neither a subset nor a superset of L ( P 2 ) ?
Definition 10.
comparable and incomparable
Given a poset P = ( V , < P ) and elements u , v V , u and v are comparable, denoted by u v if u < P v or v < P u . Otherwise, u and v are incomparable, denoted by u | | P v .

3. Theoretical Bases

Before we discuss the algorithms, we present the following lemmas and theorems that serve as bases in devising the algorithms.
Lemma 1.
Given posets P 1 = ( V , < P 1 ) and P 2 = ( V , < P 2 ) , if < P 1 < P 2 , then L ( P 2 ) L ( P 1 ) .
Proof. 
Let the linear order L be a linear extension of P 2 , i.e., L L ( P 2 ) . By definition of linear extension, < P 2 < L . Since < P 1 < P 2 , then by transitivity, < P 1 < L . This implies that L L ( P 1 ) . Hence, L ( P 2 ) L ( P 1 ) . □
Given a pair that is incomparable in P, say a P b , we know that there are some linear extensions where a < b while b < a in the remaining ones. In other words, we can partition Y into Y 1 = { L L ( P ) | a < L b } and Y 2 = { L L ( P ) | b < L a } . The next theorem shows that there exists posets P 1 = ( V , < P 1 ) , P 2 = ( V , < P 2 ) that cover Y 1 and Y 2 , respectively. Moreover, we can derive the relationship of < P 1 and < P 2 from < P , which is also given in the following theorem.
Theorem 1.
Consider a poset P = ( V , < P ) and distinct elements a , b V where a | | P b . Let Y 1 = { L L ( P ) | a < L b } and Y 2 = { L L ( P ) | b < L a } . Moreover, let
< A = { ( x , y ) | x { a } a n c e s t o r s ( a , P ) , y { b } d e s c e n d a n t s ( b , P ) }
< B = { ( x , y ) | x { b } a n c e s t o r s ( b , P ) , y { a } d e s c e n d a n t s ( a , P ) }
Then, there exist posets P 1 = ( V , < P 1 ) and P 2 = ( V , < P 2 ) where < P 1 = < P < A and < P 2 = < P < B such that L ( P 1 ) = Y 1 and L ( P 2 ) = Y 2 . Moreover, in terms of cover relation,
P 1 = { ( a , b ) } P \ ( { ( u , b ) P | u < P a } { ( a , v ) P | b < P v } )
P 2 = { ( b , a ) } P \ ( { ( u , a ) P | u < P b } { ( b , v ) P | a < P v } ) .
To illustrate the theorem, consider the posets P, P 1 and P 2 with Hasse diagrams in Figure 2. Since 3 | | P 4 , let us take elements 3 and 4 as a and b in the theorem, respectively. If we generate L ( P ) , we have the following linear extensions.
We can partition L ( P ) into two - Y 1 = { L L ( P ) | 3 < L 4 } and Y 2 = { L L ( P ) | 4 < L 3 } . Clearly, Y 1 contains all the linear extensions in the left column while Y 2 contains those in the right column. From the theorem, there exist posets P 1 and P 2 that cover Y 1 and Y 2 , respectively. In our example, they are the posets P 1 = ( V , < P 1 ) and P 2 = ( V , < P 2 ) in Figure 2. Verify that L ( P 1 ) = Y 1 and L ( P 2 ) = Y 2 . Moreover,
< P 1 = < P { ( x , y ) | x { 3 } a n c e s t o r s ( 3 , P ) , y { 4 } d e s c e n d a n t s ( 4 , P ) } = { ( 1 , 3 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 3 , 5 ) , ( 3 , 6 ) , ( 4 , 6 ) , ( 1 , 5 ) , ( 1 , 6 ) , ( 2 , 5 ) , ( 2 , 6 ) } { ( 3 , 4 ) , ( 3 , 6 ) , ( 1 , 4 ) , ( 1 , 6 ) , ( 2 , 4 ) , ( 2 , 6 ) } = { ( 1 , 3 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 3 , 5 ) , ( 3 , 6 ) , ( 4 , 6 ) , ( 1 , 5 ) , ( 1 , 6 ) , ( 2 , 5 ) , ( 2 , 6 ) , ( 3 , 4 ) , ( 1 , 4 ) }
< P 2 = < P { ( x , y ) | x { 4 } a n c e s t o r s ( 4 , P ) , y { 3 } d e s c e n d a n t s ( 3 , P ) } = { ( 1 , 3 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 3 , 5 ) , ( 3 , 6 ) , ( 4 , 6 ) , ( 1 , 5 ) , ( 1 , 6 ) , ( 2 , 5 ) , ( 2 , 6 ) } { ( 4 , 3 ) , ( 4 , 5 ) , ( 4 , 6 ) , ( 2 , 3 ) , ( 2 , 5 ) , ( 2 , 6 ) } = { ( 1 , 3 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 3 , 5 ) , ( 3 , 6 ) , ( 4 , 6 ) , ( 1 , 5 ) , ( 1 , 6 ) , ( 2 , 5 ) , ( 2 , 6 ) , ( 4 , 3 ) , ( 4 , 5 ) }
In terms of cover relation, which is the transitive reduction of < P 1 and < P 2 , we have the following:
P 1 = { ( 3 , 4 ) } P \ ( { ( u , 4 ) P | u < P 3 } { ( 3 , v ) P | 4 < P v } ) = { ( 3 , 4 ) } { ( 1 , 3 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 3 , 5 ) , ( 3 , 6 ) , ( 4 , 6 ) } \ ( { ( 2 , 4 ) } { ( 3 , 6 ) } ) = { ( 3 , 4 ) , ( 1 , 3 ) , ( 2 , 3 ) , ( 3 , 5 ) , ( 4 , 6 ) }
P 2 = { ( 4 , 3 ) } P \ ( { ( u , 3 ) P | u < P 4 } \ { ( 4 , v ) P | 3 < P v } ) = { ( 4 , 3 ) } { ( 1 , 3 ) , ( 2 , 3 ) , ( 2 , 4 ) , ( 3 , 5 ) , ( 3 , 6 ) , ( 4 , 6 ) } \ ( { ( 2 , 3 ) } { ( 4 , 6 ) } ) = { ( 4 , 3 ) , ( 1 , 3 ) , ( 2 , 4 ) , ( 3 , 5 ) , ( 3 , 6 ) }
Proof. 
We first show that P 1 = ( V , < P 1 ) where < P 1 = < P < A is a poset. Since P is a poset, then we know that < P is irreflexive, antisymmetric and transitive. We also know that a and b are distinct elements. An element x cannot be both in a n c e s t o r s ( a , P ) and d e s c e n d a n t s ( b , P ) , otherwise, a and b are related in < P . Hence, we can say that < A is also irreflexive and antisymmetric. To show that < P 1 is transitive, suppose ( x , y ) , ( y , z ) < P 1 , then we have the following cases:
  • ( x , y ) < P and ( y , z ) < P
    By transitive property of poset P, ( x , z ) < P . Hence, ( x , z ) < P 1
  • ( x , y ) A and ( y , z ) A
    By the definition of A, y { a } a n c e s t o r s ( a , P ) and y { b } d e s c e n d a n t s ( b , P ) . It cannot be that y = a or y = b because of the assumption that a and b are distinct. It cannot also be that y a n c e s t o r s ( a , P ) and y d e s c e n d a n t s ( b , P ) , otherwise the assumption that a | | P b is violated. Hence, we can say that this case is not possible.
  • ( x , y ) < P and ( y , z ) A
    By the definition of A, y { a } a n c e s t o r s ( a , P ) and z { b } d e s c e n d a n t s ( b , P ) . If y = a , then x a n c e s t o r s ( a , P ) . Hence ( x , z ) A and thus, ( x , z ) < P 1 . On the other hand, if y a n c e s t o r s ( a , P ) , then ( y , a ) < P . By the transitive property of < P , ( x , a ) < P . In other words, x a n c e s t o r s ( a , P ) . Hence, ( x , z ) A and thus, ( x , z ) < P 1 .
  • ( x , y ) < A and ( y , z ) < P
    By the definition of A, x { a } a n c e s t o r s ( a , P ) and y { b } d e s c e n d a n t s ( b , P ) . If y = b , then z d e s c e n d a n t s ( b , P ) . Hence ( x , z ) A and thus, ( x , z ) < P 1 . On the other hand, if y d e s c e n d a n t s ( b , P ) , then ( b , y ) < P . By the transitive property of < P , ( b , z ) < P . In other words, z d e s c e n d a n t s ( b , P ) . Hence ( x , z ) A and thus, ( x , z ) < P 1 .
From these cases, we can say that < P 1 is transitive. Hence, < P 1 is a poset. In a similar way, we can also show that < P 2 is a poset.
Next, we show that L ( P 1 ) = Y 1 by showing that L ( P 1 ) Y 1 and Y 1 L ( P 1 ) .
To prove the first direction, suppose L L ( P 1 ) . Then < P 1 < L . This implies that a < L b . Since < P < P 1 , then we can also say that < P < L . This means, L L ( P ) . Hence, L Y 1 .
To prove the other direction, suppose L Y 1 . Then, L L ( P ) and a < L b . Now, let x < P 1 y . It suffices to show that x < L y . This clearly holds if x < P y , since L L ( P ) . Otherwise, x < A y , which implies that ( x = a or x < P a ) and ( b = y or b < P y ), whence ( x = a or x < L a ) and ( b = y or b < L y ). In any case, since a < L b , we get x < L y by transitivity.
In a similar way, it can also be shown that L ( P 2 ) = Y 2 .
Now, let us determine the cover relation P 1 < P 1 . We first determine which pairs ( x , y ) < A are cover pairs in P 1 . If ( x , y ) = ( a , b ) , we know that by definition of < A , there exists no w V such that ( a , w ) < A and ( w , b ) < A , otherwise a < P b . Since a P b , then we also know that there exists no w V such that ( a , w ) < A and ( w , b ) < A . Hence, ( a , b ) P 1 . On the other hand, any other value of ( x , y ) in < A will lead to ( x < P 1 a < P 1 b < P 1 y ), ( x = a < P 1 b < P 1 y ) or ( x < P 1 a < P 1 b = y ), which all imply that ( x , y ) P 1 . Hence, the only pair in < A that is covered in P 1 is ( a , b ) . Now, we know that < P corresponds to P . Hence, P 1 is the transitive reduction of { ( a , b ) } P . To get the transitive reduction, we have to elimate pairs in P that are not in P 1 because the addition of ( a , b ) no longer makes them covered. These are the following:
  • u P b where u < P a
    In this case u < P 1 a < P 1 b , hence, ( u , b ) P 1 .
  • ( a P v ) where b < P v
    In this case a < P 1 b < P 1 v , hence, ( a , v ) P 1
Hence, P 1 = { ( a , b ) } P \ { { ( u , b ) P | u < P a } { ( a , v ) P | b < P v } } . In a similar way, we can derive the formula for P 2 . □
Corollary 1.
If the poset P = ( V , < P ) in Theorem 1 is a tree-poset, then Equations (3) and (4) become Equations (5) and (6), respectively.
P 1 = { ( a , b ) } P , if parent ( b , P ) | | P a { ( a , b ) } P \ { ( p a r e n t ( b , P ) , b ) } , if p a r e n t ( b , P ) < P a
P 2 = { ( b , a ) } P , if p a r e n t ( a , P ) | | P b { ( b , a ) } P \ { ( p a r e n t ( a , P ) , a ) } , if p a r e n t ( a , P ) < P b
Proof. 
From Theorem 1, P 1 = { ( a , b ) } P \ ( { ( u , b ) P | u < P a } { ( a , v ) P | b < P v } ) . First, we show that { ( a , v ) P | b < P v } = if P is a tree-poset. Suppose there exists such v where a P v and b < P v . Since, every non-root node in a tree-poset is covered by only one element, then only a covers v. Then it must be that b < P a , so that b < P v . This is a contradiction to the assumption that a | | P b . Hence, { ( a , v ) P | b < P v } = .
Next, we examine the set { ( u , b ) P | u < P a } . If P is a tree-poset, then there exists only one possible u that covers b, which is p a r e n t ( b , P ) . Hence, we have two possibilities. If p a r e n t ( b , P ) < P a then P 1 = { ( a , b ) } P \ { ( p a r e n t ( b , P ) , b ) } . Note that a P p a r e n t ( b , P ) , otherwise a < P b . Hence, the only other condition is when p a r e n t ( b , P ) | | P u . With this condition, Equation (3) then becomes P 1 = P { ( a , b ) } .
We can prove Equation (6) in a similar way. □

4. Algorithm for the 2-Poset Cover Problem

As mentioned earlier, there is already a polynomial-time solution for the 1-Poset Cover Problem [10]. We can determine in O ( m n 2 ) time, where m is the number of linear orders over a base set of n elements, the poset that covers a given set of linear orders. Let us denote the algorithm for the 1-Poset Cover Problem as GeneratePoset. The input to GeneratePoset is a set of linear orders and it returns a poset, if there exists such, that covers the input; otherwise it returns null. Now, for the 2-Poset Cover Problem with input Y , a brute-force algorithm is then to determine Y 1 , Y 2 Y such that Y 1 Y 2 = Y and then use GeneratePoset to determine if there is a poset that covers Y 1 and a poset that covers Y 2 . Since there are 3 m possibilities for values of Y 1 and Y 2 , the brute-force algorithm entails a running time of O ( 3 m m n 2 ) .
Theorem 1 suggests a strategy of partitioning Y . Given a pair ( a , b ) V × V , we can partition Y into Y 1 = { L Y | a < L b } and Y 2 = { L Y | b < L a } . Suppose there exist two posets, say P = ( V , < P ) and P = ( V , < P ) that cover Y . If ( a , b ) < P and ( b , a ) < P , then we just have partitioned Y perfectly because Y 1 = L ( P ) and Y 2 = L ( P ) . Hence, we can determine P and P using GeneratePoset with Y 1 and Y 2 as inputs, respectively. This is executed in Lines 7 and 8 of Algorithm 1. However, such a pair does not always exist. There can be also instances where a P b and a | | P b and vice versa—there also exists a different pair, say ( c , d ) where c | | P d and c P d . Without lost of generality on a P b , suppose a < P b . Then, if we apply the same partitioning strategy, Y 1 = L ( P ) { L L ( P ) | a < L b } and Y 2 = { L L ( P ) | b < L a } . We are not sure if there exists a poset that covers Y 1 , however, we are sure from Theorem 1 that there exists a poset that covers Y 2 , say P 2 . Moreover, with the use of the equations in the Theorem, we can determine or reconstruct the relation of P from P 2 . These are executed in Lines 22–32. We can also determine P in a similar way with the pair ( c , d ) . This is executed in Lines 10–20 in the Algorithm.
Theorem 2.
Algorithm 1 produces a solution to the 2-Poset Cover Problem in O ( 2 n m n + m n 4 + m 2 ) time.
Proof. 
Let P and P be the two different posets that cover Y , i.e., L ( P ) L ( P ) = Y . In the following, we want to show that P and P , if there exist such, can be determined and generated by the 2-Poset Cover Algorithm.
With the assumption that P P means also that < P < P , then there must exist, without loss of generality, at least one ( a , b ) such that ( a , b ) < P but ( a , b ) < P . On the other hand, there must also exist ( c , d ) such that ( c , d ) < P but ( c , d ) < P , otherwise, < P < P and by Lemma 1, Y can be covered by a single poset P .
Let us first take the case where ( a , b ) < P but ( a , b ) < P . With this, we have two further cases.
  • ( b , a ) < P
    In this case, Y 1 = L ( P ) and Y 2 = L ( P ) . Hence, posets P 1 = P and P 2 = P can be generated in Lines 5 and 6, respectively and are returned in Line 8.
  • ( b , a ) < P
    In this case, a | | P b . Hence, there exist linear extensions of P where a < b and linear extensions where b > a . Let E = { L L ( P ) | a < L b } and F = { L L ( P ) | b < L a } . This implies that Y 1 = L ( P ) E and Y 2 = F . Let P 1 and P 2 be the return of GeneratePoset for Y 1 and Y 2 in Lines 4 and 5, respectively.
    We know that P 2 is not null because from Theorem 1 there exists a poset that covers Y 2 . Moreover, we can also reconstruct P from P 2 using Equation (4), i.e., P = P 2 \ { ( b , a ) } { C D } where C = { ( u , a ) P | u < P b } and D = { ( b , v ) P | a < P v } .
    In reconstructing P from P 2 , let P 3 be our working poset. First, we let P 3 = P \ { ( b , a ) } and if L ( P 3 ) Y , then we can already disregard the components { C D } of P . This is because P 2 \ { ( b , a ) } P 2 \ { ( b , a ) } { C D } . With Lemma 1, whatever set of linear orders that are covered by the poset with the later cover relation can be already covered by the poset with the former cover relation. These are executed with the “If” condition in Lines 23–24. Otherwise (the else part), we have to determine C and D. However, in the Algorithm, what we have only generated and know is the relation of P 2 . We do not know P yet hence we also do not know C and D. However, we know that C { ( u , b ) < P } and D { ( a , v ) < P } , and with Equation (2), ( u , b ) < P 2 and ( a , v ) < P 2 . Hence, C A where A = { ( u , b ) < P 2 } and D B where B = { ( a , v ) < P 2 } . Hence, we can try all possible subsets of A and B for P 3 . This is what we have done in Lines 26–32. Every possible poset from each combination is a candidate poset and added to P * .
Algorithm 1: 2-Poset Cover Algorithm
Algorithms 12 00219 i001
We can also do the same in determining P when the iteration evaluates the pair ( c , d ) where ( c , d ) < P but ( c , d ) < P .
Lastly, to get P and P in P * , we can try all possible pairs of posets that exactly cover Y in Lines 33–35.
Now, we determine the running time complexity of the algorithm.
The first and outermost for-loop iterates in O ( n 2 ) . One dominating execution inside it is the call to GeneratePoset, which runs in O ( m n 2 ) [10]. Another dominating part is the two inner for-loops, in Lines 16–20 or Lines 28–32, that iterates through all the pairwise combinations of subsets A and subsets of B. Note that an element cannot be both an ancestor and descendant of a or b. Hence | A + B | < n . If | A | = t , then | B | is at most n t . Hence, there are 2 t × 2 n t = 2 n pairs of their subsets. Inside the two inner for-loops is a statement that gets all linear extensions of poset, i.e., L ( P 3 ) . This can be done in O ( m n ) by using the algorithm of Pruesse and Ruskey [1]. Hence, the total running time of the first outermost for-loop is O ( m n 4 + m n 2 n ) .
For the second outermost for-loop, | P * | O ( m ) since the smallest posets (with respect to the number of linear extensions) are the linear orders themselves. Thus, the second for-loop iterates in O ( m 2 ) . Inside it is a set equality testing that can be performed in constant time [12]. Hence, the second for-loop runs in O ( m 2 ) .
Thus, the total running time of the algorithm is O ( 2 n m n + m n 4 + m 2 ) . □
The running time of the solution for the 2-Poset Cover Problem is still exponential. But there is now an improvement from the running time of a brute-force solution, i.e. from a base of 3 to a base of 2 and from exponents in terms of m = | Y | to exponent in terms of n = | V | . Hence, we can say that for a large m, Algorithm 1 is much more efficient than a brute-force solution.
In the following, we show that when the posets are tree-posets, the running time of the algorithm becomes polynomial.

5. Algorithm for the 2-Tree-Poset Cover Problem

From Theorem 2, the part of Algorithm 1 that makes its running-time exponential is determining the latter components of Equations (3) or (4). However, with Corollary 1, the said components become simpler if the posets are tree-posets. Hence, we can then modify Algorithm 1 to specifically consider only tree-posets. The resulting algorithm is Algorithm 2. Consequently, the running time of the algorithm becomes polynomial. With these results, we can then say that the 2-Tree-Poset Cover Problem is in P.
Corollary 2.
Algorithm 2 produces a solution to the 2-Tree-Poset Cover Problem in O ( n 5 + m n 4 + m 2 ) .
Proof. 
The theoretical bases of Algorithm 2 is the same as Algorithm 1 for the 2-Poset Cover Problem except that we use Equations (5) and (6) for tree-posets as given in Corollary 1 instead of Equations (3) and (4) for general posets. Consequently, the running time then of the Algorithm differs on the following points.
  • B is empty and there is only one element in A that could cover v or u. This follows from Corollary 1. Hence, | A | = O ( n )
  • There is a need to check if the poset is a tree-poset. This can be done in O ( n 2 )
Hence, the inner for-loops runs in O ( n ( m n + n 2 ) ) = O ( m n 2 + n 3 ) . The first outermost for-loop then run in O ( n 2 ( m n 2 + n 3 ) ) = O ( m n 4 + n 5 ) . The running time of the second-outermost for loop remains the same, i.e., O ( m 2 ) . The running time then of the algorithm is O ( n 5 + m n 4 + m 2 ) . □
Algorithm 2: 2-Tree-Poset Cover Algorithm
Algorithms 12 00219 i002

6. Conclusions

In this study, we explored the Poset Cover Problem, a hard problem that is relevant in the field of data mining. It is already known that we can determine a single poset that covers a given set of linear orders in polynomial time. In this paper, we extended the knowledge on the problem by investigating the hardness of the case where we want to determine two posets, if they exist, that cover a set of linear orders, which we called the 2-Poset Cover Problem.
We discovered properties on posets that lead to an exact solution for the 2-Poset Cover Problem. The algorithm runs in O ( 2 n m n + m n 4 + m 2 ) where m is the number of linear orders over a based set of n elements. When m > n , the algorithm is significantly faster than a brute-force solution, which runs in O ( 3 m m n 2 ) . Since the algorithm runs in exponential time, the complexity class that the 2-Poset Cover Problem belongs to remains unknown. However, when the posets to be considered are tree posets, which can be treated as combinatorial models for evolutionary orderings, the running time of the algorithm becomes polynomial. Hence, this proves that the more restricted case, which we called 2-Tree-Poset Cover Problem, belongs to the computational complexity class P.

Author Contributions

Conceptualization, I.O. and P.F.J.; Formal analysis, I.O.; Investigation, I.O., P.F.J. and H.A.; Supervision, H.A.; Writing—original draft, I.O.; Writing—review and editing, P.F.J. and H.A.

Funding

This research was supported by Department of Science and Technology - Engineering Research and Development for Technology (DOST-ERDT).

Conflicts of Interest

The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript, or in the decision to publish the results.

References

  1. Pruesse, G.; Ruskey, F. Generating linear extensions fast. SIAM J. Comput. 1994, 23, 373–386. [Google Scholar] [CrossRef]
  2. Kalvin, A.D.; Varol, Y.L. On the generation of all topological sortings. J. Algorithms 1983, 4, 150–162. [Google Scholar] [CrossRef]
  3. Heath, L.S.; Nema, A.K. The poset cover problem. Open J. Discret. Math. 2013, 3, 101–111. [Google Scholar] [CrossRef]
  4. Lee, A.; Wilson, M. A combinatorial method for analyzing sequential firing patterns involving an arbitrary number of neurons based on relative time order. J. Neurophysiol. 2005, 92, 2555–2573. [Google Scholar] [CrossRef] [PubMed]
  5. Wiggins, C.; Nemenman, I. Process pathway via time series analysis. Exp. Mech. 2003, 43, 361–370. [Google Scholar] [CrossRef]
  6. Unnikrishnan, K.; Ramakrishnan, N.; Sastry, P.; Uthurusamy, R. Network reconstruction from dynamic data. ACM Sigkdd Explor. Newsl. 2006, 8, 90–91. [Google Scholar] [CrossRef]
  7. Puolamäki, K.; Fortelius, M.; Mannila, H. Seriation in paleontological data: Using markov chain monte carlo methods. PLoS Comput. Biol. 2006, 2, e6. [Google Scholar] [CrossRef] [PubMed]
  8. Mannila, H. Finding total and partial orders from data for seriation. Lect. Notes Comput. Sci. 2008, 5255, 16–25. [Google Scholar]
  9. Arkin, A.; Sheng, P.; Ross, J. A test case of correlation metric construction of a reaction pathway from measurements. Science 1997, 277, 1275–1279. [Google Scholar] [CrossRef]
  10. Fernandez, P.L.; Heath, L.S.; Ramakrishnan, N.; Tan, M.; Vergara, J.P. Mining posets from linear orders. Discret. Math. Algorithms Appl. 2013, 5, 1350030. [Google Scholar] [CrossRef]
  11. Sanchez, G.A.; Fernandez, P.L.; Vergara, J.P. Some heuristics for the 2-poset cover problem. Philipp. Comput. J. 2014, 9, 26–32. [Google Scholar]
  12. Yellin, D. Representing sets with constant time equality testing. J. Algorithms 1992, 13, 353–373. [Google Scholar] [CrossRef]
Figure 1. Poset P, its Hasse diagram and linear extensions.
Figure 1. Poset P, its Hasse diagram and linear extensions.
Algorithms 12 00219 g001
Figure 2. Example of Theorem 1.
Figure 2. Example of Theorem 1.
Algorithms 12 00219 g002

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Back to TopTop