A Poset Dimension Algorithm

A Poset Dimension Algorithm

Journal of Algorithms 30, 185]208 Ž1999. Article ID jagm.1998.0974, available online at http:rrwww.idealibrary.com on A Poset Dimension Algorithm* Ja...

154KB Sizes 3 Downloads 69 Views

Journal of Algorithms 30, 185]208 Ž1999. Article ID jagm.1998.0974, available online at http:rrwww.idealibrary.com on

A Poset Dimension Algorithm* Javier Yanez ´˜ † and Javier Montero Department of Statistics and OR, Complutense Uni¨ ersity, 28040-Madrid, Spain Received April 2, 1998; revised August 14, 1998

This article presents an algorithm which computes the dimension of an arbitrary finite poset Žpartial order set.. This algorithm is based on the chromatic number of a graph instead of the classical approach based on the chromatic number of some hypergraph. The relation between both approaches is analyzed. With this algorithm, the dimension of many modest size posets can be computed. Otherwise, an upper bound for the poset dimension is obtained. Some computational results are included. Q 1999 Academic Press Key Words: partially ordered set Žposet.; dimension of a poset; graph theory.

1. INTRODUCTION Following Trotter et al. w16x, we shall consider here a partial order as an irreflexive and transitive binary relation. A partially ordered set Žposet. P will be therefore a pair Ž X, P ., where X represents a finite set and P is an irreflexive, transitive binary relation on X. Such a set X is called a ground set. Whenever the ground set X is fixed, we shall refer to such a poset just by P. As usual, x -P y will mean that Ž x, y . g P, and two elements x, y g P are said incomparable in P Ž x 5 P y . is neither x -P y nor y -P x holds. By incŽ P . ; X = X we shall denote the set of incomparable oriented pairs in P. A poset P is a chain when there are no incomparable elements of X, i.e., if incŽ P . s B. When P is a chain, we have a linear or total order. Given a poset P s Ž X, P ., an extension of P is any poset Q s Ž X, Q . such that P : Q. In other words, a poset Q is an extension of P whenever both are defined on the same ground set X and x -P y « x -Q y ; x, y g X . *Research supported by DGICYT National Grant number PB95-0407. † E-mail: [email protected]. 185 0196-6774r99 $30.00 Copyright Q 1999 by Academic Press All rights of reproduction in any form reserved.

YANEZ ´˜ AND MONTERO

186

Obviously, the set of all extensions of a poset P is partially ordered by inclusion, and its maximal elements are linear orders on X. They are called linear extensions of P. A family of linear extensions of P, R s  L1 , . . . , L t 4 , is called a realizer of P if and only if t

Ps

F Li . is1

The dimension of a partially ordered set Žposet. was defined by Dushnik and Miller w2x as the minimum number of linear orders whose intersection is such a poset. In other words, the dimension of a poset P is the least positive integer t for which there exists such a realizer R s  L1 , . . . , L t 4 . We shall then write dimŽP. s t. Again, in case the ground set is fixed, we can write just dimŽ P . s t. Exhaustive expositions on the poset dimension problem can be found in Trotter w14x Žsee also Fishburn w3x and the surveys by Kelly and Trotter w8x and West w17x.. In particular, Ore w12x Žsee also Golumbic w6x. observed that the dimension of a poset P can be viewed as the smallest nonnegative integer t for which P can be embedded in R t. Such embedding is defined by representing each element x g X by a vector x s Ž x 1 , . . . , x t . g R t such that x -P y

m

x i F yi

; i g  1, . . . , t 4 , ; x, y g X , x / y.

The dimension of a poset has been fully characterized for low dimensions. For example, if G represents the so-called comparability graph of a poset P, then dimŽP. F 2 if and only if the complementary graph is transitively orientable Žsee Dushnik and Miller w2x and Golumbic w6x.. Alternative characterizations for posets of dimension 3 can be found in Kelly w7x and Trotter and Moore w15x. In general, the dimension of a poset can be characterized as the chromatic number of the hypergraph of critical pairs; see Fishburn and Trotter w4x, but as pointed out by Trotter w14x, such a conversion is not useful for computational purposes. An alternative method referenced by Golumbic w6x is based upon a bipartite covering, but it is also intractable except for small posets. The concept of dimension of a partial order Žposet. has been widely analyzed from a theoretical point of view. The dimension of a poset and its realizers becomes a key basis for useful representation tools with great potential relevance in many applied fields, but to achieve such a practical relevance, more research is needed to make the evaluation of such a dimension operational.

A POSET DIMENSION ALGORITHM

187

The main aim of this article is the effective calculus of arbitrary finite poset dimensions. The article is organized as follows. From the incomparable pairs of a poset P, the consistency digraph GŽP. is introduced in Section 2. Based on such a digraph, the incompatibility graph G*ŽP. is analyzed in Section 3. Given the strict hypergraph of critical pairs K Ps , the induced graph graphŽK Ps . and G*ŽP. are isomorphic. Two cases, K Ps s graphŽK Ps . and K Ps / graphŽK Ps ., must be distinguished: the dimension of any poset verifying the first condition is characterized as the chromatic number of its incompatibility graph; a construction procedure of the minimum realizer based on an exact minimum coloration graph procedure is outlined in Section 4. Otherwise, for posets verifying the second condition or when the minimal coloration graph procedure is a heuristic, the computed dimension by the algorithm will be an upper bound. A heuristic coloration procedure drastically decreases the computation time and allows the approximation of the dimension of medium and large size posets.

2. CONSISTENCY DIGRAPH Let Ž X, L i . be a linear extension of Ž X, P .. By Fi we mean the complement of P in L i . Therefore, Fi ; incŽ P . and for each linear ordering L i defining a minimum realizer R s  L1 , . . . , L t 4 we have L i s P j Fi for i s 1, . . . , t. Moreover, for every two incomparable elements x 5 y there exist at least two sets Fi and Fj such that Ž x, y . g Fi and Ž y, x . g Fj Žsee Trotter w14x.. Let us develop here an approach to the general representation problem, on the basis of the associated incomparability set. Let us consider the following example. EXAMPLE 2.1. Let P1 s Ž X 1 , P1 . be a poset, where X 1 s  1, 2, 3, 4, 5, 64 and P1 s  Ž 1, 3 . , Ž 1, 4 . , Ž 2, 3 . , Ž 2, 4 . , Ž 3, 4 . , Ž 5, 4 . 4 . Then 1 52, 1 55, 1 56, 2 55, 2 56, 3 55, 3 56, 4 56, 5 56 and, therefore,

¡Ž 1, 2. , Ž 2, 1. ; Ž 1, 5. , Ž 5, 1. ; Ž 1, 6. , Ž 6, 1.¦ ¢Ž 3, 6. , Ž 6, 3. ; Ž 4, 6. , Ž 6, 4. ; Ž 5, 6. , Ž 6, 5.§

inc Ž P . s ~ Ž 2, 5 . , Ž 5, 2 . ; Ž 2, 6 . , Ž 6, 2 . ; Ž 3, 5 . , Ž 5, 3 . ¥. 1

188

YANEZ ´˜ AND MONTERO

The Hasse diagram of this example is shown in Fig. 1, together with its vectorial representation based on the two linear orders L1 : 1 - 2 - 3 - 5 - 4 - 6, L2 : 6 - 5 - 2 - 1 - 3 - 4. It is therefore immediate that dimŽP1 . s 2. Notice that in this example we have F2 s F1y1 , where

Ž x, y . g F1y1

m

Ž y, x . g F1 ,

Ž y, x . being the opposite of Ž x, y .; see Dushnik and Miller w2x. In order to build up a linear extension of Ž X, P ., we must choose a specific orientation for each incomparable couple, always keeping transitivity. If we denote is

a Ž inc Ž P . . 2

as the number of incomparable couples in P, there will be 2 i potential completions of P. Obviously, only some of them will lead to a linear order.

FIGURE 1.

A POSET DIMENSION ALGORITHM

189

In Example 2.1, for instance, there are i s 9 couples of incomparable elements. In order to get a completion, we should choose one specific orientation for each of these nine couples. Indeed, the choice of each orientation is not arbitrary. If we choose, for example, the pair Ž3, 5., then we are forced to choose also the pair Ž2, 5., so its opposite pair Ž5, 2. must be avoided. Otherwise, Ž3, 5., Ž5, 2.4 joined to Ž2, 3. g P defines a circuit. The existence of forced pairs Žsee Maurer et al. w11x. should be taken into account, since addition of a particular pair may imply other pairs, due to transitivity. We denote such consistency implication as

Ž 3, 5 . ª Ž 2, 5 . , which is obviously equivalent to

Ž 5, 2 . ª Ž 5, 3 . . The following definition formalizes the above implication. DEFINITION 2.1. Let P s Ž X, P . be a poset and let a g incŽ P . be fixed. We define the a-transitivization of P as the minimal poset Ž X, trŽ P q a .. such that P j a ; trŽ P q a .. The existence of such a transitivization trŽ P q a . is always assured when a g incŽ P .. Moreover, it is unique; indeed, given a s Ž x 0 , y 0 ., let  x 1 , . . . , x r 4 and  y 1 , . . . , ys 4 denote all those elements in X that verify, respectively, v v

Ž x i , x 0 . g P ; i g  1, . . . , r 4 , Ž y 0 , y j . g P ; j g  1, . . . , s4 .

Obviously, for any i g  1, . . . , r 4 and j g  1, . . . , s4 we have that Ž y j , x i . f P Žotherwise, Ž y 0 , x 0 . g P is implied.. Then, trŽ P q a . is obtained by adding all those pairs in

 Ž x i , yj . ri g  0, . . . , r 4 ,

j g  0, . . . , s 4 4

that are not already in P. DEFINITION 2.2. Given a poset P s Ž X, P ., its consistency digraph is G Ž P. s Ž inc Ž P . , U Ž P . . , where incŽ P . is the set of oriented incomparable pairs in P, and

Ž a , b . g UŽ P .

m

b g tr Ž P q a . .

YANEZ ´˜ AND MONTERO

190

The consistency digraph is obviously transitive. Moreover, the following property holds. PROPOSITION 2.1.

Let a g incŽ P .. Then

Ž a , b . g UŽ P .

m

Ž by1 , ay1 . g U Ž P . .

Once a vertex of the consistency digraph GŽP. Ži.e., a pair in incŽ P .. has been added to P, all its successors in GŽP. must be also added. The problem is thus reduced to the choice of those vertices in GŽP. with no predecessors. That is, the choice of those vertices a g incŽ P . such that Ž . dy GŽ P . a s 0. The other vertices are implied by them. Digraph GŽP1 . of Example 2.1 is shown in Fig. 2, where deduced transitivity arcs have been suppressed for simplicity.

FIG. 2. GŽP1 ..

A POSET DIMENSION ALGORITHM

191

3. INCOMPATIBILITY GRAPH The opposite pairs a and ay1 cannot be simultaneously added for transitivization. Moreover, a vertex with no predecessor can imply the rejection of other vertices. In Example 2.1, for instance, the pairs Ž6, 2. and Ž4, 6. cannot be simultaneously included in the same linear extension, since Ž6, 2. ª Ž6, 3. and Ž4, 6. ª Ž3, 6.. We introduce now the concept of incompatibility between vertices with no predecessors in GŽP.. DEFINITION 3.1. Let us denote by V * Ž P . s  a g inc Ž P . rdy GŽ P . Ž a . s 0 4 the set of vertices of GŽP. with no predecessor. We say that a , b g V *Ž P . are incompatible if there exists at least one successor g of a in GŽP. such that its opposite gy1 is a successor of b in GŽP.. We denote by E*Ž P . the set of all couples of incompatible vertices, and by Proposition 2.1 we know that this incompatibility relation is symmetric. DEFINITION 3.2. The incompatibility graph is defined as the undirected graph G*ŽP. s Ž V *Ž P ., E*Ž P ... For example, GŽP1 . has nine vertices with no predecessor:

 Ž 1, 2 . , Ž 2, 1 . , Ž 6, 2 . , Ž 6, 1 . , Ž 6, 5 . , Ž 4, 6 . , Ž 5, 2 . , Ž 5, 1 . , Ž 3, 5 . 4 . The incompatibility graph G*ŽP1 . is shown in Fig. 3. The following properties allow a better insight on the incompatibility graph G*ŽP.. In particular, G*ŽP. can be described by means of a partition of connected components. PROPOSITION 3.1.

Ž y1 . s 0. If a g V *Ž P ., then dq GŽ P . a

Ž . Proof. If a g V *Ž P ., then ay1 g incŽ P . and dy GŽ P . a s 0. ConseŽ . quently, there is no arc of G P incoming vertex a and, by Proposition 2.1, there is no arc leaving ay1 . PROPOSITION 3.2. a * such that

Let a g V *Ž P .. Then there exists at least one ¨ ertex

1.  a , a *4 g E*Ž P . and 2. there exists a path in GŽP. from a * to ay1 . Proof. Notice that a g V *Ž P . implies ay1 g incŽ P .. Then one and only one of the two following cases holds: Ž y1 . s 0. Then ay1 g V *Ž P . and both vertices a and Case 1. dy GŽ P . a a are included in V *Ž P .. In this case, a * s ay1 and the path in GŽP. has only one vertex. y1

YANEZ ´˜ AND MONTERO

192

FIG. 3. G*ŽP1 ..

Ž y1 . ) 0. Then there is at least one arc of GŽP. incomCase 2. dy GŽ P . a y1 Ž . ing to vertex a . Let Ž b , ay1 . be such an arc. If dy GŽ P . b ) 0, again we are able to choose another incoming arc of GŽP.. This process can be repeated until we find a vertex a * with no incoming arc. It is verified that Ž .  4 dy GŽ P . a * s 0 and, by definition of incompatibility, we have a , a * g E*Ž P .. Obviously, a * is not unique. As a consequence, the incompatibility graph has no isolated vertex. Moreover, the endpoints of every edge in G*ŽP. verify the above properties of a and a *. In Example 2.1, G*ŽP1 . has three connected components. One of them has only one edge linking Ž1, 2. and Ž2, 1. ŽCase 1.. The other connected components belong to Case 2. We can consider, for example, Ž3, 5.* s Ž5, 1. or Ž3, 5.* s Ž5, 2.. At this point, it is important to recall the following definitions Žsee Trotter w14x for further details.: DEFINITION 3.3. Given a poset P s Ž X, P ., a pair Ž x, y . g incŽ P . is said a critical pair if: v v

z -P x « z -P y and y -P w « x -P w

; z, w g X y  x, y4 . The set of critical pairs of a poset P will be denoted as critŽ P ..

A POSET DIMENSION ALGORITHM

193

DEFINITION 3.4. Given a poset P, an alternating cycle in P is a sequence

 Ž x i , yi . r1 F i F s, Ž x i , yi . g inc Ž P .

with yi F x iq1 Ž cyclically . 4 .

The integer s is called the length of the cycle. An alternating cycle is strict if yi F x j in P if and only if j s i q 1. DEFINITION 3.5. Given a poset P, the strict hypergraph of critical pairs of P, denoted K Ps , is the hypergraph ŽcritŽ P ., F ., where F consists of those subsets of critŽ P . whose duals form strict alternating cycles. An edge E g F will be called hyperedge if < E < G 3, and it will be called a graph edge if < E < s 2. DEFINITION 3.6. The chromatic number of a hypergraph H s Ž X, F ., denoted x ŽH., is the least positive integer t for which there is a function f : X ª  1, . . . , t 4 so that there is no i g  1, . . . , t 4 for which there is an edge E g F with f Ž x . s i for every x g F. The chromatic number of the strict hypergraph of critical pairs K Ps characterizes the dimension of the poset P: dim Ž P. s x Ž K Ps . . In the following, it will be proven that the incompatibility graph introduced in this section is isomorphic to a subset of K Ps . DEFINITION 3.7. Given the hypergraph K Ps s ŽcritŽ P ., F ., let graphŽK Ps . s ŽcritŽ P ., F9. be the induced graph where F9 ; F consists of the graph edges from F. Obviously, it is always verified that graphŽK Ps . ; K Ps in the sense that F9 ; F. The case when this inclusion is strict, i.e., then there are some hyperedges and, consequently, F y F9 / B, will be denoted as graphŽK Ps . / K Ps . THEOREM 3.1. The critical pairs of a poset P are the ¨ ertices of the consistency digraph GŽP. with no successor, i.e., crit Ž P . s  a g inc Ž P . rdq GŽ P . Ž a . s 0 4 . Proof. Let a s Ž x, y . g critŽ P . be fixed. If Ž a , b . g UŽ P . for some b s Ž z, w . / a , it should be b g trŽ P q a .. In order to have such an implication, it must be z -P x and y -P w. But since a g critŽ P ., it should have been z -P y and x -P w, in such a way that z - w, that is, b f incŽ P .. Hence, there is no arc in GŽP. from a .

YANEZ ´˜ AND MONTERO

194

The other inclusion can be analogously proven: Let a s Ž x, y . g incŽ P . such that dq GŽ P . s 0 is fixed. If we assume, for example, z -P x, then ŽŽ x, y ., Ž z, y .. g UŽ P . unless Ž z, y . f incŽ P .. But it cannot be y -P z, because then it should be y -P x, i.e., a f incŽ P .. Hence, z -P y must hold. THEOREM 3.2. Gi¨ en a , b g V *Ž P ., then

 a , b 4 g E* Ž P .

m

 ay1 , by1 4 is an edge of graph Ž K Ps . .

Proof. Let  a , b 4 be an edge of E*Ž P . in such a way that a s Ž x 1 , x 2 . g V *Ž P . and b s Ž y 1 , y 2 . g V *Ž P .. From Proposition 3.2, there exists a path in GŽP. from Ž y 1 , y 2 . to Ž x 2 , x 1 .. The transitivization process assures that Ž b , ay1 . g UŽ P ., i.e., ay1 g trŽ P q b . and, consequently, x 2 -P y 1 and y 2 -P x 1. In this way, it is proven that Ž x 1 , x 2 ., Ž y 1 , y 2 .4 is an alternating cycle and, by definition, the opposite pair  ay1 , by1 4 is an edge of graphŽK Ps .. The other implication can be analogously proven. Based on Theorems 3.1 and 3.2, the following corollary is stated: COROLLARY 3.1. The graphs G*ŽP. and graphŽK Ps . are isomorphic and, consequently, they ha¨ e the same chromatic number. The vertex sets of G*ŽP. and K Ps are subsets of the same set incŽ P .: the ‘‘source’’ vertices and the ‘‘sink’’ vertices, respectively. In Example 2.1, for instance, there are only three strict alternating cycles,

 Ž 1, 2. , Ž 2, 1 . 4 ;

 Ž 5, 2 . , Ž 3, 5 . 4 ;

 Ž 5, 1 . , Ž 3, 5 . 4 ,

and all hyperedges are edges. In this example, K Ps 1 s graphŽK Ps 1 .. Consequently, taking into account Corollary 3.1, the dimension of the poset is dim Ž P1 . s x Ž G* Ž P1 . . . A procedure to compute the dimension of those posets P verifying K Ps s graphŽK Ps . will be introduced in Section 4. The computation of dimŽP. for those posets P verifying K Ps / graphŽK Ps . will be analyzed in Section 5. 4. CONSTRUCTION PROCEDURE WHEN K Ps s graphŽK Ps . Given a graph, a stable set is a subset of vertices, none of which is adjacent to another element in such a set. The smallest possible number of stable sets which cover the vertex set V *Ž P . of the incompatibility graph G*ŽP. is called its chromatic number and it is denoted by x Ž G*ŽP...

A POSET DIMENSION ALGORITHM

195

For instance, in Example 2.1, x Ž G*ŽP1 .. s 2, since V * Ž P1 . s  Ž 6, 2 . , Ž 6, 1 . , Ž 6, 5 . , Ž 1, 2 . , Ž 5, 1 . , Ž 5, 2 . 4 j  Ž 4, 6 . , Ž 2, 1 . , Ž 3, 5 . 4 . Such a cover of V *Ž P . is not unique, in general, but when a particular cover is fixed, then all vertices of incŽ P . and their successors in the digraph GŽ P . are included in at least one associated set of the cover. Following with Example 2.1, we obtain inc Ž P1 . s  Ž 6, 2 . , Ž 6, 3 . , Ž 6, 1 . , Ž 6, 5 . , Ž 6, 4 . , Ž 1, 2 . ,

Ž 5, 1 . , Ž 5, 2 . , Ž 5, 3 . 4 j  Ž 4, 6 . , Ž 5, 6 . , Ž 3, 6 . , Ž 1, 6 . , Ž 2, 6 . , Ž 2, 1 . , Ž 3, 5. , Ž 1, 5. , Ž 2, 5. 4 . Notice that the classical theorem of Dushnik and Miller w2x deals with this case, and the incompatibility graph is the bipartite graph joining the reverse ordered pairs with no predecessor. As a consequence, the chromatic number of the incompatibility graph G*ŽP1 . is 2. It is assumed that incŽ P . / B; otherwise t s 1 directly. Let G*ŽP. be the incompatibility graph of P and let  C 1 , . . . , C s 4 be all its connected components Ž s G 1.. Let t c denote the chromatic number of C c for each c g  1, . . . , s4 . Obviously, the chromatic number of G*ŽP. verifies t s x Ž G* Ž P. . s Max  t 1 , . . . , t s 4 . Initially, L i s P for all i g  1, . . . , t 4 , i.e., -i s- ; i g  1, . . . , t 4 . The construction procedure adds iteratively some vertices from G*ŽP. to some L i Ž a s Ž x, y . g V *Ž P . is included in L i when the relation x -i y is added to L i .. Such included vertices must be transitivized so that the partial order L i will be transitive at any stage of the procedure. At the beginning, when L i s P, the transitivized vertices are only the successors in GŽP. of included vertices. However, when the construction procedure evolves, two type of problems can arise in the transitivization process: 1. Taking into account that the construction procedure deals with the connected components of the incompatibility graph, the transitivized vertices can belong to another connected component. Those vertices are denoted induced. This problem is treated in this section. 2. There exists a circuit in some partial order -i at some stage of the construction procedure. Such circuits are related to the hyperedges of the strict hypergraph of critical pairs and will be analyzed in the Section 5.

YANEZ ´˜ AND MONTERO

196

In order to clarify the procedure which computes a minimum realizer of a poset P, a particular data structure of the colored incompatibility graph G*ŽP. is introduced. For any connected component C c of G*ŽP., with c g  1, . . . , s4 , let nŽ c . be the number of vertices of C c and let t c be its chromatic number. Such chromatic number is obtained after an exact graph-coloring procedure is applied to each connected component. Every vertex of G*ŽP. is in this way colored. Let colŽ . denote the coloring function

½ col Ž a

c j

. g  1, . . . , t c 4 ,

j g  1, . . . , n Ž c . 4 4 , c g  1, . . . , s 4 .

5

The minimal-colored incompatibility graph can be stored as a double list S, whose elements are the connected components of G*ŽP. and associated to each one of them, there is another list of colored vertices. The double list is S s Ž first ] element Ž S . s C 1 ; next Ž C c . s C cq 1 ; next Ž C s . s B .

ž

C s first ] element Ž C . s c

c

;next

ž

a jc col Ž a jc .

ž

a 1c col Ž a 1c .

/ ž s

/

;

c a jq1 c col Ž a jq1 .

/

; . . . next

ž

a nŽc c. col Ž a nŽc c. .

graphically, it is S x C ª 1

a 11 col Ž a 11 .

ª

a 21 col Ž a 21 .

ª ??? ª

1 a nŽ1. 1 col Ž a nŽ1. .

x C2 ª

a 12 col Ž a 12 .

ª

a 22 col Ž a 22 .

ª ??? ª

2 a nŽ2. 2 col Ž a nŽ2. .

x .. . x C ª s

a 1s col Ž a 1s .

ª

a 2s col Ž a 2s .

ª ??? ª

a nŽs s. col Ž a nŽs s. .

.

/ /

sB ;

A POSET DIMENSION ALGORITHM

197

The induction of vertices is illustrated with the following example. EXAMPLE 4.1. Let P2 s Ž X 2 , P2 . be a poset, where X 2 s  1, 2, 3, 4 4 and P2 s  Ž 3, 4 . , Ž 3, 5 . 4 . The incompatibility graph G*ŽP2 . is shown in Fig. 4. Let us suppose an intermediate stage of the construction procedure of the minimum realizer in such a way that the pairs Ž4, 5. and Ž1, 3. are included in L1 and, consequently, the pairs Ž5, 4., Ž5, 1., and Ž4, 1. must be included in L2 . At this moment, the partial orders L1 and L2 are L1 s  1 - 3 - 4 - 5 4 , L2 s  3 - 5 - 4 - 14 . If Ž2, 3. is included in L1 , then Ž5, 2. and Ž4, 2. must be included in L2 and no vertex is induced. Alternatively, if Ž2, 1. is included in L1 , then Ž2, 3. is induced and will be denoted as Ž2, 1. «1 Ž2, 3.. In this way, the induction is not a symmetric relation, because a «i b does not imply b «i a and the problem that arises when a «i b could be avoided by including in L i vertex b instead of a . Notice that in the case that Ž2, 1. was included in L1 , then not only Ž2, 1. «1 Ž2, 3. but also Ž1, 2. «2 Ž5, 2. and Ž1, 2. «2 Ž4, 2.. Indeed, as will

FIG. 4. G*ŽP2 ..

YANEZ ´˜ AND MONTERO

198

be proven later, the induction is a relation between connected components instead of vertices. Based on these ideas, the following procedures are proposed: Minimum ] Realizer, which constructs the minimum realizer R from the minimal-colored incompatibility graph and its chromatic number t. We can notice that the realizer R obtained in this way is the minimum if K Ps s graphŽK Ps .. Change ] Structure ] Data, which changes the list of connected components of G*ŽP. when an induced vertex is detected. v

v

4.1. Procedure Minimum] Realizer(S) L i s P for all i g  1, . . . , t 4 C s first ] elementŽ S . do while Ž C / B. LXi s L i ; i g  1, . . . , t 4 induction ] index s 0 a s first ] elementŽ C . do while ŽŽ a / B. and Žinduction ] index s 0.. i s colŽ a . LXi s trŽ LXi q a . if Žthere exists an induced vertex b g C* / C . induction ] index s 1 Change ] Data ] StructureŽ S, C*, b , i . C s C* else a s nextŽ a . endif enddo if Ž a s B. L i s LXi ; i g  1, . . . , t 4 C s nextŽ C . endif enddo L i is linearized ; i g  1, . . . , t 4 return R s  L1 , . . . , L t 4 4.2. Procedure Change ] Data ] StructureŽ S, C*, b, i . nextŽpreviousŽ C*.. s nextŽC*. nextŽ C*. s first ] elementŽ S . first ] elementŽ S . s C*

A POSET DIMENSION ALGORITHM

199

nextŽpreviousŽ b .. s nextŽ b . nextŽ b . s first ] elementŽ C*. first ] elementŽ C*. s b a s first ] elementŽ C*. color ] b s colŽ a . do while Ž a / B.

¡i ¢colŽ a .

colŽ a . s ~col Ž b .

if col Ž a . s col Ž b . if col Ž a . s i otherwise

a s nextŽ a . enddo By construction, for every x, y g X with x 5 y there exist distinct integers i, j with 1 F i, j F t for which Ž x, y . g L i and Ž y, x . g L j . In order to prove that the above procedures are well defined, some considerations about the induced vertices are needed and two lemmas are included. LEMMA 4.1. If a «i b for some i g  1, . . . , t 4 , then any ¨ ertex a * g V *Ž P . such that  a , a *4 g E*Ž P . also induces another ¨ ertex b * g V *Ž P . such that  b , b *4 g E*Ž P ., i.e., a * «j b * with j / i. Proof. At any stage of the procedure, the sets L i include the pairs of P and some others from incŽ P .. Two elements x and y ordered in the partially ordered set L i will be denoted by x Fi y Ž x -i y if x / y .. The induction a «i b implies that b1 Fi a1 and a2 Fi b 2 , where a s Ž a 1 , a 2 . and b s Ž b1 , b 2 .. The two inequalities b1 - a1 and a2 - b 2 cannot be verified simultaneously, since, in this case, a s Ž a1 , a2 . ª b s Ž b1 , b 2 ., which is in contradiction to b * g V *Ž P .. Let us suppose, for instance, that Ž b 2 , a2 . g incŽ P . and the pairs Ž a2 , b 2 . and Ž b 2 , a2 . have been included in L i and L j , respectively, i.e., a2 -i b 2 and b 2 -j a2 . Without any loss of generality, we can suppose that b1 s a1 since, otherwise, it is easy to prove that a s Ž a1 , a2 . «i Ž a1 , b 2 ., where Ž a1 ,b 2 . g incŽ P . Žif a1 - b 2 « b1 -i b 2 and if a1 ) b 2 « a1 )i a2 .. Let Ž c1 , c2 . g V *Ž P . be the predecessor in GŽ P . of Ž b 2 , a2 . that was included in L j . This is equivalent to saying that c1 G b 2 and c 2 F a2 . Let a * s Ž aU1 , aU2 . be an adjacent vertex to a . The two following inequalities are verified: a2 F aU1 and aU2 F a1. These inequalities are implied by the existence of two paths in GŽ P .: one from a to Ž a *.y1 and the other one from a * to ay1 . Taking into account the last inequalities, c1 Fj c 2 F a2 F aU1

200

YANEZ ´˜ AND MONTERO

and aU2 F a1 s b1 , we can conclude that a * «j Ž c1 , b1 ., which is an adjacent vertex of b . The adjacent vertex b * is the ‘‘source’’ vertex in GŽ P . which has the vertex Ž c1 , b1 . as a successor. With the following lemma, the rejection of connected components inducing other ones is necessarily finite and the procedure is well defined. LEMMA 4.2. The relations «i defined on V *Ž P . for any i g  1, . . . , t 4 ha¨ e no cycles. Proof. Let us suppose, by contradiction, the situation

a 1 «i a 2 «i ??? «i a r «i a 1 . Since a j «i a jq1 implies a1j Gi a1jq1 and a2j Fi a2jq1 , where a j s Ž a1j , a2j . for any j g  1, . . . , r 4 , the existence of the above induction cycle at any instant of the procedure implies the inequalities a11 Gi a12 Gi ??? Gi a1r Gi a11 and a12 Fi a22 F i ??? Fi a2r Fi a12 , which contradict the properties of L i . 5. EXTENSION PROCEDURE WHEN K Ps / graphŽK Ps . As pointed out in Section 3, there exist some posets whose strict hypergraph of critical pairs contains some hyperedges. Their dimension cannot be characterized, in general, as the chromatic number of their incompatibility graph. However, these posets are easily detected in the construction procedure introduced in Section 4 when a circuit can be defined in some partial order -i . It was the second problem that could arise in the transitivization procedure and it will be analyzed in this section. These results will be explained after introducing the family of posets analyzed in Trotter w14, pp. 98]99x. EXAMPLE 5.1. Let S3 s Ž X, P . be the standard example. The poset P3 s Ž X 3 , P3 . is constructed by taking Q1 , Q2 , and Q3 as disjoint copies of S3 and adding the comparabilities min Ž Q i . - max Ž Q iq1 .

in P3 for i s 1, 2, 3 Ž cyclically . .

A POSET DIMENSION ALGORITHM

201

FIG. 5. Hasse diagram of P3 .

The Hasse diagram of P3 is shown in Fig. 5. The incompatibility graph G*ŽP3 . has 24 vertices and verifies that Ž x G*ŽP3 .. s 4. However, with this minimal coloration, three vertices of V *Ž P . have the same color, col Ž Ž 10, 1 . . s col Ž Ž 14, 5 . . s col Ž Ž 17, 8 . . s 3, which is equivalent to 10 -3 1,

14 -3 5,

17 -3 8,

and taking into account the relations of the poset 1 - 14,

5 - 17,

8 - 10,

the circuit is defined in the partial order - as 3

10 -3 1 -3 14 -3 5 -3 17 -3 8 -3 10. Consequently, there exists a circuit in some L i : there are r distinct elements of X that verify x 1 -i x 2 -i ??? -i x r -i x 1 .

202

YANEZ ´˜ AND MONTERO

This situation can be easily checked and it is related to the existence of a hyperedge whose vertices are equally colored. In Example 5.1, the set Ž10, 1.; Ž14, 5.; Ž17, 8.4 is an alternating cycle of the poset P3 and, consequently, this coloration is not valid. It is not difficult to see that not one of the three graph edges linking the above vertices belongs to E*Ž P .. In this way, Example 5.1 has the property that K Ps 3 / graph Ž K Ps 3 . . The following proposition formalizes this idea. PROPOSITION 5.1. Gi¨ en the t-chromatic incompatibility graph G*ŽP. of a poset P, its dimension is equal to t if there exists no hyperedge E s y1 4  ay1 of the strict hypergraph of critical pairs K Ps that ¨ erify colŽ a 1 . 1 , . . . , ar s ??? s colŽ a r . s i for some i g  1, . . . , t 4 . Proof. By definition of K Ps , let E be the hyperedge that verifies the conditions of the proposition. Then  a 1 , . . . , a r 4 is a strict alternating cycle. Let a j s Ž x j , y j . for all j s 1, . . . , r. Then, if each of these vertices is equally colored, x j -i y j

; j s 1, . . . , r .

and there is a circuit in L i , x 1 -i y 1 - x 2 -i y 2 - ??? - x r -i yr - x 1 . Consequently, when there is no circuit in any of the partial order L i , the dimension of the poset P will be characterized as the chromatic number of the incompatibility graph, i.e., dim Ž P. s x Ž G* Ž P. . . Otherwise, if there exists a circuit in the partial order L i for some i g  1, . . . , t 4 , the strict alternating cycle contains those vertices of V *Ž P . that share the same color i and are the predecessors of the incomparable vertices of V Ž P . that define such a circuit. These vertices are intrinsically incompatible although they are not linked in E*Ž P .. This problem can be avoided by including the corresponding edges in the incompatibility graph. Obviously, the chromatic number of such an extended graph could increase and the process must be iterated until no hyperedges that verify the conditions of Proposition 5.1 exist. From a computational complexity point of view, the number of such included edges is polynomial with respect to the ground set X and, consequently, the problem remains NP-hard.

A POSET DIMENSION ALGORITHM

FIG. 6.

203

E*Ž P3 . y E*Ž P3 ..

If E*Ž P . includes the set E*Ž P . and all included edges by this procedure, an extended incompatibility graph will be obtained: G*ŽP. s Ž V *Ž P ., E*Ž P .. In Fig. 6 are shown the seven edges which are added to G*ŽP3 . to obtain G*ŽP3 .. The chromatic number of the graph Ž V *Ž P3 ., E*Ž P3 .. is 5 and a minimum realizer is L1 : 4 - 5 - 6 - 7 - 9 - 17 - 8 - 16 - 18 - 2 - 3 - 10 - 1 - 11 - 12 - 13 - 14 - 15, L2 : 1 - 3 - 7 - 8 - 9 - 11 - 2 - 10 - 12 - 5 - 6 - 13 - 4 - 14 - 15 - 16 - 17 - 18, L3 : 1 - 2 - 7 - 8 - 9 - 12 - 3 - 4 - 6 - 14 - 5 - 10 - 11 - 13 - 15 - 16 - 17 - 18, L4 : 1 - 2 - 3 - 4 - 5 - 15 - 6 - 13 - 14 - 8 - 9 - 16 - 7 - 10 - 11 - 12 - 17 - 18, L5 : 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 18 - 9 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17. 6. POSET DIMENSION ALGORITHM Based on the above procedures, an algorithm which computes the dimension of a general finite poset is proposed. Under the hypothesis of Proposition 5.1, the algorithm computes the true dimension of a poset.

204

YANEZ ´˜ AND MONTERO

When these hypothesis fail, the algorithm identifies the equally colored hyperedges and it computes an upper bound for the poset dimension. POSET DIMENSION ALGORITHM. 1. Data input: Let X s  1, . . . , k 4 be the ground set of the poset P s Ž X, P . Let E be the k = k adjacency matrix of relation P. Transitivity is assumed. 2. Consistency digraph construction GŽP. s ŽincŽ P ., UŽ P ... 3. Incompatibility graph construction G*ŽP. s Ž V *Ž P ., E*Ž P ... 4. Extension procedure G*ŽP. s Ž V *Ž P ., E*Ž P ..: Initialization E*Ž P . s E*Ž P . do Exact Minimal-Coloration procedure of G*ŽP. s Ž V *Ž P ., E*Ž P ... Let t s x Ž G*ŽP.. be its chromatic number. Let S be data structure of colored G*ŽP.. Procedure Minimum ] RealizerŽ S . if Žthere is no circuits in R . then dimŽP. s t R s  L1 , . . . , L t 4 is the minimum realizer of P. else There exists a hyperedge equally colored: Some edges are added to E*Ž P . endif while Žthere is no circuits in R . 5. Minimum realizer linearization The minimum realizer linearization begins when every colored vertex of V *Ž P . has been included in some L i . If these partial orders are linear, a minimum realizer is thus obtained; otherwise, let L i be a nonlinear partial order. Then there exist two elements of the ground set x, y g X which are incomparable with respect to L i ; one of the two pairs} Ž x, y . or Ž y, x . }is included in L i and, of course, transitivized. In this way, a minimum realizer is obtained. Furthermore, since the number t is the chromatic number of G*ŽP., any realizer with a number of linear extensions smaller than t would contain at least two incompatible pairs in the same L i . In order to deal with medium or large size posets, the exact minimalcoloration procedure of the algorithm can be changed by an approximate procedure which allows the computation of an upper bound for the chromatic number with a drastic reduction of computation time.

A POSET DIMENSION ALGORITHM

205

6.1. Computational experiences Based on the above poset dimension algorithm, two programs have been coded by means of an exact and a heuristic coloration procedure. The exact procedure is based on Brown’s algorithm and the heuristic procedure is based on the Korman’s algorithm w10x. Computing the poset dimension of Example 5.1, both programs have obtained the same value 5. But computing the poset dimension to the generalization of the Example 5.1 when n s 4, the exact algorithm cannot get the solution after 24 hours and the heuristic algorithm computed an upper bound of 7 in less than 2 minutes. Eight edges were included in the extension procedure. A lower bound of 6 for this poset dimension was obtained by Trotter w14, pp. 98]99x. These programs run in a compatible IBM PC and, taking into account the memory limits of MS-DOS operating system, the cardinal of the ground set of the poset must be lower than 90 and the number of relations of the poset must be lower than 700. Other imposed bounds are < V Ž P .< F 500, < V *Ž P .< F 150, the number of connected components of G*Ž P . must be bounded by 10, and the chromatic number must be lower than 9. Some additional results have been developed with three groups of random posets: 1. Given a ground set cardinal < X < s k, any couple of distinct elements will be ordered with a fixed probability p, the poset density, and the specific orientation is again randomized. For some values of k and p, 10 posets have been generated and five indices are computed for all of them. Four of these indices are evaluated through three statistics of the 10-poset sample: the minimum, median, and maximum values. For the fifth index, the dimension poset, the empirical distribution is computed. Table 1 shows the following statistics: < P <, the number of pairs of the poset. < V Ž P .<, the number of vertex of the consistency digraph. < V *Ž P .<, the number of vertex of the incompatibility graph. n ] cc, the number of connected components of G*Ž P .. The empirical distribution of the dimension poset. The noncomputed dimensions due to more than 10 connected components of G*Ž P . are identified by an asterisk Ž*.. Not one of these 70 random posets needed the extension procedure related with the existence of a hyperedge. Also, none of them had induced components. v v v v v

2. Another class of random posets can be generated through a random sequence of k real numbers from w0, 1x, the poset ground set. The order is defined by the product ordering. Consequently, the dimension

YANEZ ´˜ AND MONTERO

206

TABLE 1 dimŽ P . p


< P<

< V Ž P .<

< V *Ž P .<

n ] cc

1

2

3

*

0.3 0.5 0.8 0.5 0.8 0.3 0.5

20 20 20 50 50 75 75

Ž30, 35, 42. Ž41, 47.5, 51. Ž48, 52.5, 57. Ž152, 165.5, 179. Ž180, 189, 200. Ž232, 244, 260. Ž259, 282, 300.

Ž38, 69, 94. Ž0, 22, 40. Ž0, 5, 12. Ž28, 56, 82. Ž4, 10, 22. Ž182, 212, 232. Ž44, 64, 88.

Ž8, 15, 25. Ž0, 8, 12. Ž0, 4, 8. Ž15, 22.5, 28. Ž4, 7, 14. Ž35, 39, 50. Ž15, 20, 25.

Ž2, 3, 7. Ž0, 2, 4. Ž0, 2, 4. Ž4, 6, 8. Ž2, 3.5, 7. Ž5, 8.5, 10. Ž7, 8.5, 10.

0.0 0.1 0.2 0.0 0.0 0.0 0.0

1.0 0.9 0.8 0.9 1.0 0.1 0.4

0.0 0.0 0.0 0.1 0.0 0.7 0.0

0.0 0.0 0.0 0.0 0.0 0.2 0.6

TABLE 2 dimŽ P . k


< P<

< V Ž P .<

< V *Ž P .<

n ] cc

1

2

3

*

2 3

25 20

Ž101, 151, 194. Ž29, 45, 55.

Ž212, 307, 398. Ž270, 290, 312.

Ž37, 40, 55. Ž44, 75.5, 93.

Ž1, 1.5, 5. 1, 4, 10.

0.0 0.0

1.0 0.0

0.0 0.9

0.0 0.1

poset is bounded by k. For the values k s 2 and k s 3, ten posets have been generated and the associated statistics are shown in Table 2. In one of these 20 random posets there were induced components. 3. Another class of random posets can be defined from random graphs with n vertices and an edge probability p. The ground set of the poset P is the vertex set and two vertices i and j, with 1 F i - j F n, are ordered if they are connected with a sequence of edges. With this definition, if the generated graph is connected, the associated poset is a chain. For instance, given n s 25 and varying the edge probability p g  0.5, 0.1, 0.054 , the number of connected components of the random graphs is 1, 4, and 12, respectively; the number of ordered pairs of the posets are 300, 231, and 33. The computed dimensions are 1 and 2 for the first and second posets. The consistency digraph for the third poset has more than 500 vertices.

7. CONCLUDING REMARKS As pointed out by West w17x, the hypergraph associated to a poset P is in general huge. It is therefore suggested that the computation of dimŽ P . will not be an easy task. Taking into account some already known results

A POSET DIMENSION ALGORITHM

207

about complexity Žsee Garey et al. w5x and Yannakakis w18x., this article suggests that the general search problem associated to the partial order dimension is an N P-hard problem. However, the algorithm outlined in this article allows the computation of modest size posets, which show a relevant tool in practice. Indeed, evidence supporting the effectiveness of this algorithm has been shown. With the algorithm proposed in this article, for instance, the typographical error in the Hasse diagram of a poset described in Trotter w14, p. 31x. has been checked. Such a four-dimensional poset Žsee Reuter w13x. has the property that removing one fixed critical pair leaves a two-dimensional subposet. Reuter’s counterexample is not at all unique. Kierstead and Trotter w9x have shown that for every integer t ) 4 there exists a t-dimensional poset P containing a critical pair Ž x, y ., so that removing x and y leaves a subposet of dimension t y 2. The computation time of the algorithm grows exponentially with poset size. This fact is explained by the exact coloration procedure, which is the bottleneck of our algorithm. If the exact procedure is replaced by an appropriate heuristic, the algorithm can be used to approach the dimension of medium and large size posets.

ACKNOWLEDGMENTS We thank Professor Trotter for his kind remarks and also for pointing out possible research trends related to this article.

REFERENCES 1. K. Bogart and W. T. Trotter, Maximal dimensional partially ordered sets III: A characterization of Hiraguchi’s inequality for interval dimensions, Discrete Math. 15 Ž1976., 389]400. 2. B. Dushnik and E. W. Miller, Partially ordered sets, Amer. J. Math. 63 Ž1941., 600]610. 3. P. C. Fishburn, ‘‘Interval Orders and Interval Graphs,’’ Wiley, New York, 1985. 4. P. C. Fishburn and W. T. Trotter, Posets with large dimension and relatively few critical pairs, Order 10 Ž1993., 317]328. 5. M. R. Garey and D. S. Johnson, ‘‘Computer and Intractability: A Guide to the Theory of NP-Completeness, Freeman, San Francisco, 1978. 6. M. C. Golumbic, ‘‘Algorithmic Graph Theory and Perfect Graphs,’’ Academic Press, New York, 1980. 7. D. Kelly, The 3-irreducible partially ordered sets, Canad. J. Math. 29 Ž1977., 367]383. 8. D. Kelly and W. T. Trotter, Dimension theory for ordered sets, in ‘‘Ordered Sets’’ ŽI. Rival, Ed.., pp. 171]212, North-Holland, Amsterdam, 1982. 9. H. A. Kierstead and W. T. Trotter, A note on removable pairs, in ‘‘Graph Theory, Combinatorics and Applications,’’ Vol. 2 ŽY. Alavl et al., Eds.., Wiley, New York, 1991.

208

YANEZ ´˜ AND MONTERO

10. S. M. Korman, The graph colouring problem, in ‘‘Combinatorial Optimization’’ ŽN. Christophides et al., Eds.., Wiley, Chichester, 1979. 11. S. B. Maurer and I. Rabinovitch, Large minimal realizers of a partial order, Proc. Amer. Math. Soc. 66 Ž1978., 211]216. 12. O. Ore, ‘‘Theory of graphs,’’ Colloquium Publication, Vol. 38, American Mathematical Society, Providence, RI, 1962. 13. K. Reuter, Removing critical pairs, Order 6 Ž1989., 107]118. 14. W. T. Trotter, ‘‘Combinatorics and Partially Ordered Sets. Dimension Theory,’’ Johns Hopkins University Press, Baltimore, 1992. 15. W. T. Trotter and J. I. Moore, Characterization problems for graphs, partially ordered sets, lattices and families of sets, Discrete Math. 16 Ž1976., 361]381. 16. W. T. Trotter, J. I. Moore, and D. P. Sumner, The dimension of a comparability graph, Proc. Amer. Math. Soc. 60 Ž1976., 35]38. 17. D. B. West, Parameters of partial orders and graphs: Packing, covering, and representation, in ‘‘Graphs and Orders,’’ ŽI. Rival, Ed.., pp. 267]350, North-Holland, Amsterdam, 1985. 18. M. Yannakakis, On the complexity of the partial order dimension problem, SIAM J. Algebra Discrete Methods 3 Ž1982., 351]358.