Abstract

Efficient time complexities for partial ordered sets or posets are well-researched field. Hopcroft and Karp introduced an algorithm that solves the minimal chain decomposition in O (n2.5) time. Felsner et al. proposed an algorithm that reduces the time complexity to O (kn2) such that n is the number of elements of the poset and k is its width. The main goal of this paper is proposing an efficient algorithm to compute the width of a given partially ordered set P according to Dilworth’s theorem. It is an efficient and simple algorithm. The time complexity of this algorithm is O (kn), such that n is the number of elements of the partially ordered set P and k is the width of P. The computational results show that the proposed algorithm outperforms other related algorithms.

1. Introduction

A partially-ordered set (poset) P =  (X, ) is a set of elements X, along with a binary relation, , having the property that is transitive and antisymmetric for all elements in Ƥ. The scheduling problem can be formulated as a partially ordered set. In the scheduling problem, there are some jobs that are parallel (can be executed simultaneously) and some that are nonparallel (cannot be executed simultaneously). Finding the largest number of nonparallel jobs is equivalent to finding the width of the partially ordered set. Accordingly, there are a very large number of applications in various fields based on the different applications of the scheduling problem. The width of a poset is the largest antichain cardinality.

Two elements ai and aj are comparable if otherwise are in comparable if . A nonempty subset C = {a1, a2, …, ak} X is called a chain in P if a1a2ak. An antichain is a nonempty set in which there are no comparable pairs of elements. It is always feasible to divide the elements of X into disjoint chains since every single element in X is a chain in and of itself. Such a partition is referred to as a decomposition, and the minimum decomposition is one that has the fewest possible disjoint chains. The size of a minimum decomposition is equivalent to the size of a maximum antichain, according to Dilworth [1].

In 1973, Hopcroft and Karp [2] proposed the algorithm that takes O (mn2) time complexity to determine the width of a given poset such that n is the number of elements in P and m is the comparable pairs in P. They proved that the O(mn2) time complexity equals O (n5/2). In 2003, Felsner et al. [3] demonstrated that determining whether an order has width k can be done in O (kn2) time, such that n is the number of components in P and k is the width of P. For special cases of the posets, In 1979, Papadimitriou and Yannakakis [4] introduced a linear time complexity O (n) for determine the width of an interval partially ordered set with n elements. In 1980, Golumbic [5] proved that the width of a 2-dimensional poset can be computed in O (n log n) time such that n is the elements of P. In 1992, Garg [6] suggested a novel approach that requires O (n2m) comparisons, where n represents the number of chains and m is the maximum number of elements in any chain. They demonstrate that the temporal complexity of this approach for a chain poset is O (m n log n). In 2022, Badr et al. [7] introduced the integer linear programming model (ILPM), which determines the width of a given poset. ILPM is distinguished from the previous mathematical models by its efficiency. For more details about the poset decomposition, the reader can refer to [1, 813]. The reader can refer to [1417] for formulating the mathematical models that related to the poset decomposition.

The discipline of space-efficient data structures for partially ordered sets or posets has been intensively studied. A poset with n elements can be represented in n2/4 + o (n2) bits [18] or in (1 + ϵ) n log n + 2nk + o(nk) bits [19], where k is the width of the poset. Yanagita et al. [20] made the latter data structure occupy 2n (k − 1) + o (nk) bits by considering topological labeling on the elements of posets.

The best algorithm for this problem up to now need O (kn2) time, where n is the number of elements of a poset P. In this paper, we propose an efficient algorithm to compute the width of a given partially ordered set P according to Dilworth’s theorem. It is an efficient and simple algorithm. The time complexity of this algorithm is O (kn), such that n is the number of elements of the partially ordered set P and k is the width of P. The computational results show that the proposed algorithm outperforms other related algorithms.

The remaining of this paper is organized as follows: The proposed algorithm description is introduced in Section 2. In Section 3, the experimental results analysis of the proposed algorithm on different benchmark posets are provided. In Section 4, conclusions are made.

2. The Proposed Algorithm Description

In this section, we propose an efficient algorithm for determining the width of a poset P with n elements in O (kn) time, such that n is the number of components in P and k is the width of P. On the other hand, the numerical example is introduced for explaining the mechanism of the proposed algorithm. Finally, we introduce a proposition that proves the proposed algorithm has the time complexity of O (kn).

There are three basic parameters that affect the time complexity of finding the width of a given poset P. These parameters are n, k, and m the elements of P, the width of P, and the number of comparable pairs in P, respectively. Table 1 shows six different datasets of standard posets evaluate the proposed algorithm. On the other hand, it compares between the proposed algorithm (Algorithm 1) and Felsner et al.’ algorithm [3].

Input:
n: the number of elements of a poset P
An × n: the incidence matrix of a poset P
Output: the length of its largest antichain width (P)
Begin
width = 0
while length of matrix A! = 0 do
 sum_column = sum(A, axis = 0)
 sum_row = sum(A, axis = 1)
 sum_cr = 
M = inf
for j = 1 to n
  if (sum_cr [j] ≤ M):
   M = sum_cr [j]
   Index = j
  end
end
 Index_row = []
 Index_column = []
for j = 1 to n
  if (A[j, Index] == 1):
   Index_row.append(j)
  end
  if (A[Index, j] == 1):
   Index_column.append (j)
  end
end
 Delete all columns and row when value = 1 in (rows = Index_row [:],
 columns = Index_column [:] and column = Index)
  width +=1
end
return the best population found (the width of its largest antichain)
End

Here, we describe the mechanism of the proposed algorithm. The algorithm works as follows: It reads the incidence matrix A of a poset P. It sums up all the rows and columns of A. It adds the sum of each row with the sum of the corresponding column. We choose the lowest sum (the lowest vertex connected to the others). We remove the selected vertex and the connected vertices with it from the matrix A. It repeats the above statements until the size of A = 0.

Example 1. Let the poset P be the crown poset C3 as shown in Figure 1.
We put an initial value for the width of P: width = 0.Iteration 1Generate the incidence matrix A for the crown poset C3:It sums up all the rows and columns of A. It adds the sum of each row with the sum of the corresponding column. Sum_cr [i] = column [i] + row [i]We choose the lowest sum of sum_cr (min (sum_cr)) = 2 with index = 6 (break the tie by choosing the minimum value arbitrary).We determine all the vertices that link to the current vertex x6 which are x1 and x2.We remove the current vertex x6 and the vertices that linked with it.Iteration 2It sums up all the rows and columns of A. It adds the sum of each row with the sum of the corresponding column. Sum_cr [i] = column [i] + row [i]We choose the lowest sum of sum_cr (min (sum_cr)) = 1 with index = 3 (break the tie by choosing the minimum value arbitrary).We determine all the vertices that link to the current vertex x3 which are x1.We remove the current vertex x3 and the vertices that linked with it x1.Iteration 3We eliminate the final element (singleton): []The algorithm must now terminate. The final width equals three iterations.

Proposition 1. The algorithm 1 requires O (kn) comparisons at most.

Proof. Suppose comp (k) denotes the number of comparisons required in the kth iteration of the while loop. Suppose T denotes the total number of iterations of the while loop. Therefore, represents the total number of comparisons. Let α denotes the total number of iterations of for loop to get the minimum index, β denotes the total number of iterations of for loop to select vertices to connected with selected vertex and γ denote the number of deleted columns and rows. Therefore, . We note that T=k because every iteration the width increases by one until the size of the matrix = 0. It is clear that α=n because it searches for the minimum value in an array with size n. It is clear that β=n because β is related to α (for every value of α there is a vertex in the matrix A). It is clear that, γ is less than or equal to n. Therefore,The time complexity of the proposed algorithm is O (kn).

3. Datasets

The time complexity of the proposed approach clearly depends on the width of the poset. We assess the proposed algorithm with a dataset of standard posets which have different width. Six different datasets of standard posets evaluate the proposed algorithm, as shown in Table 1.

The first dataset is the chain posets. A poset P is called chain if all elements of P are comparable. The second dataset is the p-tower posets. It is obtained by substituting p antichains (stables) of cardinality 2 in a total order on p vertices. The third dataset is the divisor posets. For any natural number n, the collection X of all of the natural numbers that divide n represents the divisor posets. For any two elements in X, a, b, write a<ba|b and a=b, that is if a divides b and a = b. The fourth dataset is the crown poset. The poset with 2n-elements a1, … , an; b1, … , bn is called crown poset if every element ai is comparable with every element bj excluding the case when i = j. The fifth dataset is the alternating 2n-cycle poset. An ordered set (x1, y1, x2, y2, …, xn, yn) of size 2n, n ≥ 2, with these comparabilities, and no others, is called an alternating 2n-cycle, or more briefly, a 2n-cycle. The sixth dataset is the antichain poset. A poset P is called antichain if all elements of P are incomparable.

Table 1 shows the superiority of the proposed algorithm on the algorithm that was proposed in [3] for three cases.

4. Computational Study

Here, we evaluate the proposed algorithm by We evaluate the proposed algorithm with a dataset of standard partially ordered sets which have different width. Six different datasets of standard posets evaluate the proposed algorithm, as shown in Table 1. All of these are compatible with a PC having a Core i7 CPU@2.8 GHz, 8 GB of RAM, and a 64 bit operating system. They were all written in Python. The values of different algorithm-specific parameters are properly set to achieve their optimal performance, as shown in Table 1.

Table 2 and Figure 2 demonstrate that the proposed algorithm is superior to the mathematical model ILPM [7] in terms of the execution time required to determine the width of the 2n-cycle poset. This superiority is due to the fact that the width is the primary parameter of the proposed algorithm, while the number of comparable pairs and the number of elements in the 2n-cycle poset are secondary parameters. Alternatively, the mathematical model ILPM relies on the number of comparable pairs as its primary parameter, while the width and number of elements in the 2n-cycle poset are secondary parameters. Figure 1 illustrates the execution time advantage of the proposed algorithm over the mathematical model for the 2n-cycle poset. The second and fifth columns indicate that the running time of ILPM increases with the number of comparable pairs, whereas the sixth and seventh columns indicate that the running time of the proposed algorithm increases with the width of the 2n-cycle poset. We conclude from the preceding that the width of a poset P is an important and influential parameter for the proposed algorithm, whereas the number of comparable pairs is an important and influential parameter for the mathematical model ILPM.

Table 3 and Figure 3 demonstrate that the width is the most important parameter of the proposed algorithm, followed by the number of comparable pairs and the number of elements in the poset P. Alternatively, the primary parameter of the mathematical model ILPM is the number of comparable pairs, while the width and number of elements in the poset P are secondary parameters. Table 3’s second and fifth columns demonstrate that as the number of comparable pairs increases, so does the execution time of the mathematical model ILPM. For instance, when N = 200, the execution time for the crown group is 9.038238 seconds, and when N = 500, it is 136.2815 seconds.

On the divisor poset, Table 4 and Figure 4 demonstrate the superiority of the proposed algorithm over the mathematical model ILPM [7]. Table 4’s second column depicts the fluctuation of the number of comparable pairs between increases and decreases, but maintains that a longer execution time corresponds to a greater number of comparable pairs in the mathematical model ILPM.

Table 5 and Figure 5 demonstrate that the proposed algorithm is preferable to the ILPM [7] mathematical model of the k-tower poset. From the sixth and seventh columns of Table 5, it can be observed that the execution time of the proposed algorithm increases slightly as the number of comparable pairs and the number of elements of the k-tower poset increase, confirming that the number of comparable pairs and the number of elements are secondary parameters of the proposed algorithm. In contrast, we find that the execution time of the mathematical model ILPM increases significantly as the number of comparable pairs of the k-tower poset increases, confirming that the number of comparable pairs is a fundamental and influential parameter for the mathematical model ILPM.

Table 6 and Figure 6 show that the proposed algorithm is superior to the ILPM [7] mathematical model of chain posets. It can be seen in the sixth and seventh columns of Table 6 that the execution time of the proposed algorithm increases slightly as the number of comparable pairs and the number of elements of the chain posets increase, confirming that the number of comparable pairs and the number of elements are secondary parameters of the proposed algorithm. In contrast, we discover that the execution time of the mathematical model ILPM increases considerably as the number of comparable pairs of the chain posets increases, confirming that the number of comparable pairs is an essential and influential parameter for the mathematical model ILPM.

Recall that the width of a poset P is dependent on three fundamental parameters: the number of elements in P, its width, and the number of comparable pairs in P. Table 7 and Figure 7 demonstrate that after 300, the proposed algorithm increases sharply. The weights of the aforementioned three parameters explain this significant increase. The execution time of the proposed algorithm increases relative to the execution time of the mathematical model as the poset size increases.

In terms of execution time for five posets (chain poset, k-tower, divisor poset, crown poset, and 2n-cycle poset) versus one poset (antichain poset) for ILPM [7], Tables 27 and Figures 17 indicate that the proposed algorithm is superior to the mathematical model ILPM.

5. Conclusions

The main goal of this paper was proposing an efficient algorithm to compute the width of a given partially ordered set P according to Dilworth’s theorem. It is an efficient and simple algorithm. The time complexity of this algorithm is O (kn), such that n is the number of elements of the partially ordered set P and k is the width of P. The computational results show that the proposed algorithm outperforms other related algorithms. In future work, the mathematical relation among the size of poset P, its width, and the number of comparable pairs in P is introduced for special posets such as the chain, antichain, k-tower, divisor, crown, and 2n-cycle posets.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.