# Precedence thinness in graphs

Interval and proper interval graphs are very well-known graph classes, for which there is a wide literature. As a consequence, some generalizations of interval graphs have been proposed, in which graphs in general are expressed in terms of k interval graphs, by splitting the graph in some special way. As a recent example of such an approach, the classes of k-thin and proper k-thin graphs have been introduced generalizing interval and proper interval graphs, respectively. The complexity of the recognition of each of these classes is still open, even for fixed k ≥ 2. In this work, we introduce a subclass of k-thin graphs (resp. proper k-thin graphs), called precedence k-thin graphs (resp. precedence proper k-thin graphs). Concerning partitioned precedence k-thin graphs, we present a polynomial time recognition algorithm based on PQ-trees. With respect to partitioned precedence proper k-thin graphs, we prove that the related recognition problem is -complete for an arbitrary k and polynomial-time solvable when k is fixed. Moreover, we present a characterization for these classes based on threshold graphs.

## Authors

• 8 publications
• 4 publications
• 2 publications
• 7 publications
• ### Vertebrate interval graphs

A vertebrate interval graph is an interval graph in which the maximum si...
09/24/2021 ∙ by Rain Jiang, et al. ∙ 0

• ### On the Maximum Cardinality Cut Problem in Proper Interval Graphs and Related Graph Classes

Although it has been claimed in two different papers that the maximum ca...
06/06/2020 ∙ by Arman Boyacı, et al. ∙ 0

• ### The Interval function, Ptolemaic, distance hereditary, bridged graphs and axiomatic characterizations

In this paper we consider certain types of betweenness axioms on the int...
05/14/2020 ∙ by Manoj Changat, et al. ∙ 0

• ### Circularly compatible ones, D-circularity, and proper circular-arc bigraphs

In 1969, Alan Tucker characterized proper circular-arc graphs as those g...
06/02/2019 ∙ by Martín D. Safe, et al. ∙ 0

• ### Letter graphs and geometric grid classes of permutations: characterization and recognition

In this paper, we reveal an intriguing relationship between two seemingl...
04/27/2018 ∙ by Bogdan Alecu, et al. ∙ 0

• ### Interval-Permutation Segment Graphs

In this work, we introduce the interval permutation segment (IP-SEG) mod...
08/27/2019 ∙ by Zlatko Joveski, et al. ∙ 0

• ### Breadth-First Rank/Select in Succinct Trees and Distance Oracles for Interval Graphs

We present the first succinct data structure for ordinal trees that supp...
05/15/2020 ∙ by Meng He, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

The class of -thin graphs has recently been introduced by Mannino, Oriolo, Ricci and Chandran in Carl07 as a generalization of interval graphs. Motivated by this work, Bonomo and de Estrada Bono18 defined the class of proper -thin graphs, which generalizes proper interval graphs. A -thin graph is a graph for which there is a -partition , and an ordering of such that, for any triple of ordered according to , if and are in a same part and , then . Such an ordering and partition are said to be consistent. A graph is called a proper -thin graph if admits a -partition , and an ordering of such that both and its reversal are consistent with the partition . An ordering of this type is said to be a strongly consistent ordering. The interest on the study of both these classes comes from the fact that some NP-complete problems can be solved in polynomial time when the input graphs belong to them Carl07 ; Bono18 ; B-M-O-thin-tcs . Some of those efficient solutions have been exploited to solve real world problems as presented in Carl07 .

On a theoretical perspective, defining general graphs in terms of the concept of interval graphs has been of recurring interest in the literature. Firstly, note that these concepts measure “how far” a given graph is from being an interval graph, or yet, how can be “divided” into interval graphs, mutually bonded by a vertex order property. Namely, the vertices can be both partitioned and ordered in such a way that, for every part of the partition and every vertex of the ordering, the vertex ordering obtained from the original by the removal of all vertices except from and those in that precede , no matter which part belongs, is a canonical ordering of an interval graph. Characterizing general graphs in terms of the concept of interval graphs, or proper interval graphs, is not new. A motivation for such an approach is that the class of interval graphs is well-known, having several hundreds of research studies on an array of different problems on the class, and formulating general graphs as a function of interval graphs is a way to extend those studies to general graphs. Given that, both -thin and proper -thin graphs are new generalizations of this kind. The complexity of recognizing whether a graph is -thin, or proper -thin, is still an open problem even for a fixed . For a given vertex ordering, there are polynomial time algorithms that compute a partition into a minimum number of classes for which the ordering is consistent (resp. strongly consistent) Bono18 ; B-M-O-thin-tcs . On the other hand, given a vertex partition, the problem of deciding the existence of a vertex ordering which is consistent (resp. strongly consistent) with that partition is NP-complete Bono18 .

Other generalizations of interval graphs have been proposed. As examples, we may cite the -interval and -track interval graphs. A -interval is the union of disjoint intervals on the real line. A -interval graph is the intersection graph of a family of -intervals. Therefore, the -interval graphs generalize the concept of interval graphs by allowing a vertex to be associated with a set of disjoint intervals. The interval number of  Trotter1979OnDA is the smallest number for which has a -interval model. Clearly, interval graphs are the graphs with . A -track interval is the union of disjoint intervals distributed in parallel lines, where each interval belongs to a distinct line. Those lines are called tracks. A -track interval graph is the intersection graph of -track intervals. The multitrack number of  Kumar94 ; Gyarfas95 is the minimum such that is a -track interval graph. Interval graphs are equivalent to the -interval graphs and -track interval graphs. The problems of recognizing -interval and -track interval graphs are both NP-complete West84 ; Jiang2013 , for every .

In this paper, we define subclasses of -thin and proper -thin graphs called precedence -thin and precedence proper -thin graphs, respectively, by adding the requirement that the vertices of each class have to be consecutive in the order. In both cases, when the vertex order is given, it can be proved that a greedy algorithm can be used to find a (strongly) consistent partition into consecutive sets with minimum number of parts. When, instead, the partition into parts is given, the problem turns out to be more interesting. We will call partitioned precedence -thin graphs (resp. partitioned precedence proper -thin graphs) the graphs for which there exists a (strongly) consistent vertex ordering in which the vertices of each part are consecutive for the given partition. Concerning partitioned precedence -thin graphs, we present a polynomial time recognition algorithm. With respect to partitioned precedence proper -thin graphs, we provide a proof of NP-completeness for arbitrary , and a polynomial time algorithm when is fixed. Also, we provide a characterization for both classes based on threshold graphs.

This work is organized as follows. Section 2 introduces the basic concepts and terminology employed throughout the text. Section 3 presents a polynomial time recognition algorithm for partitioned precedence -thin graphs. Section 4 proves the NP-completeness for the recognition problem of partitioned precedence proper -thin graphs. Moreover, it proves that if the number of parts of the partition is fixed, then the problem is solvable in polynomial time. In Section 5, we describe a characterization for precedence -thin and precedence proper -thin graphs. Finally, Section 6 presents some concluding remarks.

## 2 Preliminaries

All graphs in this work are finite and have no loops or multiple edges. Let be a graph. Denote by its vertex set, by its edge set. Denote the size of a set by . Unless stated otherwise, and . Let , define and as adjacent if .

Let . The induced subgraph of by , denoted by , is the graph , where . Analogously, for some , let the induced subgraph of by , denoted by , be the graph , where . A graph obtained from by removing the vertex is defined as , where

Let , denote by the neighborhood of , and by the closed neighborhood of . We define as true twins (resp. false twins) if (resp. ). A vertex of is universal if . We define the degree of , denoted by , as the number of neighbors of in , i.e.

A clique or complete set (resp. stable set or independent set) is a set of pairwise adjacent (resp. nonadjacent) vertices. We use maximum to mean maximum-sized, whereas maximal means inclusion-wise maximal. The use of minimum and minimal is analogous. A vertex is said to be simplicial if is a clique.

A coloring of a graph is an assignment of colors to its vertices such that any two adjacent vertices are assigned different colors. The smallest number such that admits a coloring with colors (a -coloring) is called the chromatic number of and is denoted by . A coloring defines a partition of the vertices of the graph into stable sets, called color classes.

A graph is a comparability graph if there exists an ordering of such that, for each triple with , if and are edges of , then so is . Such an ordering is a comparability ordering. A graph is a co-comparability graph if its complement is a comparability graph.

A tree is a connected graph that has no cycles. A rooted tree is a tree in which a vertex is labeled as the root of the tree. All vertices, known as nodes of , have implicit positions in relation to the root. Let , is a descendant of if the path from to includes . The node is said to be a child of if it is a descendant of and . The children of is defined as the set that containing all child nodes of . The node is said to be a leaf of if it has no child in . The subtree of rooted at the node is the rooted tree that consists of as the root and its descendants in as the nodes.

A directed graph, or digraph, is a graph such that

consists of ordered pairs of

. A directed cycle of a digraph is a sequence , , of vertices of such that and, for all , . A directed acyclic graph (DAG) is a digraph with no directed cycles. A topological ordering of a DAG is a sequence of such that there are no such that . Determining a topological ordering of a DAG can be done in time  Knuth1 .

An ordering of elements of a set , denoted by , consists of a sequence of all elements of . We define as the reversal of , that is, . We say that precedes in , denoted by , if . An ordered tuple of some elements of is ordered according to when, for all , if and , then . Given orderings and , the ordering obtained by concatenating to is denoted by .

### 2.1 Interval graphs

The intersection graph of a family of sets is the graph such that and are adjacent if and only if . An interval graph is the intersection graph of a family of intervals of the real line; such a family is called an interval model, or a model, of the graph. We say that is associated to and vice-versa. It is worth mentioning that an interval graph can be associated to several models but an interval model can be associated to a unique graph. Concerning interval graphs, there are some characterizations which are relevant to this work, that we present next.

###### Theorem 1 (Olariu91 ).

A graph is an interval graph if, and only if, there is an ordering of such that, for any triple of ordered according to , if , then .

The ordering described in Theorem 1 is said to be a canonical ordering. Figure 1 depicts an interval graph in which the vertices are presented from left to right in one of its canonical orderings.

Let be an interval model of an interval graph . Note that, if we consider a vertical line that intersects a subset of intervals in , then these intervals consist of a clique in . This is true because they all contain the point in which this line is defined. Moreover, if the given line traverses a maximal set of intervals, then the corresponding clique is maximal. Figure 2 depicts an interval model and the vertical lines that correspond to maximal cliques of the graph in Figure 1. The following is a characterization of interval graphs in terms of the maximal cliques of the graph.

###### Theorem 2 (Roberts69 ).

A graph is an interval graph if, and only if, there is an ordering of its maximal cliques such that if with , then , for all .

The ordering described in Theorem 2 is said to be a canonical clique ordering. The ordering of the maximal cliques depicted in Figure 2, read from left to right, represents a canonical clique ordering.

A proper interval graph is an interval graph that admits an interval model in which no interval properly contains another. There is a characterization of proper interval graphs which is similar to that presented in Theorem 1, as described next.

###### Theorem 3 (Roberts69 ).

A graph is a proper interval graph if, and only if, there is an ordering of such that, for any triple of ordered according to , if , then .

The ordering specified in the previous theorem is defined as a proper canonical ordering. The ordering of the vertices of the graph depicted in Figure 1 from left to right is proper canonical. Note that a proper canonical ordering is also a canonical ordering. An important property of proper canonical orderings is the following:

###### Lemma 4 (Roberts69 ).

If is a connected proper interval graph. Then a proper canonical ordering of is unique up to reversion and permutation of mutual true twin vertices.

As a consequence, if a proper interval graph is disconnected, since each component has a unique proper canonical ordering, then the canonical ordering of consists of a permutation of canonical orderings of each of those components.

Let be an ordering of and an ordering of the maximal cliques of . The sequence is said to be ordered according to if for all such that in , there are no such that and . As an example, note that the canonical ordering of the Figure 1 is ordered according to the maximal clique ordering of the Figure 2. The following lemma relates the characterization of canonical orderings and canonical clique orderings.

###### Lemma 5.

Let be a graph and be an ordering of . The ordering is a canonical ordering of if, and only if, is ordered according to a canonical clique ordering of .

###### Proof.

Consider a canonical clique ordering of . We will show that is possible to build a canonical ordering from , respecting its clique ordering. To achieve this, first start with an empty sequence . Iteratively, for each element of the sequence , choose all simplicial vertices of , adding them to in any order and removing them from . Note that some of the vertices of that were not removed from , because they were not simplicial in , now may be turned simplicial by the removal of vertices. Clearly, at the end of the process, will contain all the vertices of . Suppose is not a canonical ordering, that is, there are , in , such that and . Let , and be the maximal cliques of

being processed at moment

, and were choose, respectively. Note that in and, as is the last maximal clique in that contains and , . Besides, as , . Therefore, and . A contradiction with the fact that is a canonical clique ordering. Hence, is a canonical ordering.

Consider be a canonical ordering of . We prove by induction in that is ordered according to a canonical clique ordering. Clearly, the statement is true for . Suppose that the statement is true for any . Let be the sequence obtained from by removing . Clearly is also a canonical ordering and, by the induction hypothesis, is ordered according with a canonical clique ordering . Let , with , be the first clique of such that . Let , . Note that, as is a canonical ordering, for all of , , is a maximal clique of . If , then is a canonical clique ordering that matches . Otherwise, is a canonical clique ordering that matches . Therefore, is ordered according to a canonical clique ordering of . ∎

#### 2.1.1 PQ trees

A tree BOOTH76 is a data structure consisting of an ordered tree that describes a family of permutations of elements from a given set . In a tree , the set of leaves is and the permutation being represented by

is the sequence of the leaves from left to right. Regarding internal nodes, they are classified into two types, the

and the nodes. An equivalent tree to is a tree obtained from by any sequence of consecutive transformations, each consisting of either permuting the children of a node, or reversing the children of a node. The family of permutations of elements from represented by is that of permutations corresponding to all equivalent trees to .

Graphically, in a tree, leaves and nodes are represented by circles and nodes by rectangles. In representations of schematic trees, a node represented by a circle over a rectangle will denote that, in any concrete tree conforming the scheme, such a node is either a node, or a node. Figure 3 depicts the described operations. In Figure 3, we have a partial representation of a tree. Figure 3 depicts an equivalent tree obtained from a permutation of children of a node of this tree and Figure 3 exemplifies an equivalent tree from the reversion of the children of a node.

One of the applications from the seminal paper introducing trees is that of recognizing interval graphs. In such an application, each leaf of the tree is a maximal clique of an interval graph and the family of permutations the tree represents is precisely all the canonical clique orderings of  BOOTH76 . A tree can be constructed from an interval graph in time  BOOTH76 .

We will say that a vertex belongs to a node of a tree, and naturally denote by , if it belongs to any leaf that descends from this node. Figure 4 depicts a tree of the interval graph of Figure 1 according to the maximal cliques in Figure 2. The permutations implicitly represented by this tree are:

Figure 4: A tree of the interval graph of Figure 1 according to the maximal cliques in Figure 2.

### 2.2 Thinness and proper thinness

A graph is called a -thin graph if there is a -partition of and an ordering of such that, for any triple of ordered according to , if and are in a same part and , then . An ordering and a partition satisfying that property are called consistent. That is, a graph is -thin if there is an ordering consistent with some -partition of its vertex set. The thinness of , denoted by , is the minimum for which is a -thin graph.

A graph is called a proper -thin graph if admits a -partition of and an ordering of consistent with the partition and, additionally, for any triple of , ordered according to , if and are in a same part and , then . Equivalently, an ordering of such that and its reverse are consistent with the partition. Such an ordering and partition are called strongly consistent. The proper thinness of , or , is the minimum for which is a proper -thin graph.

Figures 5 and 5 depict two bipartitions of a graph, in which the classes are represented by distinct colors, and two different vertex orderings. The ordering of Figure 5 is consistent with the corresponding partition but not strongly consistent, while the ordering of Figure 5 is strongly consistent with the corresponding partition.

Note that -thin graphs (resp. proper -thin graphs) generalize interval graphs (resp. proper interval graphs). The -thin graphs (resp. proper -thin graphs) are the interval graphs (resp. proper interval graphs). The parameter (resp. ) is in a way a measure of how far a graph is from being an interval graph (resp. proper interval graph).

For instance, consider the graph . Since is not an interval graph, . Figure 5 proves that .

A characterization of -thin or proper -thin graphs by forbidden induced subgraphs is only known for -thin graphs within the class of cographs Bono18 . Graphs with arbitrary large thinness were presented in Carl07 , while in Bono18 a family of interval graphs with arbitrary large proper thinness was used to show that the gap between thinness and proper thinness can be arbitrarily large. The relation of thinness and other width parameters of graphs like boxicity, pathwidth, cutwidth and linear MIM-width was shown in Carl07 ; Bono18 .

Let be a graph and an ordering of its vertices. The graph has as vertex set, and is such that for , if and only if there is a vertex in such that , and . Similarly, the graph has as vertex set, and is such that for , if and only if either there is a vertex in such that , and or there is a vertex in such that , and .

###### Theorem 6.

Bono18 ; B-M-O-thin-tcs Given a graph and an ordering of its vertices, a partition of is consistent (resp. strongly consistent) with the ordering if and only if the partition is a valid coloring of (resp. ), which means that each part corresponds to a color in the coloring under consideration.

### 2.3 Precedence thinness and precedence proper thinness

In this work, we consider a variation of the problems described in the last subsection by requiring that, given a vertex partition, the (strongly) consistent orderings hold an additional property.

A graph is precedence -thin (resp. precedence proper -thin), or -PT (resp. -PPT), if there is a -partition of its vertices and a consistent (resp. strongly consistent) ordering for which the vertices that belong to a same part are consecutive in . Such an ordering is called a precedence consistent ordering (resp. precedence strongly consistent ordering) for the given partition. We define - (resp. -) as the minimum value for which is -PT (resp. -PPT).

The Figure 6 illustrates a graph that is a -PPT graph. The convention assumed is that the strongly consistent ordering being represented consists of the vertices ordered as they appear in the figure from bottom to top and, for vertices arranged in a same horizontal line, from left to right. Therefore, the strongly consistent ordering represented in Figure 6 is . The graph is not -PPT, despite . It can be easily verified by brute-force that, for all possible bipartitions of its vertex set and for all possible orderings in which the vertices of a same part are consecutive in , the ordering and the partition are not strongly consistent. On the other hand, a -PPT graph is a proper -thin graph. Therefore, the class of -PPT graphs is a proper subclass of that of proper -thin graphs.

If a vertex order is given, by Theorem 6, any partition which is precedence (strongly) consistent with is a valid coloring of (resp. ) such that, additionally, the vertices on each color class are consecutive according to . A greedy algorithm can be used to find a minimum vertex coloring with this property in polynomial time. Such method is described next, in Theorem 7.

###### Theorem 7.

Let be a graph and an ordering of . It is possible to obtain a minimum -partition of , in polynomial time, such that is a precedence (strongly) consistent ordering concerning .

###### Proof.

Consider the following greedy algorithm that obtains an optimum coloring of (resp. ) in which vertices having a same color are consecutive in . That is, is a precedence consistent (resp. precedence strongly consistent) ordering concerning the partition defined by the coloring. Color with color . For each , , let be the last color used. Then color with color if there is no , , colored with such that (resp. ). Otherwise, color with color . We show, by induction on , that the algorithm finds an optimal coloring in which each vertex has the least possible color.

The case where is trivial. Suppose that the algorithm obtains an optimum coloring of (resp. ), for orderings having size less than . Remove the last vertex from and (resp. ) and use the given algorithm to color the resulting graph. By the induction hypothesis, the chosen coloring for is optimal. Moreover, the colors are non-decreasing and each vertex is colored with the least possible color. Now, add the removed vertex to and to the graph (resp. ), with its respective edges, and let the algorithm choose a coloring for it. If the color of is equal to the color of the algorithm is optimal by the induction hypothesis. Otherwise, is colored with a new color . Suppose the chosen coloring is not optimal. That is, it is possible to color with an existing color. This implies that there is at least a neighbor of , in (resp. ), that can be recolored with a smaller color. This is an absurd because the algorithm has already chosen the least possible color for all the vertices of (resp. ), relative to . ∎

In the following sections, we will deal with the case where the vertex partition is given and the problem consists of finding the vertex ordering. From now on, we will then simply call precedence consistent ordering (resp. precedence strongly consistent ordering) to one that is such for the given partition.

## 3 Precedence thinness for a given partition

In this section, we present an efficient algorithm to precedence -thin graph recognition for a given partition. This algorithm uses trees and some related properties to validate precedence consistent orderings in a greedy fashion, iteratively choosing an appropriate ordering of the parts of the given partition that satisfies precedence consistence, if one does exist. Formally, the problem addressed in this chapter is the following.

Problem: Partitioned -PT (Recognition of -PT graphs for a given
partition)
Input: A natural , a graph and a partition of .
Question: Is there a consistent ordering of such that the vertices
of are consecutive in , for all ?

It should be noted that a precedence consistent ordering consists of a concatenation of the consistent orderings of , for all . That is, , where is a permutation of and is a canonical ordering of , for all . The following property is straightforward from the definition of a precedence consistent ordering.

###### Property 1.

Let be a partition of , a precedence consistent ordering and . If precedes in , then, for all and , if and , then precedes in .

Property 1 shows that, for any given consistent ordering , the vertices of impose ordering restrictions on the vertices of , for all . This relation is depicted in Figure 7. This property will be used as a key part of the greedy algorithm to be presented later on.

Let be a ordering of the maximal cliques of an interval graph obtained from a tree . Recall from Section 2 that it is possible to obtain a canonical ordering ordered according to . Let . We define as compatible with the ordering restriction if there exists a canonical ordering ordered according to such that in . The following theorem describes compatibility conditions between a tree and an ordering restriction .

###### Theorem 8.

Let be an interval graph and be a tree of . Let be a node of with children and . Denote by the subtree rooted at . The following statements are true.

1. if belongs to all leaves of , then is compatible with (see Figure 8).

2. Let . If , , and is compatible with , then precedes in (see Figure 8).

###### Proof.

Let be the graph induced by the union of the leaves of .

1. Let be a canonical ordering of and the ordering obtained from by moving to the last position. As is an universal vertex from , is also a canonical ordering of this graph. Consequently, is compatible with .

2. Suppose precedes in and is compatible with . As , then by Theorem 2, there is no such that precedes and . Otherwise, there would exist three maximal cliques such that in the ordering of cliques represented in and such that , . Therefore in any canonical ordering of (Lemma 5), a contradiction because is compatible with . Thus, precedes in . ∎

Theorem 8 can be used to determine the existence of a tree compatible with an ordering restriction . This task can be achieved by considering as the node of Theorem 8, each one of the nodes of a given tree . If violates the conditions imposed by the theorem, is “annotated” in a way that the set of equivalent trees is restricted, avoiding precisely the violations. This procedure continues until all nodes produce their respective restrictions, in which case any equivalent tree allowed by the “annotated” tree is compatible with the given ordering restrictions. If there is no equivalent tree to the “annotated” tree , which means there is no way to avoid the violations, then there is no tree which is compatible with such an ordering restriction.

The general idea to “anotate” a tree is to use an auxiliary digraph to represent required precedence relations among the vertices. This digraph is constructed for each part and any topological ordering of it results in a precedence consistent ordering concerning the vertices of this part. Property 1 is applied to determine the ordering restrictions of the vertices and Theorem 8 to ensure that at the end of the algorithm the vertices are ordered according to a canonical clique ordering. Such a procedure is detailed next.

First, the algorithm validates if each part of the partition induces an interval graph. This step can be accomplished, for each part, in linear time BOOTH76 . If at least one of these parts does not induce an interval graph, then the answer is NO. Otherwise, the algorithm tries each part as the first of a precedence consistent ordering. For each candidate part , , it builds a digraph to represent the order conditions that the vertices of must satisfy in the case in which precedes all the other parts of the partition. That is, must be ordered in such a way that it is according to a canonical clique ordering and respects the restrictions imposed by Property 1. In this strategy, the vertex set of is and its directed edges represent the precedence relations among its vertices. Namely, if, and only if, must precede in all precedence consistent orderings that have as its first part. The algorithm uses Property 1 to find all the ordering restrictions among the vertices of imposed by the others parts, adding the related directed edges to . Then, by building a tree of , Theorem 8 is used to transform into ensuring that all those ordering restrictions are satisfied. If there is a tree of that is compatible with all the ordering restrictions imposed by Property 1, then the algorithm adds directed edges to according to the canonical clique ordering represented by . This step is described below in the Algorithm 1 and it is similar to the one described in Lemma 5. At this point, is finally constructed and the existence of a topological ordering for its vertices determines whether can be chosen as the first part of a precedence consistent ordering for the given partition. If that is the case, is chosen as the first part and the process is repeated in to choose the next part. If no part can be chosen at any step, the answer is NO. Otherwise, a feasible ordering of the parts and of the vertices within each part is obtained and the answer is YES. Next, the validation of the compatibility of is described in more detail.

For each imposed ordering (that is, ), is traversed node by node, applying Theorem 8. As a consequence of such an application, if the order of the children of some node of must be changed to meet some restrictions, directed edges are inserted on to represent such needed reorderings. Those directed edges appear among nodes that are children of a same node in . At the end, to validate if is compatible with all needed reorderings of children of nodes, a topological ordering is applied to the children of each node. If there are no cycles among the children of each node, then there is an equivalent tree compatible with all the restrictions. In this case, is obtained from applying the sequence of permutations of children of nodes and reversals of children of nodes which are compliant to the topological orderings. Otherwise, if it is detected a cycle in some topological sorting, then there is no tree of which is compatible with all the set of restrictions. In other words, can not be chosen as the first part in a precedence consistent ordering for the given partition. Algorithm 2 formalizes the procedure.

To illustrate the execution of Algorithm 2, consider the graph as defined in Figure 9 and the -partition of where , e . For the sake of clearness, in Figure 9, the edges with endpoints in distinct parts are depicted in black, the edges with endpoints in a same part are in light gray and the vertices belonging to distinct parts are represented with different colors. Moreover, the vertices of each part, read from the left to right, consist of a canonical ordering of the graph induced by that part. Each part of induces the interval graph depicted in Figure 10. Figure 10 depicts a model of . In this model, all maximal cliques are represented by vertical lines. Figure 10 represents a tree of in which each maximal clique is labeled according to the model in Figure 10.

Suppose that, at the first step, the algorithm tries to choose as the first part of the precedence consistent ordering. As mentioned, and, according to the model in Figure 10, has maximal cliques , , , , , , and . Concerning the edges between and and according to Property 1, the vertex of must succeed all the other vertices of this part in any valid canonical ordering. This requirement is translated into the corresponding tree through directed edges as depicted in Figure 11. Let be the current node of . Note that if is a node, then any imposed ordering of a pair of its children implies in ordering all of them. In Figure 11, the oriented edges deriving from Property 1 are represented in blue and the edges deriving from the orientation demanded by nodes, due to the presence of the blue ones, are represented in orange. Clearly, there is a valid tree that satisfies such orientations. Now the algorithm adds the directed edges to the tree deriving from fact that must also precede . Considering the edges between and , and according to Property 1, the vertex of must succeed all the other vertices of in any valid canonical ordering. This requirement is translated into the tree in Figure 11, resulting in the tree in Figure 11. Clearly, no tree can satisfy the given orientation due to the directed cycle at the first level of the tree. Then, can not precede both and .

As can not be chosen as the first part, the algorithm tries another part as the first of the precedence consistent ordering. Suppose it now chooses as the first part. The interval graph has as maximal cliques , , , , , , and . Note that, as there are no edges between and , can precede in any valid consistent ordering. The algorithm must decide whether can precede . According to the Figure 9 and Property 1, the vertices of must succeed all the other vertices of the same part in any valid consistent ordering. This requirement is again translated into directed edges in the tree of as depicted in Figure 11. Clearly, there is a tree satisfying those directed edges. Then, the algorithm adds the edges deriving from the canonical clique ordering represented by to . Figure 12 depicts the final state of once the necessary edges has been added. In this figure, the edges deriving from Property 1 are presented with an orange color and the edges related to are presented in a blue color. For readability, in these figures the edges that can be obtained by transitivity are omitted. As there no cycles in , can precede and . A topological ordering of leads to the canonical ordering of .

After deciding as the first part, the algorithm uses the same process to choose the second part. Suppose it tries as the second part. Figure 11 depicts the edges added to the tree of . As there are no cycles in the edges added, there is a tree which is compatible with the precedence relations associated with . Figure 12 depicts the final state of the digraph related to . As there are no cycles in , can precede , so the algorithm chooses it as the second part. Finally, the algorithm chooses as the last part and determine that there is a precedence consistent ordering such that .

Concerning the complexity of the given strategy, each time one of the parts is tried to be the first, we build a new digraph , a new tree and obtain the precedence relations according to Property 1. Enumerating all the precedence relations requires at most steps, which is the time that it takes to iterate over all triples of vertices of the graph. Moreover, each one of these relations must be mapped to , which takes time , and . First, note that the number of nodes of is asymptotically bounded by its number of leaves, that is, by the number of maximal cliques of the part being processed. As the number of maximal cliques is bounded by the number of vertices of the given part, the number of nodes of is . Consequently, it is possible to model a precedence relation of type into , using Theorem 8, in time . To achieve this, first is traversed, in order to decide which nodes contain (resp. not contain) and . A traversal of can be done in time , and can be constructed in time. Additional steps will be necessary and generate new traversals in following the tree levels, with the purpose to add the necessary directed edges among the vertices that are children of the same node. This step can be done in

 ∑v∈V(T)d2(v)≤∑v∈V(T)d(v)|V(T)|=O