1 Introduction

Let Q = {q1,…,qk} be a set of k sequences \(q_{i}=(b_{i,1},\ldots ,b_{i,n_{i}})\), 1 ≤ ik. All n1 + … + nk items bi,j are pairwise distinct. Further there is a function t which assigns every item bi,j with a type t(bi,j). The sequence digraph g(Q) = (V,A) for a set Q = {q1,…,qk} has a vertex for every type and an arc (u,v) ∈ A if and only if there is some sequence qi in Q where an item of type u is on the left of some item of type v.Footnote 1 The contributions of this paper concern graph theoretic properties of sequence digraphs and an algorithm to compute from a given set Q on k sequences the directed path-width of g(Q). In Section 2 we give preliminaries for graphs and digraphs. In Section 3 we show how to define digraphs from sets of sequences, and vice versa. Further we give methods in order to compute the sequence digraph and also its complement digraph. In Section 4 we consider graph theoretic properties of sequence digraphs. Therefore in Section 4.1 we introduce the class Sk, as the set of all sequence digraphs defined by sets Q on at most k sequences that together contain at most items of each type. We show inclusions of these classes and necessary conditions for digraphs to be in Sk,. In Section 4.2 we give finite sets of forbidden induced subgraphs for all classes S1,1 and S1,2. It turns out that S1,1 is equal to the well known class of transitive tournaments. Since only the first and the last item of each type in every qiQ are important for the arcs in the corresponding digraph all classes S1,, ≥ 2 are equal and can be characterized by one set of four forbidden induced subdigraphs. These characterizations lead to polynomial time recognition algorithms for the corresponding graph classes. Furthermore we give characterizations in terms of special tournaments and conditions for the complement digraph. In Section 4.3 we consider the closure of the classes Sk, with respect to the operations taking the converse digraph and taking the complement digraph. In Section 4.4 we characterize sequences whose defined graphs can be obtained by the union of the graphs for the subsequences which consider only the first or last item of each type.

In Section 5 we consider the directed path-width problem on sequence digraphs. We show that for digraphs defined by k = 1 sequence the directed path-width can be computed in polynomial time. Further we show that for sets Q of sequences of bounded length, of bounded distribution of the items of every type onto the sequences, or bounded number of items of every type computing the directed path-width of g(Q) is NP-hard. We also introduce a method which computes from a given set Q on k sequences the directed path-width of g(Q), as well as a directed path-decomposition can be computed in time \(\mathcal {O}(k\cdot (1+\max \limits _{1\leq i \leq k}n_{i})^{k})\). The main idea is to discover an optimal directed path-decomposition by scanning the k sequences left-to-right and keeping in a state the numbers of scanned items of every sequence and the number of active types.

From a parameterized point of view our method leads to an XP-algorithm w.r.t. parameter k. While the existence of FPT-algorithms for computing directed path-width is open up to now, there are XP-algorithms for the directed path-width problem for some digraph G = (V,A). The directed path-width can be computed in time \({\mathcal {O}}\left (|A|\cdot |V|^{2\text {d-pw}(G)}/(\text {d-pw}(G)-1)!\right )\) by [3] and in time \({\mathcal {O}}(\text {d-pw}(G)\cdot |A|\cdot |V|^{2\text {d-pw}(G)})\) by [4]. Further in [5] it is shown how to decide whether the directed path-width of an -semicomplete digraph is at most w in time \((\ell +2w+1)^{2w}\cdot |V|^{{\mathcal {O}}(1)}\). All these algorithms are exponential in the directed path-width of the input digraph while our algorithm is exponential within the number of sequences. Thus our result improves theses algorithms for digraphs of large directed path-width which can be decomposed by a small number of sequences (see Table 1 for examples). Furthermore the directed path-width can be computed in time \(3^{\tau (\textit {und}(G))} \cdot |V|^{\mathcal {O}(1)}\), where τ(und(G)) denotes the vertex cover number of the underlying undirected graph of G, by [6]. Thus our result improves this algorithm for digraphs of large τ(und(G)) which can be decomposed by a small number of sequences (see Table 1 for examples).

Table 1 Values of parameters within XP-algorithms for directed path-width

Since every single sequence qi defines a semicomplete \(\{\text {co-}(2\overrightarrow {P_{2}}),\overrightarrow {C_{3}},D_{4}\}\)-free digraph (cf. Table 2 for the digraphs), we consider digraphs which can be obtained by the union of k special semicomplete digraphs which confirms the conjecture of [5] that semicompleteness is a useful restriction when considering digraphs.Footnote 2 In Section 6 we give conclusions and point out open questions.

Table 2 Special digraphs

2 Preliminaries

We use the notations of Bang-Jensen and Gutin [7] for graphs and digraphs.

Undirected Graphs

We work with finite undirected graphsG = (V,E), where V is a finite set of vertices and \(E \subseteq \{ \{u,v\} \mid u,v \in V,~u \not = v\}\) is a finite set of edges. For a vertex vV we denote by NG(v) the set of all vertices which are adjacent to v in G, i.e. NG(v) = {wV ∣{v,w}∈ E}. Set NG(v) is called the set of all neighbors of v in G or neighborhood of v in G. The degree of a vertex vV, denoted by \(\deg _{G}(v)\), is the number of neighbors of vertex v in G, i.e. \(\deg _{G}(v)=|N_{G}(v)|\). The maximum vertex degree is \({\Delta }(G)=\max \limits _{v\in V} \deg _{G}(v)\). A graph \(G^{\prime }=(V^{\prime },E^{\prime })\) is a subgraph of graph G = (V,E) if \(V^{\prime }\subseteq V\) and \(E^{\prime }\subseteq E\). If every edge of E with both end vertices in \(V^{\prime }\) is in \(E^{\prime }\), we say that \(G^{\prime }\) is an induced subgraph of digraph G and we write \(G^{\prime }=G[V^{\prime }]\). For some undirected graph G = (V,E) its complement graph is defined by co-G = (V,{{u,v}∣{u,v}∉E,u,vV,uv}).

Special Undirected Graphs

By Pn = ({v1,…,vn},{{v1,v2},…,{vn− 1,vn}}), n ≥ 2, we denote a path on n vertices and by Cn = ({v1,…,vn},{{v1,v2},…, {vn− 1,vn},{vn,v1}}), n ≥ 3, we denote a cycle on n vertices. Further by Kn = ({v1,…,vn},{{vi,vj}∣1 ≤ i < jn}), n ≥ 1, we denote a complete graph on n vertices and by Kn,m = ({v1,…,vn,w1,…,wm},{{vi,wj}∣1 ≤ in,1 ≤ jm}) a complete bipartite graph on n + m vertices.

Directed Graphs

A directed graph or digraph is a pair D = (V,A), where V is a finite set of vertices and \(A\subseteq \{(u,v) \mid u,v \in V,~u \not = v\}\) is a finite set of ordered pairs of distinctFootnote 3 vertices called arcs. For a vertex vV, the sets \(N_{D}^{+}(v)=\{u\in V \mid (v,u)\in A\}\) and \(N_{D}^{-}(v)=\{u\in V \mid (u,v)\in A\}\) are called the set of all out-neighbours and the set of all in-neighbours of v. The outdegree of v, outdegreeD(v) for short, is the number of out-neighbours of v and the indegree of v, indegreeD(v) for short, is the number of in-neighbours of v in D. The maximum out-degree is \({\Delta }^{+}(D)=\max \limits _{v\in V} \text {outdegree}_{D}(v)\) and the maximum in-degree is \({\Delta }^{-}(D)=\max \limits _{v\in V} \text {indegree}_{D}(v)\). The maximum vertex degree is \({\Delta }(G)=\max \limits _{v\in V} \text {outdegree}_{G}(v)+\text {indegree}_{G}(v)\) and the maximum semi-degree is \({\Delta }^{0}(G)=\max \limits \{{\Delta }^{-}(D),{\Delta }^{+}(D)\}\).

A vertex vV is out-dominating (in-dominated) if it is adjacent to every other vertex in V and is a source (a sink, respectively). A digraph \(D^{\prime }=(V^{\prime },A^{\prime })\) is a subdigraph of digraph D = (V,A) if \(V^{\prime }\subseteq V\) and \(A^{\prime }\subseteq A\). If every arc of A with both end vertices in \(V^{\prime }\) is in \(A^{\prime }\), we say that \(D^{\prime }\) is an induced subdigraph of digraph D and we write \(D^{\prime }=D[V^{\prime }]\). For some digraph D = (V,A) its complement digraph is defined by co-D = (V,{(u,v)∣(u,v)∉A,u,vV,uv}) and its converse digraph is defined by con-D = (V,{(u,v)∣(v,u) ∈ A,u,vV,uv}).

Let G = (V,A) be a digraph.

  • G is edgeless if for all u,vV, uv, none of the two pairs (u,v) and (v,u) belongs to A.

  • G is a tournament if for all u,vV, uv, exactly one of the two pairs (u,v) and (v,u) belongs to A.

  • G is semicomplete if for all u,vV, uv, at least one of the two pairs (u,v) and (v,u) belongs to A.

  • G is (bidirectional) complete if for all u,vV, uv, both of the two pairs (u,v) and (v,u) belong to A.

Omitting the Directions

For some given digraph D = (V,A), we define its underlying undirected graph by ignoring the directions of the edges, i.e. und(D) = (V,{{u,v}∣(u,v) ∈ A,u,vV }).

Orientations

There are several ways to define a digraph D = (V,A) from an undirected graph G = (V,E), see [7]. If we replace every edge {u,v} of G by

  • one of the arcs (u,v) and (v,u), we denote D as an orientation of G. Every digraph D which can be obtained by an orientation of some undirected graph G is called an oriented graph.

  • one or both of the arcs (u,v) and (v,u), we denote D as a biorientation of G. Every digraph D which can be obtained by a biorientation of some undirected graph G is called a bioriented graph.

  • both arcs (u,v) and (v,u), we denote D as a complete biorientation of G. Since in this case D is well defined by G we also denote it by G&#x20E1;. Every digraph D which can be obtained by a complete biorientation of some undirected graph G is called a complete bioriented graph.

Special Directed Graphs

We denote by Kn&#x20E1; = ({v1,…,vn},{(vi,vj)∣1 ≤ ijn}), n ≥ 1 a bidirectional complete digraph on n vertices. By \(\overrightarrow {P_{n}}=(\{v_{1},\ldots ,v_{n}\},\{ (v_{1},v_{2}),\ldots , (v_{n-1},v_{n})\})\), n ≥ 2 we denote a directed path on n vertices and by \(\overrightarrow {C_{n}}=(\{v_{1},\ldots ,v_{n}\},\{(v_{1},v_{2}),\ldots , (v_{n-1},v_{n}),(v_{n},v_{1})\})\), n ≥ 2 we denote a directed cycle on n vertices.

An oriented forest (tree) is the orientation of a forest (tree). A digraph is an out-tree (in-tree) if it is an oriented tree in which there is exactly one vertex of indegree (outdegree) zero.

A directed acyclic digraph (DAG for short) is a digraph without any \(\overrightarrow {C_{n}}\), n ≥ 2 as subdigraph.

3 Sequence Digraphs and Sequence Systems

3.1 From Sequences to Digraphs

Let Q = {q1,…,qk} be a set of k sequences. Every sequence \(q_{i}=(b_{i,1},\ldots ,b_{i,n_{i}})\) consists of a number ni of items, such that all \(n={\sum }_{i=1}^{k} n_{i}\) items are pairwise distinct. Further there is a function t which assigns every item bi,j with a type t(bi,j). The set of all types of the items in some sequence qi is denoted by types(qi) = {t(b)∣bqi}. For a set of sequences Q = {q1,…,qk} we denote types(Q) = types(q1) ∪⋯ ∪types(qk). For some sequence \(q_{\ell }=(b_{\ell ,1}, \ldots ,b_{\ell ,n_{\ell }})\) we say item b,i is on the left of item b,j in sequence q if i < j. Item b,i is on the position i in sequence q, since there are i − 1 items on the left of b,i in sequence q.

In order to insert a new item b on a position j in sequence qi we first move all items on positions \(j^{\prime }\geq j\) to position \(j^{\prime }+1\) starting at the rightmost position ni and then we insert b at position j. In order to remove an existing item b at a position j in sequence qi we move all items from positions \(j^{\prime }\geq j+1\) to position \(j^{\prime }-1\) starting at position j + 1.

For hardness results in Section 5.2 we consider the distribution of the items of a type t onto the sequences by

$$ d_{Q}(t) = |\{ q\in Q \mid t \in \textit{types}(q) \}| \qquad \text{ and } \qquad d_{Q} = \underset{t \in \textit{types}(Q)}{\max} d_{Q}(t). $$

For the number of items for type t within the sequences we define

$$ c_{Q}(t) = \sum\limits_{q\in Q} |\{ b \in q \mid t(b)=t\}| \qquad \text{ and } \qquad c_{Q} = \underset{t \in \textit{types}(Q)}{\max} c_{Q}(t). $$

Obviously it holds dQk and 1 ≤ dQcQn.

Definition 1 (Sequence Digraph)

The sequence digraph g(Q) = (V,A) for a set Q = {q1,…,qk} has a vertex for every type, i.e. V = types(Q) and an arc (u,v) ∈ A if and only if there is some sequence qi in Q where an item of type u is on the left of an item of type v. More formally, there is an arc (u,v) ∈ A if and only if there is some sequence qi in Q, such that there are two items bi,j and \(b_{i,j^{\prime }}\) such that

  1. (1)

    \(1 \leq j < j^{\prime } \leq n_{i}\),

  2. (2)

    t(bi,j) = u,

  3. (3)

    \(t(b_{i,j^{\prime }})=v\), and

  4. (4)

    uv.

Sequence digraphs have successfully been applied in order to model the stacking process of bins from conveyor belts onto pallets with respect to customer orders, which is an important task in palletizing systems used in centralized distribution centers [8]. In this paper we show graph theoretic properties of sequence digraphs and their relation to special digraph classes.

In our examples we will use type identifications instead of item identifications to represent a sequence qiQ. For (not necessarily distinct) r types t1,…,tr let [t1,…,tr] denote some sequence qi = (bi,1,…,bi,r) of r pairwise distinct items, such that t(bi,j) = tj for j = 1,…,r. We use this notation for sets of sequences as well.

Example 1 (Sequence Digraph)

Figure 1 shows the sequence digraph g(Q) for Q = {q1,q2,q3} with sequences q1 = [a,a,d,e,d], q2 = [c,b,b,d], and q3 = [c,c,d,e,d].

Fig. 1
figure 1

Sequence digraph g(Q) of Example 1

In Example 1 all sequences of Q contain consecutive items of the same type. This is obviously not necessary to obtain digraph g(Q). Let C(qi) be the subsequence of qi which is obtained from qi by removing all but one of consecutive items of the same type for each type and C(Q) = {C(q1),…,C(qk)}.

Observation 1

Let Q = {q1,…,qk} be a set of k sequences, then g(Q) = g(C(Q)).

Next we give methods in order to compute the sequence digraph and also its complement digraph. Therefore we define the position of the first item in some sequence qiQ of some type ttypes(Q) by first(qi,t) and the position of the last item of type t in sequence qi by last(qi,t). For technical reasons, if there is no item for type t contained in sequence qi, then we define first(qi,t) = ni + 1, and last(qi,t) = 0.

Lemma 1

Let Q = {q1} be some set of one sequence, g(Q) = (V,A) the defined sequence digraph, co-(g(Q)) = (V,Ac) its complement digraph, and uv two vertices of V.

  1. 1.

    There is an arc (u,v) ∈ A, if and only if first(q1,u) < last(q1,v).

  2. 2.

    There is an arc (u,v) ∈ Ac, if and only if last(q1,v) < first(q1,u).

  3. 3.

    If (u,v) ∈ Ac, then (v,u) ∈ A.

  4. 4.

    There is an arc (u,v) ∈ A and an arc (v,u) ∈ Ac, if and only if last(q1,u) < first(q1,v).

Proof 1

  1. 1.

    By the definition of the arcs of sequence digraphs.

  2. 2.

    It holds (u,v) ∈ Ac if and only if (u,v)∉A. Further by (1) and uv it holds (u,v)∉A if and only if first(q1,u) > last(q1,v).

  3. 3.

    If (u,v) ∈ Ac, then our result (2) implies last(q1,v) < first(q1,u) which implies that (v,u) ∈ A.

  4. 4.

    Follows by (2) and (3).

Lemma 2

Let Q = {q1,…,qk} be some set of k sequences, g(Q) = (V,A) the defined sequence digraph, co-(g(Q)) = (V,Ac) its complement digraph, and uv two vertices of V.

  1. 1.

    There is an arc (u,v) ∈ A, if and only if there is some qiQ such that first(qi,u) < last(qi,v).

  2. 2.

    There is an arc (u,v) ∈ Ac, if and only if for every qiQ it holds last(qi,v) < first(qi,u).

Proof 2

  1. 1.

    By the definition of the arcs of sequence digraphs.

  2. 2.

    It holds (u,v) ∈ Ac if and only if (u,v)∉A. Further by (1) and uv we have (u,v)∉A if and only if for every qiQ it holds first(qi,u) > last(qi,v).

Properties (3) and (4) of Lemma 1 can not be shown for k > 1 sequences, since an arc (u,v) ∈ Ac can be obtained by two types u and v from two different sequences qi and qj such that utypes(qi) −types(qj) and vtypes(qj) −types(qi). In such situations it is not necessary to have (v,u) ∈ A.

By Lemma 2 (1) only the first and the last item of each type in every qiQ are important for the arcs in the corresponding digraph. Let M(qi) be the subsequence of qi which is obtained from qi by removing all except the first and last item for each type and M(Q) = {M(q1),…,M(qk)}.

Observation 2

Let Q = {q1,…,qk} be a set of k sequences, then g(Q) = g(M(Q)).

Using Lemma 2 and Observation 2 the running time to obtain the sequence digraph can be bounded as follows.

Proposition 1

Given a set Q of sequences, the sequence digraph g(Q) = (V,A) can be computed in time \(\mathcal {O}(n + k\cdot |\textit {types}(Q)|^{2})={\mathcal {O}}(n + k\cdot |V|^{2})\).

Proof 3

First, we initialize the values first(qi,t) := |qi| and last(qi,t) := 0 for each sequence qi and type t. Then, we compute the values first(qi,t) and last(qi,t) by scanning each sequence qi from left to right and at position j where t(bi,j) = t set the values last(qi,t) := j and first(qi,t) := j. The last assignment is made only if first(qi,t) = |qi| has its initial value. Finally, g(Q) can be computed in \({\mathcal {O}}(k \cdot |V|^{2})\) time by considering each pair \(t,t^{\prime }\) of types for every sequence qi and add the arc \((t,t^{\prime })\) to A if \(\textit {first}(q_{i},t) < \textit {last}(q_{i},t^{\prime })\). □

3.2 From Digraphs to Sequences

Definition 2 (Sequence System)

Let G = (V,A) be some digraph and A = {a1,…,a} its arc set. The sequence system q(G) = {q1,…,q} for G is defined as follows.

  1. (1)

    There are 2 items b1,1,b1,2,…,b,1,b,2.

  2. (2)

    Sequence qi = (bi,1,bi,2) for 1 ≤ i.

  3. (3)

    The type of item bi,1 is the first vertex of arc ai and the type of item bi,2 is the second vertex of arc ai for 1 ≤ i. Thus types(q(G)) = V.

Example 2 (Sequence System)

For the digraph G of Fig. 2 the corresponding sequence system is given by q(G) = {q1,q2,q3,q4,q5,q6,q7}, where q1 = [a,b], q2 = [b,c], q3 = [c,d], q4 = [d,e], q5 = [e,a], q6 = [e,f], q7 = [f,a]. The sequence digraph of q(G) is G.

Fig. 2
figure 2

Digraph G of Example 2

The definitions of the sequence system q(G) and the sequence digraph g(Q), defined in Section 3.1, imply the following results.

Observation 3

For every digraph G it holds G = g(q(G)).

The related relation Q = q(g(Q)) is not true in general (e.g. not for Q from Example 1). But if the reduction to different consecutive items C(Q) contains exactly two items of different types the following equivalence holds true.

Lemma 3

For every set Q of sequences it holds C(Q) = q(g(Q)) if and only if each sequence qiC(Q) contains exactly two items of different types.

Since q(g(Q)) = q(g(C(Q))) holds for every set of sequences Q, in Lemma 3 we also can replace condition C(Q) = q(g(Q)) by condition C(Q) = q(g(C(Q))).

Lemma 4

For every digraph G = (V,A) with und(G) = (V,E) there is a set Q of at most |E| sequences such that G = g(Q).

Proof 4

For every digraph G = (V,A) by Observation 3 the sequence system Q = q(G) leads to a set of at most |A| sequences such that G = g(Q). If we have two arcs (u,v) and (v,u) between two vertices u and v these can be represented by one sequence [u,v,u]. □

There are digraphs which even can be defined by one sequence (see Example 3 (1) and Theorem 1) and there are digraphs for which |E| sequences are really necessary (see Lemmas 10 and 9).

For digraphs of bounded vertex degree the sequence system Q = q(G) leads to sets whose distribution and number of items of each type can be bounded as follows.

Lemma 5

For every digraph G = (V,A) where \(\max \limits ({\Delta }^{-}(G),{\Delta }^{+}(G))\leq d\) there is a set Q with dQ ≤ 2d and cQ ≤ 2d such that G = g(Q).

In case of complete bioriented digraphs we can improve the latter bounds as follows.

Lemma 6

For every complete bioriented digraph G = (V,A) where \(\max \limits ({\Delta }^{-}(G),{\Delta }^{+}(G))\leq d\) there is a set Q with dQd and cQ ≤ 2d (for d ≥ 2 even cQ ≤ 2d − 1) such that G = g(Q).

Proof 5

By Lemma 5 we obtain dQ ≤ 2d and cQ ≤ 2d. Since we consider complete bioriented digraphs for every two vertices u and v we now have two sequences [u,v] and [v,u], which can be combined to only one sequence [u,v,u]. This leads to dQd and cQ ≤ 2d. For d ≥ 2 we can show the stated improvement as follows. If there is one type tintypes(Q) such that there are exactly 2d items of type t, then there are less than d types tintypes(Q) such that there are exactly 2d − 1 items of type \(t^{\prime }\). Thus there is one sequence [t,t,t] such that there are at most 2d − 2 items of type t. If we substitute [t,t,t] by [t,t,t] we reduced the number of items of type t to 2d − 1. If we repeat this substitution until there is no type tintypes(Q) such that there are exactly 2d items of type t, we achieve cQ ≤ 2d − 1. □

4 Properties of Sequence Digraphs

4.1 Graph Classes and their Relations

In order to represent some digraph G = (V,A) as a sequence digraph we need exactly |V | types. By Lemma 4 every digraph is a sequence digraph using a suitable set Q of sequences. Thus we want to consider digraphs which can be defined by a given upper bound for the number of sequences. Furthermore the first and the last item of each type within a sequence is the most important one by Observation 2, thus we want to analyze the digraphs which can be defined by a given upper bound for the number of items of each type. We define Sk, to be the set of all sequence digraphs defined by sets Q on at most k sequences that together contain at most items of each type in types(Q). By the definition we know for every two integers k ≥ 1 and ≥ 1 the following inclusions between these graph classes.

$$ \begin{array}{@{}rcl@{}} S_{k,\ell} & \subseteq & S_{k+1,\ell} \end{array} $$
(1)
$$ \begin{array}{@{}rcl@{}} S_{k,\ell} & \subseteq& S_{k,\ell+1} \end{array} $$
(2)

By Lemma 4 and Observation 2 we obtain the following bounds.

Corollary 1

Let Q be a set on k sequences and g(Q) = (V,A) ∈ Sk, the defined graph with und(g(Q)) = (V,E). Then, \(g(Q) in S_{k, ell^{\prime }} \) for all \(ell^{\prime } geq 2k\) and \(g(Q) in S_{k^{\prime }, ell}\) for all \(k^{\prime } ge |E|\).

Lemma 7

Let ≥ 1 and GS1, be defined by Q = {q1}, then digraph g(Q) is semicomplete and thus graph und(g(Q)) is the complete graph on |types(Q)| vertices.

Proof 6

Let Q = {q1} be some set of one sequence which defines the sequence digraph g(Q). For every vertex v in g(Q) there is exactly one corresponding type tvtypes(q1). Since GS1, for every two vertices v and w in g(Q) there are two items b1,i and b1,j of type tv and tw, respectively, which define the arc (v,w) or (w,v). □

Corollary 2

Let G = (V,A) be a digraph, such that graph und(G) has k connected components. Then for every \(k^{\prime }<k\) and ≥ 1 it holds \(G\not \in S_{k^{\prime },\ell }\).

Next we consider the relations of the defined classes for k = 1 sequence. Since S1,1 contains only digraphs with exactly one arc between every pair of vertices (cf. Theorem 1 for a more precise characterization) and S1, for ≥ 2 contains all bidirectional complete graphs we know that \(S_{1,1}\subsetneq S_{1,\ell }\) for every ≥ 2. Further by (2) and by Observation 2 it follows that all classes S1, for ≥ 2 are equal.

Lemma 8

For every two integers \(\ell ,\ell ^{\prime } \geq 2\) it holds \(S_{1,\ell }=S_{1, \ell ^{\prime }}\).

Corollary 3

For ≥ 2 the following inclusions hold.

$$ S_{1, 1}\subsetneq S_{1, 2}= {\ldots} = S_{1, \ell} $$

The equalities of Lemma 8 can not be generalized for k > 1 sequences and k since removing items from different sequences can change the sequence digraph. In order to give examples for digraphs which do not belong to some of the classes Sk, we next show some useful results.

For a set of digraphs \({\mathcal F}\) we denote by \({\mathcal F}\)-free digraphs the set of all digraphs G such that no induced subdigraph of G is isomorphic to a member of \({\mathcal F}\). If \({\mathcal F}\) consists of only one digraph F, we write F-free instead of {F}-free. For undirected graphs we use this notation as well.

Lemma 9

Let G = (V,E) be a triangle free graph, i.e. a C3-free graph, with |E|≥ 2, such that Δ(G) = and \(G^{\prime }=(V,A)\) be an orientation of G. Then for k = |E| it holds \(G^{\prime }\in S_{k,\ell }\) but for \(k^{\prime }<k\) or \(\ell ^{\prime }<\ell \) it holds \(G^{\prime }\not \in S_{k^{\prime },\ell ^{\prime }}\).

Proof 7

Let G and \(G^{\prime }\) be as in the statement of the lemma. Further let Q be a set of sequences such that \(G^{\prime }=\textit {g}(Q)\). If some sequence qiQ defines more than one arc of \(G^{\prime }\), then qi has to contain at least three items of pairwise distinct types. This would induce a C3 in G, which is not possible by our assumption. Thus we have to represent every arc (u,v) of \(G^{\prime }\) by one sequence [u,v]. Thus \(G^{\prime }\) can not be defined by less than k = |E| sequences or less than = Δ(G) items for every type. □

Since for every k ≥ 2 and every = 2,…,k there is a tree T on k edges and Δ(T) = we know by Lemma 9 that for k ≥ 2 and = 2,…,k we have \(S_{k,\ell -1} \subsetneq S_{k, \ell }\). Further by Observation 2 we know that for k ≥ 2 and ≥ 2k it holds Sk, = Sk,+ 1.

Corollary 4

For k ≥ 2 the following inclusions hold.

$$ S_{k, 1} \subsetneq S_{k, 2} \subsetneq {\ldots} \subsetneq S_{k,k} \subseteq S_{k,k+1}\subseteq {\ldots} \subseteq S_{k,2k} = S_{k,2k+1} = \ldots $$

Proposition 2

Let GSk,, then for every induced subdigraph H of G it holds HSk,.

Proof 8

A set of sequences \(Q^{\prime }\) for an induced subdigraph H can be obtained from a set Q of the original digraph G by restricting \(Q^{\prime }\) to the items which are destinated for types corresponding to vertices of H. □

Graph classes which are closed under taking induced subgraphs are called hereditary. Hereditary graph classes are exactly those classes which can be defined by a set of forbidden induced subgraphs. On the other hand, the classes Sk, are not closed under taking arbitrary subgraphs by the following example.

Example 3

  1. 1.

    For every n ≥ 1 and ≥ 2 it holds Kn&#x20E1;S1,, which can be verified by set Q = {q1}, where

    $$ q_{1}=[v_{1},v_{2},\ldots,v_{n},v_{1},v_{2},\ldots,v_{n}]. $$
  2. 2.

    Every orientation \(T^{\prime }_{n,d}\) of a tree Tn,d on n vertices and Δ(T) = dn − 1 can be obtained as a subdigraph of Kn&#x20E1;. Since by Lemma 9 for n ≥ 3 it holds \(T^{\prime }_{n,d}\in S_{n-1,d}\) but \(T^{\prime }_{n,d}\not \in S_{n-2,d}\) and \(T^{\prime }_{n,d}\not \in S_{n-1,d-1}\) the classes Sk, for each k ≥ 1 and ≥ 2 are not closed under taking arbitrary subgraphs.

  3. 3.

    By Theorem 2 digraph TTk which consists of the disjoint union of k transitive tournaments is in Sk,1Sk− 1,1.

  4. 4.

    If we remove exactly one edge from TTk we obtain a digraph \(TT^{\prime }_{k}\) such that \(TT^{\prime }_{k}\not \in S_{k,1}\). Thus the classes Sk,1 for every k ≥ 1 are not closed under taking arbitrary subgraphs.

For orientations of paths and cycles Lemma 9 leads to the following bounds.

Lemma 10

  1. 1.

    Let \(P^{\prime }_{n}\) be an orientation of a path Pn on n ≥ 2 vertices, e.g. \(P^{\prime }_{n}=\overrightarrow {P_{n}}\) for n ≥ 2. Then for every ≥ 2 it holds \(P^{\prime }_{n}\in S_{n-1, \ell }\). But for every ≥ 1 it holds \(P^{\prime }_{n}\not \in S_{n-2, \ell }\).

  2. 2.

    Let \(C^{\prime }_{n}\) be an orientation of a cycle Cn on n ≥ 4 vertices, e.g. \(C^{\prime }_{n}=\overrightarrow {C_{n}}\) for n ≥ 4. Then for every ≥ 2 it holds \(C^{\prime }_{n}\in S_{n, \ell }\). But for every ≥ 1 it holds \(C^{\prime }_{n}\not \in S_{n-1, \ell }\).

By Lemma 10 and Proposition 2 we obtain the following results.

Proposition 3

  1. 1.

    Let ≥ 1, k ≥ 1, and GSk,, then G has no induced path \(\overrightarrow {P_{k^{\prime }}}\) for \(k^{\prime }\geq k+2\).

  2. 2.

    Let ≥ 1, k ≥ 3, and GSk,, then G has no induced cycle \(\overrightarrow {C_{k^{\prime }}}\) for \(k^{\prime }\geq k+1\).

4.2 Characterizations of Sequence Digraphs for k = 1 or = 1

By Proposition 2 all the classes Sk, are hereditary and thus can be characterized by a set of forbidden induced subgraphs. In this section we even show a finite set of forbidden induced subgraphs for all classes Sk, where = 1 and for all classes where k = 1. These characterizations lead to polynomial time recognition algorithms for the corresponding graph classes. Furthermore we give characterizations in terms of special tournaments and conditions for the complement digraph.

4.2.1 Sequence Digraphs for k = 1 and = 1

Regarding the algorithmic use of special digraphs it is often helpful to know whether they are transitive. A digraph G = (V,A) is called transitive if for every pair (u,v) ∈ A and (v,w) ∈ A of arcs with uw the arc (u,w) also belongs to A.

Lemma 11

Every digraph in S1,1 is transitive.

Proof 9

Let Q = {q1} be some set of one sequence. If for every type there is only one item in q1, then two arcs (u,v) and (v,w) can only be defined in g(Q) if q1 contains some item b1,i of type u, some item \(b_{1,i^{\prime }}\) of type v, and some item \(b_{1,i^{\prime \prime }}\) of type w such that \(i<i^{\prime }\) and \(i^{\prime }<i^{\prime \prime }\). By the definition of the sequence digraph g(Q) also has the arc (u,w). □

For some digraph G and some integer d let dG be the disjoint union of d copies of G.

Theorem 1

For every digraph G the following statements are equivalent.

  1. 1.

    GS1,1

  2. 2.

    G is a transitive tournament.

  3. 3.

    G is an acyclic tournament.

  4. 4.

    G is a \(\overrightarrow {C_{3}}\)-free tournament.

  5. 5.

    G is a tournament with exactly one Hamiltonian path.

  6. 6.

    G is a tournament and every vertex in G has a different outdegree, i.e. {outdegree(v)∣vV } = {0,…,|V |− 1}.

  7. 7.

    G is \(\{2K_{1\&\#x20E1;},K_{2\&\#x20E1;},\overrightarrow {C_{3}}\}\)-free.

  8. 8.

    G can be constructed from the one-vertex graph K1 by repeatedly adding an out-dominating vertex or by repeatedly adding an in-dominated vertex.

Proof 10

The equivalence of (2)–(6) is known from [9, Chapter 9].

(1) ⇒ (2) By Lemma 11 digraph in S1,1 is transitive and by definition of S1,1 digraph G is a tournament.

(3) ⇒ (1) Every acyclic digraph G has a source, i.e. a vertex v1 of indegree 0, see [7]. Since G is a tournament there is an arc (v1,v) for every vertex v of G, i.e. v1 is an out-dominating vertex. By removing v1 from G, we obtain a transitive tournament G1 which leads to an out-dominating vertex v2. By removing v2 from G1, we obtain a transitive tournament G2 which leads to an out-dominating vertex v3 and so on. The sequence [v1,v2,…,vn] shows that GS1,1.

(4) ⇔ (7) Obviously.

(1) ⇔ (8) holds by definition. □

By the method is given in part (3) ⇒ (1) of the proof of Theorem 1 we obtain the following result.

Proposition 4

Let G = (V,A) ∈ S1,1, then a set Q of one sequence q, such that G = g(Q) can be found in time \(\mathcal {O}(|V|+|A|)\).

4.2.2 Sequence Digraphs for = 1

The sequence digraph g(Q) = (V,A) for a set Q = {q1,…,qk} can be obtained by the union of g({qi}) = (Vi,Ai), 1 ≤ ik by \(V=\cup _{i=1}^{k} V_{i}\) and \(A=\cup _{i=1}^{k} A_{i}\). Since for digraphs in Sk,1 the vertex sets Vi = types(qi) are disjoint, we can follow the next lemma.

Lemma 12

For every integer k every digraph in Sk,1 is the disjoint union of k digraphs in S1,1.

This lemma allows us to generalize Lemma 11 to k sequences.

Corollary 5

For every integer k every digraph in Sk,1 is transitive.

On the other hand none of the sets Sk,1 contains all transitive digraphs. Therefore let \(T^{\prime }\) be an orientation of a tree T with k + 1 edges, such that for every vertex v in \(T^{\prime }\) either the indegree or outdegree is 0. Such an orientation is possible for every tree T and leads to a transitive graph \(T^{\prime }\). By Lemma 9 we know that \(T^{\prime }\not \in S_{k,1}\).

Theorem 1 can be generalized to k ≥ 1 sequences as follows.

Theorem 2

For every digraph G and every integer k ≥ 1 the following statements are equivalent.

  1. 1.

    GSk,1.

  2. 2.

    G is the disjoint union of k digraphs from S1,1.

  3. 3.

    G is the disjoint union of k transitive tournaments.

  4. 4.

    G is the disjoint union of k acyclic tournaments.

  5. 5.

    G is the disjoint union of k \(\overrightarrow {C_{3}}\)-free tournaments.

  6. 6.

    G is \(\{(k+1)K_{1\&\#x20E1;},K_{2\&\#x20E1;},\overrightarrow {C_{3}}\}\)-free.

Proposition 5

Let G = (V,A) ∈ Sk,1, then a set Q on k sequences, such that G = g(Q) can be found in time \(\mathcal {O}(|V|+|A|)\).

Proof 11

If GSk,1 then G is the disjoint union of k digraphs from S1,1. For every of them we can define a sequence qi by Proposition 4. □

4.2.3 Sequence Digraphs for k = 1

The next examples show that for ≥ 2 items for each type even one sequence can define digraphs which are not transitive.

Example 4

  1. 1.

    The digraph D0 in Table 2 is not transitive, since it has among others the arcs (b,c) and (c,a) but not the arc (b,a). Further D0 belongs to the set S1,2, since it can be defined by set Q = {q1} of one sequence q1 = [c,a,b,c].

  2. 2.

    The digraph D6 in Table 2 is not transitive, since it has among others the arcs (c,b) and (b,a) but not the arc (c,a). Further D6 belongs to the set S1,2, since it can be defined by set Q = {q1} of one sequence q1 = [a,b,a,c,b,d,c,d].

In order to show a characterization for the class S1,2 we next prove some lemmas.

Lemma 13

Let ≥ 1 and GS1,, then the complement digraph co-G is transitive.

Proof 12

Let Q = {q1} be some sequence which defines the sequence digraph g(Q) and (u,v) and (v,w) with uw be two arcs of co-(g(Q)). By Lemma 1 (2) we conclude that last(q1,v) < first(q1,u) and last(q1,w) < first(q1,v) thus we have last(q1,w) < first(q1,v) ≤last(q1,v) < first(q1,u) and last(q1,w) < first(q1,u) implies by Lemma 1 (2) that arc (u,w) is in digraph co-(g(Q)). □

Lemma 14

Let ≥ 1 and GS1,, then the complement digraph co-G is \(2\overrightarrow {P_{2}}\)-free.

Proof 13

If we assume that co-G contains \(2\overrightarrow {P_{2}} =(\{a,b,c,d\},\{(c,a),(d,b)\})\), see Table 2, as an induced subdigraph, then G has (among others) the arcs (c,b) and (d,a). By applying Lemma 1 (1) and (2) we obtain last(q1,a) < first(q1,c) < last(q1,b) < first(q1,d) < last(q1,a), which leads to a contradiction. □

Lemma 15

Let G be a semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph on n vertices, then G has a vertex v such that outdegree(v) = n − 1 and a vertex \(v^{\prime }\) such that \(\text {indegree}(v^{\prime })=n-1\). (D4 is shown in Table 2.)

Proof 14

We show the result by induction on the number of vertices n in digraph G. For digraphs on n ≤ 3 vertices the statement is true.Footnote 4

Let n ≥ 3 and Gn+ 1 = (Vn+ 1,An+ 1) be a semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph on n + 1 vertices. Further let wVn+ 1 and Gn = Gn+ 1[Vn+ 1 −{w}]. Then Gn = (Vn,An) is a semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph on n vertices. By the induction hypothesis there is some vVn such that outdegree(v) = n − 1 in Gn.

If (v,w) ∈ An+ 1 then outdegree(v) = n in Gn+ 1 and the proof is done. If (v,w)∉An+ 1 then the semicompleteness of Gn+ 1 implies that (w,v) ∈ An+ 1. Then for every (v,u) ∈ En it holds (w,u) ∈ En+ 1. Otherwise the semicompleteness of Gn+ 1 implies that (u,w) ∈ En+ 1 and thus Gn+ 1[{u,v,w}] leads to a \(\overrightarrow {C_{3}}\) or to a D4. Thus in Gn+ 1 it holds outdegree(w) = outdegree(v) + 1 = n − 1 + 1 = n.

The proof for the existence of a vertex \(v^{\prime }\) such that \(\text {indegree}(v^{\prime })=n-1\) is similar. □

Lemma 16

Let G be a semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph, then its complement digraph co-G is transitive. (D4 is shown in Table 2.)

Proof 15

Let (u,v),(v,w) ∈ Ac be two arcs of co-G = (V,Ac). Since G = (V,A) is semicomplete we know that (v,u),(w,v)∉Ac. If G is a \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph, then co-G is a \(\{\overrightarrow {C_{3}},\overrightarrow {P_{3}}\}\)-free digraph. Thus u and w are connected either only by (u,w) ∈ Ac or by (u,w) ∈ Ac and (w,u) ∈ Ac, which implies that co-G is transitive. □

A spanning subdigraph is a subdigraph obtained by the deletion of arcs.

Lemma 17

Every semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph has a spanning transitive tournament subdigraph. (D4 is shown in Table 2.)

Proof 16

By Lemma 15 every semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph G on n vertices has a vertex v1 such that outdegree(v1) = n − 1. By removing v1 from G, we obtain a semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph G1 on n − 1 vertices, which leads to a vertex v2 such that outdegree(v2) = n − 2. By removing v2 from G1, we obtain a semicomplete \(\{\overrightarrow {C_{3}},D_{4}\}\)-free digraph G2 on n − 2 vertices, which leads to a vertex v3 such that outdegree(v3) = n − 3 and so on. The sequence q = [v1,v2,…,vn] defines a digraph g({q}) ∈ S1,1 which is a spanning transitive tournament subdigraph of G. □

These results allow us to show the following characterizations for the class S1,2. Since we use several forbidden induced subdigraphs the semicompleteness is expressed by excluding 2K1&#x20E1;.

Theorem 3

For every digraph G the following statements are equivalent.

  1. 1.

    GS1,2

  2. 2.

    GS1, for some ≥ 2

  3. 3.

    co-G is transitive, co-G is \(2\overrightarrow {P_{2}}\)-free, and G has a spanning transitive tournament subdigraph.

  4. 4.

    G is \(\{\text {co-}(2\overrightarrow {P_{2}}),2K_{1\&\#x20E1;},\overrightarrow {C_{3}},D_{4}\}\)-free. (D4 is shown in Table 2.)

Proof 17

(1) ⇒ (2) By definition.

(2) ⇒ (1) By Lemma 8.

(3) ⇒ (4) If G has a spanning transitive tournament subdigraph then it is semicomplete and thus 2K1&#x20E1;-free. If co-G is transitive it has no induced \(\overrightarrow {C_{3}}\) and no \(\overrightarrow {P_{3}}\). Thus G has no induced \(\overrightarrow {C_{3}}\) and D4. (4) ⇒ (3) Follows by Lemmas 16 and 17.

(1) ⇒ (3) Digraph co-G is transitive by Lemma 13 and \(2\overrightarrow {P_{2}}\)-free by Lemma 14. Further if G is defined by sequence q then the subsequence F(q) which is obtained from q by removing all except the first item for each type leads to a subdigraph \((V,A^{\prime })\) which is a transitive tournament.

(3) ⇒ (2) Let \(G^{\prime }=(V,A^{\prime })\) be a subdigraph of G = (V,A) which is a transitive tournament. By Theorem 1 we know that \(G^{\prime }\in S_{1,1}\) and thus there is some sequence

$$ q^{\prime}=[v_{1},\ldots,v_{n}] $$

such that \(\textit {g}(\{q^{\prime }\})=G^{\prime }\). If \(A^{\prime }=A\) we know that \(G\in S_{1,1}\subseteq S_{1,\ell }\) for every ≥ 2. So we can assume that \(A^{\prime }\subsetneq A\). Obviously for every arc \((v_{i},v_{j})\in A-A^{\prime }\) there are two positions j < i in

$$ q^{\prime}=[v_{1},\ldots,v_{j},\ldots, v_{i},\ldots, v_{n}]. $$

In order to define a subdigraph of G which contains all arcs of \(G^{\prime }\) and arc (vi,vj) we can insert (cf. Section 3.1 for the definition of inserting an item) an additional item for type vi on position kj, or an additional item for type vj on position k > i, or first an additional item for type vj and then an additional item for type vi on a position k, j < ki, into \(q^{\prime }\) without creating an arc which is not in A. This is possible if and only if there is some position k, jki, in

$$ q^{\prime}=[v_{1},\ldots,v_{j},\ldots, v_{m^{\prime}}, \ldots, v_{k}, \ldots, v_{m^{\prime\prime}}, \ldots, v_{i}, \ldots, v_{n}] $$

such that for every \(m^{\prime }\), j < mk, it holds \((v_{m^{\prime }},v_{j})\in A\) and for every \(m^{\prime \prime }\), \(k\leq m^{\prime \prime }< i\), it holds \((v_{i},v_{m^{\prime \prime }})\in A\).

If it is possible to insert all arcs of \(A-A^{\prime }\) by adding a set of additional items into sequence \(q^{\prime }\) resulting in a sequence q such that G = g(q), then we have GS1, for some ≥ 2. Next we show a condition using the new items of every single arc of \(A-A^{\prime }\) independently from each other.

Claim 1

If for every arc \((v_{i},v_{j})\in A-A^{\prime }\) there is a position k, j < ki such that first inserting an additional item for type vj and then an additional item for type vi at position k into \(q^{\prime }\) defines a subdigraph of G which contains all arcs of \(G^{\prime }\) and arc (vi,vj), then GS1, for some ≥ 2.

Proof 18

(of Claim 1) Every single arc \((v_{i},v_{j})\in A-A^{\prime }\) can be inserted by first inserting first an additional item for type vj and then an additional item for type vi at some position k, j < ki. Next we show that the new inserted items for two missing arcs \((v_{i},v_{j})\in A-A^{\prime }\) at position k and \((v_{i^{\prime }},v_{j^{\prime }})\in A-A^{\prime }\) at position \(k^{\prime }\) do not create an arc which is not in A. This is done by a case distinction w.r.t. the 34 possible positions of \(i,i^{\prime },j,j^{\prime },k,k^{\prime }\) shown in Table 3.

  1. 1.

    If \(j^{\prime }<k^{\prime }<i^{\prime }<j<k<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})\in A\).

  2. 2.

    If \(j^{\prime }<k^{\prime }<i^{\prime }=j<k<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), and \((v_{j^{\prime }},v_{j})\in A\).

  3. 3.

    If \(j^{\prime }<k^{\prime }<j<i^{\prime }<k<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})\in A\).

  4. 4.

    If \(j^{\prime }<k^{\prime }<j<k<i^{\prime }<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})\in A\).

  5. 5.

    If \(j^{\prime }<k^{\prime }<j<k<i^{\prime }=i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})\in A\).

  6. 6.

    If \(j^{\prime }<k^{\prime }<j<k<i<i^{\prime }\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})\in A\).

  7. 7.

    If \(j^{\prime }<j<k^{\prime }<i^{\prime }<k<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})\in A\).

  8. 8.

    If \(j^{\prime }<j<k^{\prime }<k<i^{\prime }<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\). But arc \((v_{i^{\prime }},v_{j})\) does not belong to A because of the positions of \(i,i^{\prime },j,j^{\prime }\). Next we show that \((v_{i^{\prime }},v_{j})\in A\) using \((v_{i},v_{j^{\prime }})\) which also does not belong to A because of the positions of \(i,i^{\prime },j,j^{\prime }\). If \((v_{i^{\prime }},v_{j})\not \in A\) and \((v_{i},v_{j^{\prime }})\not \in A\) then \(j^{\prime }<j<k^{\prime }<k<i^{\prime }<i\) implies that co-G has an induced \(2\overrightarrow {P_{2}}\) which is not possible by our assumption. Thus we know that \((v_{i^{\prime }},v_{j})\in A\) or \((v_{i},v_{j^{\prime }})\in A\). If \((v_{i},v_{j^{\prime }})\in A\) we can exchange the positions of \(k^{\prime }\) and k (which implies that we are in case 11) or we also have \((v_{i^{\prime }},v_{j})\in A\).

  9. 9.

    If \(j^{\prime }<j<k^{\prime }<k<i^{\prime }=i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})=(v_{i},v_{j})\in A\).

  10. 10.

    If \(j^{\prime }<j<k^{\prime }<k<i<i^{\prime }\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), \((v_{j^{\prime }},v_{j})\in A\), and \((v_{i^{\prime }},v_{j})\in A\) (same situation as 8).

  11. 11.

    If \(j^{\prime }<j<k<k^{\prime }<i^{\prime }<i\), then \((v_{j},v_{i^{\prime }})\in A\), \((v_{i},v_{i^{\prime }})\in A\), \((v_{j},v_{j^{\prime }})\in A\). But arc \((v_{i},v_{j^{\prime }})\) does not belong to A because of the positions of \(i,i^{\prime },j,j^{\prime }\). Next we show that \((v_{i},v_{j^{\prime }})\in A\) using \((v_{i^{\prime }},v_{j})\) which also does not belong to A because of the positions of \(i,i^{\prime },j,j^{\prime }\). If \((v_{i},v_{j^{\prime }})\not \in A\) and \((v_{i^{\prime }},v_{j})\not \in A\) then \(j^{\prime }<j<k<k^{\prime }<i^{\prime }<i\) implies that co-G has an induced \(2\overrightarrow {P_{2}}\) which is not possible by our assumption. Thus we know that \((v_{i},v_{j^{\prime }})\in A\) or \((v_{i^{\prime }},v_{j})\in A\). If \((v_{i^{\prime }},v_{j})\in A\) we can exchange the positions of \(k^{\prime }\) and k (which implies that we are in case 8) or we also have \((v_{i},v_{j^{\prime }})\in A\).

  12. 12.

    If \(j^{\prime }<j<k<k^{\prime }<i^{\prime }=i\), then \((v_{j},v_{i^{\prime }})\in A\), \((v_{j},v_{j^{\prime }})\in A\), and \((v_{i},v_{j^{\prime }})=(v_{i^{\prime }},v_{j^{\prime }})\in A\).

  13. 13.

    If \(j^{\prime }<j<k<k^{\prime }<i<i^{\prime }\), then \((v_{j},v_{i^{\prime }})\in A\), \((v_{i},v_{i^{\prime }})\in A\), \((v_{j},v_{j^{\prime }})\in A\), and \((v_{i},v_{j^{\prime }})\in A\) (same situation as 11).

  14. 14.

    If \(j^{\prime }<j<k<i<k^{\prime }<i^{\prime }\), then \((v_{j},v_{i^{\prime }})\in A\), \((v_{i},v_{i^{\prime }})\in A\), \((v_{j},v_{j^{\prime }})\in A\), and \((v_{i},v_{j^{\prime }})\in A\).

  15. 15.

    If \(j^{\prime }=j<k^{\prime }<i^{\prime }<k<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), and \((v_{i^{\prime }},v_{j})\in A\).

  16. 16.

    If \(j^{\prime }=j<k^{\prime }<k<i^{\prime }<i\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), and \((v_{i^{\prime }},v_{j})=(v_{i^{\prime }},v_{j^{\prime }})\in A\).

  17. 17.

    If \(j^{\prime }=j<k^{\prime }<k<i<i^{\prime }\), then \((v_{j^{\prime }},v_{i})\in A\), \((v_{i^{\prime }},v_{i})\in A\), and \((v_{i^{\prime }},v_{j})=(v_{i^{\prime }},v_{j^{\prime }})\in A\).

Table 3 Cases within the proof of Claim 1

Every remaining case i ∈{18,…,34} is symmetric to shown case 35 − i. Thus for every two missing arcs \((v_{i},v_{j})\in A-A^{\prime }\) and \((v_{i^{\prime }},v_{j^{\prime }})\in A-A^{\prime }\) which are inserted by additionally items all arcs between these items belong to A.

Now we can show the claim by induction on the number \(m=|A-A^{\prime }|\) of missing arcs. Let a1,…,am be an arbitrary order of the missing arcs. For m = 1 we can insert the missing arc by the assumption of the claim. Let m ≥ 1, qm be the sequence obtained from \(q^{\prime }\) by inserting m missing arcs, and Gm = g(qm) = (V,Am). In order to insert arc am+ 1 = (vi,vj) we neglect the 2m new items in qm and consider only the items of \(q^{\prime }\) for determining a position \(k_{a_{m+1}}\), \(j<k_{a_{m+1}}\leq i\), such that am+ 1 can be inserted into \(G^{\prime }\) by first inserting an additional item for type vj and then an additional item for type vi at position \(k_{a_{m+1}}\). The existence of this position follows by the assumption of the claim. The insertion of the two new items at position \(k_{a_{m+1}}\) for arc am+ 1 = (vi,vj) defines the following sets of arcs.

  1. 1.

    A1,m+ 1 = {(vi,vj)}

  2. 2.

    Set A2,m+ 1 of all arcs from vertices corresponding to items of \(q^{\prime }\) on position \(\leq k_{a_{m+1}}\) to vi and to vj and all arcs from vi and from vj to all vertices corresponding to items of \(q^{\prime }\) on position \(> k_{a_{m+1}}\).

  3. 3.

    Set A3,m+ 1 of all arcs from vertices corresponding to new items of qm on positions \(k_{a_{j}}\), jm, to vi and to vj and all arcs from vi and from vj to all vertices corresponding to new items of qm on positions \(k_{a_{j}}\), jm.

It remains to show that \(A_{1,m+1}\cup A_{2,m+1} \cup A_{3,m+1} \subseteq A\). \(A_{1,m+1} \subseteq A\) holds by definition and \(A_{2,m+1} \subseteq A\) holds by the assumption of the claim. Set A3,m+ 1 is equal to the union of all sets of arcs between the vertices corresponding to the two new inserted items for am+ 1 and the vertices corresponding to the two new inserted items for every aj, jm following the order of the items. As our case distinction above implies that all arcs between the new items inserted at any aj, jm and the new items inserted at am+ 1 are in A the union of all these arcs A3,m+ 1 is also in A.

So we can insert am+ 1 by first inserting an additional item for type vj and then an additional item for type vi at position \(k^{\prime }_{a_{m+1}}\), where \(k^{\prime }_{a_{m+1}}\) is the position in qm which corresponds to position \(k_{a_{m+1}}\) in \(q^{\prime }\).

Thus we have shown that g({qm}) = GS1, for some ≥ 2. □

Assume that GS1, for every ≥ 2. By Claim 1 there is some arc \((v_{i},v_{j})\in A-A^{\prime }\) such that for every position k, j < ki inserting an additional item for type vi and an additional item for type vj at position k defines an arc which is not in A. That is, for every position k, j < ki, in \(q^{\prime }\) there exists some \(m^{\prime }\), j < mk, such that it holds \((v_{m^{\prime }},v_{j})\not \in A\) or there exists some \(m^{\prime \prime }\), \(k\leq m^{\prime \prime }< i\), such that it holds \((v_{i},v_{m^{\prime \prime }})\not \in A\). By the transitivity of co-G it follows that there is one position k, j < ki, in \(q^{\prime }\) such that there exists some \(m^{\prime }\), j < mk, such that it holds \((v_{m^{\prime }},v_{j})\not \in A\) and there exists some \(m^{\prime \prime }\), \(k\leq m^{\prime \prime }< i\), such that it holds \((v_{i},v_{m^{\prime \prime }})\not \in A\).

If co-G = (V,Ac) is the complement digraph of G we know that

$$ (v_{m^{\prime}},v_{j})\in A^{c} \text{ and } (v_{i},v_{m^{\prime\prime}})\in A^{c}. $$
(3)

Since \(m^{\prime }\leq m^{\prime \prime }\) we know that \((v_{m^{\prime }},v_{m^{\prime \prime }})\in A\). Further we know that \((v_{m^{\prime \prime }},v_{m^{\prime }})\in A\), since otherwise \((v_{m^{\prime \prime }},v_{m^{\prime }})\in A^{c}\), property (3), and the transitivity of co-G would imply that (vi,vj) ∈ Ac which is not possible. Thus we know that

$$ (v_{m^{\prime}},v_{m^{\prime\prime}})\not \in A^{c} \text{ and } (v_{m^{\prime\prime}},v_{m^{\prime}})\not\in A^{c}. $$
(4)

Further the arcs \((v_{j},v_{m^{\prime }}),(v_{j},v_{m^{\prime \prime }}),(v_{m^{\prime }},v_{i}),(v_{m^{\prime \prime }},v_{i})\) belong to \(A^{\prime }\subseteq A\) and thus

$$ (v_{j},v_{m^{\prime}})\not \in A^{c}, \text{ } (v_{j},v_{m^{\prime\prime}})\not\in A^{c}, \text{ } (v_{m^{\prime}},v_{i})\not\in A^{c}\text{ and } (v_{m^{\prime\prime}},v_{i})\not\in A^{c}. $$
(5)

If \((v_{i},v_{m^{\prime }})\in A^{c}\) or \((v_{m^{\prime \prime }},v_{j})\in A^{c}\) then (3) and the transitivity of co-G would imply that (vi,vj) ∈ Ac, thus we know

$$ (v_{i},v_{m^{\prime}})\not \in A^{c} \text{ and } (v_{m^{\prime\prime}},v_{j})\not\in A^{c}. $$
(6)

Properties (3)–(6) imply that the subdigraph \((\{v_{i},v_{j},v_{m^{\prime }},v_{m^{\prime \prime }}\},\{(v_{i},v_{m^{\prime \prime }}),\) \((v_{m^{\prime }},v_{j})\})\) of co-G leads to a \(2\overrightarrow {P_{2}}\), which implies that G contains a \(\text {co-}(2\overrightarrow {P_{2}})\). □

Corollary 6

Every digraph in Sk, can be obtained by the union of at most k many digraphs from S1,2 and thus by the union of at most k many \(\{\text {co-}(2\overrightarrow {P_{2}}),2K_{1\&\#x20E1;},\overrightarrow {C_{3}},D_{4}\}\)-free digraphs.

Proposition 6

Let GS1,2, then a set Q of one sequence q, such that G = g(Q) can be found in time \({\mathcal {O}}(|V|+|A|)\).

Proof 19

Let G = (V,A) ∈ S1,2 and q = []. We perform the following steps until G = (,).

  • Choose vV such that (v,u) ∈ A for all uV −{v} and append v to q.

  • Remove all arcs (v,u) from A.

  • If indegree(v) = outdegree(v) = 0, remove v from V.

  • If there are vertices u such that indegree(u) = outdegree(u) = 0, remove u from V and append u to q.

Next we show that for every G = (V,A) ∈ S1,2 this method leads to a sequence q, such that G = g({q}) and for every type in types(q) there are at most two items in q.

In order to perform the algorithm there has to be an ordering v1,…,vn of V such that for 1 ≤ i < n vertex vi has maximum possible outdegree in subdigraph obtained by removing the outgoing arcs of v1,…,vi− 1 and thereby created isolated vertices from G. Since GS1,2 there is a sequence \(q^{\prime }\) such that \(G=\textit {g}(\{q^{\prime }\})\). The order in which the types corresponding to the vertices of V appear in subsequence \(F(q^{\prime })\), defined in the proof of Theorem 3, ensures the existence of such an ordering.

By performing the operations of the algorithm along such a vertex ordering we observe that in every iteration only the outdegree of v is changed and only vertices with defined incoming and outgoing arcs are removed. Thus by the definition of the sequence digraph it holds G = g({q}). Since every vertex which has only outgoing or only incoming arcs will be inserted once into q and every vertex which has outgoing and incoming arcs will be inserted at most twice into q this sequence fullfils the properties stated in the theorem. □

Example 5

We apply the method given in the proof of Proposition 6 on the digraph D6 in Table 2 and obtain the sequence

$$ q=[b,a,c,b,d,c]. $$

This even leads to a shorter sequence than we used in Example 4 (2).

4.3 Converse Sequence Digraphs and Complements of Sequence Digraphs

For some sequence \(q_{i}=(b_{i,1},\ldots ,b_{i,n_{i}})\) we define by \(q^{-1}_{i}=(b_{i,n_{i}},\ldots ,b_{i,1})\) its converse sequence and for some set Q we define by \(Q^{-1}=\{q^{-1}_{i} \mid q_{i}\in Q\}\) the set of converse sequences. Next we state a close relation between the sequence digraph of some set Q and of the converse digraph of the sequence digraph of Q− 1.

Lemma 18

Let Q be a set of sequences. Then it holds G = g(Q) if and only if con-G = g(Q− 1).

This relation implies that the classes Sk, are closed under taking converse digraphs.

Proposition 7

Let GSk,, then con-GSk,.

Next we want to address the relationship between the complement digraph of a sequence digraph g(Q) for some set Q and the sequence digraph g(Q− 1) of the converse sequences Q− 1. In general these digraphs are different. This can be verified by the two sequence digraphs considered in Example 4. Under certain conditions for some set of sequences Q the complement digraph of g(Q) can be obtained by the sequence digraph of the converse sequences Q− 1, which is useful since Q− 1 has the same number of sequences and the same number of items per types as Q.

Lemma 19

Digraph G is a tournament if and only if co-G = con-G.

Proof 20

Digraph G is a tournament, if and only if between every two vertices of G there is exactly one arc, if and only if the converse digraph con-G corresponds to the complement digraph co-G. □

Lemma 20

Let GSk, defined by some set of sequences Q, such that graph g(Q) is a tournament, then co-(g(Q)) = g(Q− 1).

Proof 21

Since g(Q) is a tournament by Lemma 19 it holds co-(g(Q)) = con-(g(Q)) and by Lemma 18 it holds con-(g(Q)) = g(Q− 1). □

Since Q and Q− 1 are defined on the same number of sequences and items of each type the following result holds.

Corollary 7

Let GSk, be a tournament, then co-GSk,.

Since the class S1,1 is equivalent to the class of transitive tournaments (Theorem 1), the last two results hold for digraphs in S1,1.

Lemma 21

Let GS1,1 defined by some set Q = {q1} of one sequence, then co-(g(Q)) = g(Q− 1).

Proposition 8

Let GS1,1, then co-GS1,1.

The results can not be generalized to graphs from S1,2 and also not sets Q on more than one sequence since these are not tournaments in general.

Beside transitivity shown in Lemma 13 we observe that the complements digraphs of sequence digraphs are special directed acyclic graphs.

Lemma 22

Let ≥ 1 and GS1,, then the complement digraph co-G is acyclic.

Proof 22

Let Q = {q1} be some sequence which defines the sequence digraph g(Q). If the complement digraph co-(g(Q)) contains a cycle ({v1,…,vn},{(v1,v2),…, (vn− 1,vn),(vn,v1)}), n ≥ 2, then by Lemma 13 vertex set {v1,…,vn} induces a bidirectional complete subdigraph in digraph co-(g(Q)). Thus the vertex set {v1,…,vn} induces an edgeless subdigraph in g(Q) which contradicts Lemma 7. □

It is well known that every DAG has at least one sink, i.e. a vertex v1 of outdegree 0, and one source, i.e. a vertex v2 of indegree 0 by [7]. This means by Lemma 22 that for every ≥ 1 every digraph G = (V,A) ∈ S1, has a vertex v1 of outdegree |V |− 1 and a vertex v2 of indegree |V |− 1. For = 1 this is known by Theorem 1.

Lemma 23

Let ≥ 1 and G = (V,A) ∈ S1,, u and v be two vertices from V, then the complement digraph co-G has at most one of the two arcs (u,v) and (v,u), i.e. co-G is an oriented graph.

Proof 23

Let G = (V,A) ∈ S1,, u and v be two distinct vertices from V. Then G contains at least one of the two arcs (u,v) and (v,u) which implies that co-G has at most one of the two arcs (u,v) and (v,u). □

Proposition 9

Let ≥ 1 and GS1,, then the complement digraph co-G has at most one non-trivial component which contains arcs.

Proof 24

If we assume that co-G has more than one non-trivial component which contains arcs, then by Lemma 23 digraph co-G contains \(2\overrightarrow {P_{2}} =(\{a,b,c,d\},\) {(c,a),(d,b)}), see Table 2, as an induced subdigraph. Lemma 14 leads to a contradiction. □

Digraphs in S2,1 consist of the disjoint union of two digraphs in S1,1 (see Lemma 12), thus the corresponding complements have exactly one component. The complements of digraphs in S2,2 can have more than one non-trivial component which contains arcs. This can be verified by digraph co-GS2,2 in the following example, whose complement G has two non-trivial components which contains arcs.

Example 6

Let G be the disjoint union of two digraphs \(G^{\prime }=(V^{\prime },A^{\prime })\) and \(G^{\prime \prime }=(V^{\prime \prime },A^{\prime \prime })\) from S1,1. Then G can be defined by Q = {q1,q2}, where \(q_{1}=[v^{\prime }_{1},v^{\prime }_{2},\ldots ,v^{\prime }_{n}]\) and \(q_{2}=[v^{\prime \prime }_{1},v^{\prime \prime }_{2},\ldots ,v^{\prime \prime }_{m}]\). W.l.o.g. we assume the vertices in \(V^{\prime }\) and \(V^{\prime \prime }\) to be enumerated in the order in which the graphs can be defined by inserting in-dominated vertices (cf. Theorem 1. (8)). Thus it holds GS2,1.

The complement digraph co-G can be defined as follows. The digraph complement of a digraph in S1,1 also belongs to S1,1 and the additional arcs between \(\text {co-} G^{\prime }\) and \(\text {co-} G^{\prime \prime }\) can be defined by two sequences, one for the arcs from \(\text {co-} G^{\prime }\) to \(\text {co-} G^{\prime \prime }\) and one for the arcs from \(\text {co-} G^{\prime \prime }\) to \(\text {co-} G^{\prime }\). The arcs within \(\text {co-} G^{\prime }\) and \(\text {co-} G^{\prime \prime }\) can be defined in both sequences. Formally co-G can be defined by \(Q^{\prime }=\{q^{\prime }_{1},q^{\prime }_{2}\}\), where

$$ q^{\prime}_{1}=\left[v^{\prime}_{n},v^{\prime}_{n-1},\ldots,v^{\prime}_{1}, v^{\prime\prime}_{m},v^{\prime\prime}_{m-1}\ldots,v^{\prime\prime}_{1}\right] $$

and

$$ q^{\prime}_{2}=\left[v^{\prime\prime}_{m},v^{\prime\prime}_{m-1}\ldots,v^{\prime\prime}_{1},v^{\prime}_{n},v^{\prime}_{n-1},\ldots,v^{\prime}_{1}\right]. $$

Thus it holds co-GS2,2.

Next we want to study for some digraph GSk, whether it holds co-GSk,. By Proposition 8 the class S1,1 is closed under complementations. The next example shows that the class S1,2 is not closed under complementations and that the values of k and can grow arbitrary.

Example 7

We consider

$$ \overrightarrow{K_{n,m}}=(\{v_{1},\ldots,v_{n},w_{1},\ldots,w_{m}\}, \{(v_{i},w_{j}) \mid 1\leq i\leq n, 1\leq j \leq m\}) $$

as an orientation of a complete bipartite graph Kn,m. The complement digraph of \(\overrightarrow {K_{n,m}}\) can be defined by one sequence

$$ q=[w_{1},w_{2},\ldots,w_{m},w_{1},w_{2},\ldots,w_{m},v_{1},v_{2},\ldots,v_{n},v_{1},v_{2},\ldots,v_{n}] $$

which implies that the complement digraph of \(\overrightarrow {K_{n,m}}\) is in S1,2. By Lemma 9 it holds \(\overrightarrow {K_{n,m}}\in S_{n\cdot m,\max \limits (n,m)}\) but \(\overrightarrow {K_{n,m}}\not \in S_{k,\ell }\) for k < nm or \(\ell <\max \limits (n,m)\).

Since \(S_{1,2}\subseteq S_{k,\ell }\) for k ≥ 1 and ≥ 2 we know that the classes Sk, for every k ≥ 1 and ≥ 2 are not closed under complementations. The next examples show that S2,1 is not closed under complementations.

Example 8

  1. 1.

    Let G1 be the disjoint union of two 1-vertex digraphs in S1,1. Then G1S2,1. Further co-G1 = K2&#x20E1;S1,2S2,1.

  2. 2.

    Let Gn for n ≥ 2 be the disjoint union of two n-vertex digraphs in S1,1. Then GnS2,1 and co-GnS2,2 − (S2,1S1,2), see Example 6.

Lemma 24

Let GSk,1 for k ≥ 1, then co-GS2,2.

Proof 25

By Lemma 12 every digraph GSk,1 is the disjoint union of k digraphs G1,…,Gk from S1,1. Let qi be the sequence for Gi. For every i it holds co-GiS1,1 (Proposition 8). A sequence for co-Gi can be obtained by the reverse sequence \(q^{-1}_{i}\) of that for Gi (Lemma 21). Thus digraph co-G can be obtained by k digraphs from S1,1 and all possible arcs between two of these k graphs. The arcs between these k digraphs can be created by two sequences each consisting of concatenations of \(q^{-1}_{i}\) as follows.

$$ q^{\prime}=q^{-1}_{1} \circ q^{-1}_{2} \circ {\ldots} \circ q^{-1}_{k} $$
$$ q^{\prime\prime}=q^{-1}_{k} \circ q^{-1}_{k-1} \circ {\ldots} \circ q^{-1}_{1} $$

Since \(\text {co-} G=\textit {g}(\{q^{\prime },q^{\prime \prime }\})\) it holds that co-GS2,2. □

4.4 Simple Sequences

Let Q = {q1,…,qk} be a set of k sequences. By Observation 2 only the first and the last item of each type in every qiQ are important for the arcs in the corresponding digraph. Next we want to analyze how we even can use subsequences defined by the first or last item of each type. Let F(qi) be the subsequence of qi which is obtained from qi by removing all except the first item for each type and L(qi) be the subsequence of qi which is obtained from qi by removing all except the last item for each type.Footnote 5

Example 9 (F(q i), L(q i))

For the sequence q1 = [b,a,c,b,a] we obtain the two subsequences F(q1) = [b,a,c] and L(q1) = [c,b,a].

The given example shows that sequence digraph g({q1}) differs from the union of the two sequence digraphs g({F(q1)}) and g({L(q1)}) only by arc (a,b). In order to formalize this difference we define special sequences. Sequence qiQ is simple, if there do not exist \(t,t^{\prime }\in \textit {types}(q_{i})\) such that

$$ \textit{first}(q_{i},t)<\textit{first}(q_{i},t^{\prime})<\textit{last}(q_{i},t)<\textit{last}(q_{i},t^{\prime}). $$
(7)

Set Q is simple, if every sequence qiQ is simple. We define \(S^{\prime }_{k,\ell }\) to be the set of all sequence digraphs defined by simple sets Q on at most k sequences that contain at most items of each type in types(Q). By the definition we know for every two integers k ≥ 1 and ≥ 1 the following inclusions between these graph classes.

$$ \begin{array}{@{}rcl@{}} S^{\prime}_{k,\ell} & \subseteq & S_{k,\ell} \end{array} $$
(8)
$$ \begin{array}{@{}rcl@{}} S^{\prime}_{k,1} & = & S_{k,1} \end{array} $$
(9)

The sequence q1 = [b,a,c,c,b,a] given in Example 9 is not simple and sequence digraph g({q1}) differs from the union of the two sequence digraphs g({F(q1)}) and g({L(q1)}). The next theorem says that this is no coincidence.

Theorem 4

A sequence q1 is simple if and only if g({q1}) can be obtained by the union of g({F(q1)}) and g({L(q1)}).

Proof 26

(⇒) Let q1 be a simple sequence and g({q1}) = (V,A) its sequence digraph. Further let \(\textit {g}(\{F(q_{1})\})=(V,A^{\prime })\) and \(\textit {g}(\{L(q_{1})\})=(V,A^{\prime \prime })\) be the sequence digraphs of F(q1) and L(q1). We have to show that \(A=A^{\prime }\cup A^{\prime \prime }\).

To show \(A\subseteq A^{\prime }\cup A^{\prime \prime }\) we consider subsequence \(q^{\prime }_{1}=M(q_{1})\) (defined in Section 3.1), which is also simple, defines the same digraph as q1, and contains at most two items for every type. This implies that for every arc (u,v) ∈ A vertices u and v correspond to the first or the last item of its type.

  • If (u,v) ∈ A, \(\textit {first}(q^{\prime }_{1},u)=b_{i}\), and \(\textit {first}(q^{\prime }_{1},v)=b_{j}\) for some i < j, then \((u,v)\in A^{\prime }\).

  • If (u,v) ∈ A, \(\textit {last}(q^{\prime }_{1},u)=b_{i}\), and \(\textit {last}(q^{\prime }_{1},v)=b_{j}\) for some i < j, then \((u,v)\in A^{\prime \prime }\).

  • If (u,v) ∈ A, \(\textit {last}(q^{\prime }_{1},u)=b_{i}\), and \(\textit {first}(q^{\prime }_{1},v)=b_{j}\) for some i < j, then there is some \(i^{\prime }\leq i\) such that \(\textit {first}(q_{1},u)=b_{i^{\prime }}\), which implies that \((u,v)\in A^{\prime }\). Further there is also some \(j^{\prime }\geq j\) such that \(\textit {last}(q_{1},v)=b_{j^{\prime }}\), which implies that \((u,v)\in A^{\prime \prime }\).

  • If (u,v) ∈ A, \(\textit {first}(q^{\prime }_{1},u)=b_{i}\), and \(\textit {last}(q^{\prime }_{1},v)=b_{j}\) for some i < j we consider the following cases. If there is also some \(i^{\prime }\), \(i\leq i^{\prime } <j\), such that \(\textit {last}(q^{\prime }_{1},u)=b_{i^{\prime }}\) then \((u,v)\in A^{\prime \prime }\). If there is also some \(j^{\prime }\), \(i < j^{\prime } \leq j\), such that \(\textit {first}(q^{\prime }_{1},v)=b_{j^{\prime }}\) then \((u,v)\in A^{\prime }\). If none of the two cases is fulfilled, then \(\textit {first}(q^{\prime }_{1},v)<\textit {first}(q^{\prime }_{1},u)<\textit {last}(q^{\prime }_{1},v)< \textit {last}(q^{\prime }_{1},u)\), which is not possible within a simple sequence.

Further by the definition g({F(q1)}) and g({L(q1)}) are subgraphs of G and thus it holds that \(A^{\prime }\cup A^{\prime \prime }\subseteq A\).

(⇐) If q1 is not simple, there exist \(t,t^{\prime }\in \textit {types}(q_{1})\) such that (7) holds for i = 1. Thus arc \((t^{\prime },t)\) is in g({q1}) but not in g({F(q1)}) or g({L(q1)}), which implies that g({q1}) can not be obtained by the union of g({F(q1)}) and g({L(q1)}). □

By the definition for every sequence qi the digraphs g({F(qi)}) and g({L(qi)}) both are in S1,1 (see Theorem 1 for a precise characterization).

Corollary 8

Let \(G\in S^{\prime }_{k,\ell }\), then G can be obtained by the union of 2k digraphs from S1,1.

In order to generalize this result to arbitrary sequences it remains to add the missing arcs \((t^{\prime },t)\) for every \(t,t^{\prime }\in \textit {types}(q_{1})\) such that (7) holds by using further sequences. This is not possible within one additionally sequence for each non-simple sequence.

5 Directed Path-width of Sequence Digraphs

5.1 Directed Path-Width

According to Barát [11], the notion of directed path-width was introduced by Reed, Seymour, and Thomas around 1995 and relates to directed tree-width introduced by Johnson, Robertson, Seymour, and Thomas in [12]. A directed path-decomposition of a digraph G = (V,A) is a sequence (X1,…,Xr) of subsets of V, called bags, such that the following three conditions hold true.

  1. (dpw-1)

    X1 ∪… ∪ Xr = V.

  2. (dpw-2)

    For each (u,v) ∈ A there is a pair ij such that uXi and vXj.

  3. (dpw-3)

    If uXi and uXj for some uV and two indices i,j with ij, then uX for all indices with ij.

The width of a directed path-decomposition \({\mathcal {X}}=(X_{1}, \ldots , X_{r})\) is

$$ \underset{1 \leq i \leq r}{\max} |X_{i}|-1. $$

The directed path-width of G, d-pw(G) for short, is the smallest integer w such that there is a directed path-decomposition for G of width w.

There is a close relation between the directed path-width of some digraph and the (undirected) path-width (see [13]) of its underlying undirected graph.

Lemma 25 (Lemma 1 of 11)

Let G be some complete bioriented digraph, then d-pw(G) = pw(und(G)).

Determining whether the (undirected) path-width of some given (undirected) graph is at most some given value w is NP-complete [14] even for bipartite graphs, complements of bipartite graphs [15], chordal graphs [16], bipartite distance hereditary graphs [17], and planar graphs with maximum vertex degree 3 [18]. Lemma 25 implies that determining whether the directed path-width of some given digraph is at most some given value w is NP-complete even for digraphs whose underlying graphs lie in the mentioned classes. For example determining whether the directed path-width of some given digraph with maximum semi-degree \({\Delta }^{0}(G)=\max \limits \{{\Delta }^{-}(D),{\Delta }^{+}(D)\}\leq 3\) is at most some given value w is NP-complete, which will be useful in Proposition 11. While undirected path-width can be solved by an FPT-algorithm [19], the existence of such an algorithm for directed path-width is still open. The directed path-width of a digraph G = (V,A) can be computed in time \(\mathcal {O}\left ({|A|\cdot |V|^{2\text {d-pw}(G)}}/{(\text {d-pw}(G)-1)!}\right )\) by [3] and in time \(\mathcal {O}(\text {d-pw}(G)\cdot |A|\cdot |V|^{2\text {d-pw}(G)})\) by [4]. This leads to XP-algorithms for directed path-width w.r.t. the standard parameter and implies that for each constant w, it is decidable in polynomial time whether a given digraph has directed path-width at most w. Further in [5] it is shown how to decide whether the directed path-width of an -semicomplete digraph is at most w in time \((\ell +2w+1)^{2w}\cdot |V|^{{\mathcal {O}}(1)}\).

5.2 Hardness of Directed Path-width on Sequence Digraphs

Next we give some conditions on the sequences in Q such that for the corresponding digraph g(Q) computing its directed path-width is NP-hard.

Proposition 10

Given some set Q on k sequences such that ni = 2 for 1 ≤ ik and some integer p, then the problem of deciding whether d-pw(g(Q)) ≤ p is NP-complete.

Proof 27

The stated problem is in NP since we can restrict to directed path-decompositions having a polynomial number of bags. To show the NP-hardness by a reduction from the directed path-width problem we transform instance (G,p) in linear time into instance (q(G),p) for the stated problem. The correctness follows by Observation 3. □

Proposition 11

Given some set Q such that dQ = 3 or cQ = 5 and some integer p, then the problem of deciding whether d-pw(g(Q)) ≤ p is NP-complete.

Proof 28

We show the NP-hardness by a reduction from the path-width problem for undirected graphs G where Δ(G) ≤ 3. Then the complete biorientation G&#x20E1; fulfills \(\max \limits ({\Delta }^{-}(G\&\#x20E1;),{\Delta }^{+}(G\&\#x20E1;))\leq 3\) and by Lemma 25 it holds d-pw(G&#x20E1;) = pw(G). The instance for the stated problem is (Q,p), where Q can be obtained from q(G&#x20E1;) by Lemma 6. The correctness follows by Observation 3. □

Similar results can be shown for related parameters such as directed cut-width [20].

5.3 Polynomial Cases of Directed Path-Width on Sequence Digraphs

Next we consider the directed path-width of sequence digraphs for k = 1 or = 1.

Proposition 12

Let GSk,1, then d-pw(G) = 0.

Proof 29

By Theorem 2 every digraph in Sk,1 is the disjoint union of k digraphs in S1,1. By Theorem 1 every digraph in S1,1 is acyclic and thus has directed path-width 0. □

On the other hand, there are no constants k, such that every digraph of directed path-width 0 is in Sk,. This can be verified by an orientation \(T^{\prime }\) of a tree T on k edges and Δ(T) = . Then \(\text {d-pw}(T^{\prime })=0\) and by Lemma 9 it holds \(T^{\prime }\in S_{k,\ell }\) but \(T^{\prime }\not \in S_{k^{\prime },\ell ^{\prime }}\) for \(k^{\prime }<k\) or \(\ell ^{\prime }<\ell \).

For digraphs in S1,2 the directed path-width can be arbitrary large, since this class includes all bidirectional complete digraphs. We can compute this value as follows. Let Q = {q}. For type ttypes(q) let It = [first(q,t),last(q,t)] be the interval representing t, and let Iq = {Itttypes(q)} be the set of all intervals for sequence q. Let I(q) = (V,E) be the interval graph where V = types(q) and E = {{u,v}∣uv, IuIv,Iu,IvIq}, see Fig. 3.

Fig. 3
figure 3

Sequence q = [a,b,c,d,b,e,c,f,d,g,e,h,g,i,f,h,i,a] represented as an interval graph I(q)

Proposition 13

Let GS1,2 defined by some set Q = {q1} of one sequence, then d-pw(G) = ω(I(q)) − 1 = pw(I(q)).

Proof 30

It holds d-pw(G) ≤ ω(I(q)) − 1 by an obvious directed path-decomposition along I(q). Further for every integer r the set I(r) = {ItrIt} defines a complete subgraph K|I(r)| in I(q) and also a bidirectional complete subdigraph K|I(r)|&#x20E1; in G. Thus it holds d-pw(G) ≥ ω(I(q)) − 1. The second equality holds since the (undirected) path-width of an interval graph is equal to the size of a maximum clique [21]. □

In contrast to Proposition 11 sets Q where dQ = 1 can be handled in polynomial time.

Proposition 14

Given some set Q such that dQ = 1 and some integer p, then the problem of deciding whether d-pw(g(Q)) ≤ p can be solved in time \(\mathcal {O}(|\textit {types}(Q)|^{2}+n)\).

Proof 31

Let Q = {q1,…,qk}. If dQ = 1 the vertex sets Vi = types(qi) are disjoint. That is, g(Q) is the disjoint union of digraphs in S1,2 for which the directed path-width can be computed in time \({\mathcal {O}}({\sum }_{i=1}^{k}|\textit {types}(\{q_{i}\})|^{2}+n_{i})\subseteq \mathcal {O}(|\textit {types}(Q)|^{2}+n)\) by Proposition 13. □

5.4 An XP-Algorithm for Directed Path-Width

We next give an XP-algorithm for directed path-width w.r.t. the parameter k, which implies that for every constant k for a given set Q on at most k sequences the value d-pw(g(Q)) can be computed in polynomial time. The main idea is to discover an optimal directed path-decomposition by scanning the k sequences left-to-right and keeping in a state the numbers of scanned items of every sequence and a certain number of active types.

Since d-pw(G) = 0 for GSk,1 by Proposition 12, we assume that there are at least two items for each type in Q. If this is not the case, we insert another item directly after the only item of some type for each type and get \(Q^{\prime }\). Obviously, this does not change the sequence digraph, so it holds \(g(Q) = g(Q^{\prime })\). Such an insertion of additional items does not change the asymptotic runtime, since \(|Q^{\prime }| \leq 2 \cdot |Q|\). If algorithm A has runtime \(T_{A}(|I|) \in {\mathcal {O}}(|I|^{c})\) for some instance I and constant c, then after the modification of the instance A has runtime \(T_{A}(|I^{\prime }|) \leq T_{A}(2 \cdot |I|) \in \mathcal {O}((2 \cdot |I|)^{c}) = {\mathcal {O}}(2^{c} \cdot |I|^{c}) = \mathcal {O}(|I|^{c})\) since 2c is constant.

Example 10

Let Q = {q1,q2} be the set of sequences q1 = [a,b,c,b,d,a] and q2 = [e,f,e,c]. Then there is only one item for type d and one item for f contained in the sequences, so we add two further items, one for type d in q1 and one for type f in q2 and we get the modified set of sequences \(Q^{\prime }=\{q^{\prime }_{1}, q^{\prime }_{2}\}\) and \(q^{\prime }_{1} = [a,b,c,b,d,d,a]\) and \(q^{\prime }_{2} = [e,f,f,e,c]\). The sequence digraph \(\textit {g}(Q) = g(Q^{\prime })\) is given in Fig. 4.

Fig. 4
figure 4

Sequence digraph of Example 10

Let Q = {q1,…,qk} be a set of k sequences. Every k-tuple (i1,…,ik) where 0 ≤ ijnj for 1 ≤ jk is a state of Q. State (0,0,…,0) is the initial state and (n1,…,nk) is the final state. The state digraph s(Q) for a set Q has a vertex for each possible state. There is an arc from vertex u labeled by (u1,…,uk) to vertex v labeled by (v1,…,vk) if and only if ui = vi − 1 for exactly one element of the vector and for all other elements of the vector uj = vj.

Let s = (i1,…,ik) be a state of Q. We define L(s) to be the set of all items on the positions 1,…,ij for 1 ≤ jk and R(s) is the set of all items on the remaining positions ij + 1,…,nj for 1 ≤ jk. Furthermore, we define M(s) to be the set of items on the positions ij + 1 for 1 ≤ jk and front(s) = {t(b)∣bM(s)} to be the set of types of the items in M(s). Obviously, for every state s = (i1,…,ik) it holds that L(s) ∪ R(s) leads to a disjoint partition of the items in Q and \(M(s) \subseteq R(s)\).

Further each vertex v of the state digraph is labeled by the value f(v). This value is the number of types t such that there is at least one item of type t in L(v) and at least one item of type t in R(v). Formally we define \(\textit {active}(v)=\{t\in \textit {types}(Q) \mid b\in L(v), t(b)=t, b^{\prime }\in R(v), t(b^{\prime })=t\}\) and f(v) = |active(v)|. Obviously, for the initial state u and the final state v it holds |active(u)| = |active(v)| = 0. Since the state digraph s(Q) is a directed acyclic graph we can compute all values |active(v)| using a topological ordering topol of the vertices. Every arc (u,v) in s(Q) represents one item bi,j, thus

$$ \begin{array}{@{}rcl@{}} &|& \textit{active}((i_{1}, \ldots, i_{j-1}, i_{j}+1, i_{j+1}, \ldots, i_{k}))|\\ &=&|\textit{active}((i_{1}, \ldots, i_{j-1}, i_{j}, i_{j+1}, \ldots, i_{k}))| + c_{j} \end{array} $$
(10)

where

$$ c_{j} = \left\{ \begin{array}{lll} {\kern8pt}1, \text{if } \textit{first}(q_{j},t) = i_{j}+1 \text{ and } \textit{first}(q_{\ell},t) > i_{\ell} ~~\forall ~\ell \neq j \\ -1, \text{if } \textit{last}(q_{j},t) = i_{j}+1 \text{ and } \textit{last}(q_{\ell},t) \leq i_{\ell} ~~\forall ~\ell \neq j \\ {\kern8pt}0, {\text{otherwise}.} \end{array} \right. $$

Please remember our technical definition of first(q,t) and last(q,t) from Section 3.1 for the case that ttypes(q). Thus, the calculation of value |active(i1,…,ik)| for the vertex labeled (i1,…,ik) depends only on already calculated values, which is necessary in order to use dynamic programming.

Example 11 (State digraph)

Let Q = {q1,q2} be the set of sequences q1 = [a,b,c,b,d,d,a] and q2 = [e,f,f,e,c]. The state digraph s(Q) is given in Fig. 5. For every vertex v of s(Q) the vector h(v) in the vertex represents the state of v and every arc is labeled with the type of the item, that is considered in order to obtain the next state, and the number f(v) is given on the left of the vertex that represents state h(v).

Fig. 5
figure 5

State digraph of Example 11

Let \(\mathcal {P}(Q)\) be the set of all paths from the initial state to the final state in s(Q). Every path \(P\in \mathcal {P}(Q)\) has \(r=1+{\sum }_{i=1}^{k}n_{i}\) vertices, i.e. P = (v0,…,vr). First we observe that every path in \(\mathcal {P}(Q)\) leads to a directed path-decomposition for g(Q).

Lemma 26

Let Q be some set of k sequences and \((v_{0},\ldots ,v_{r})\in \mathcal {P}(Q)\). Then the sequence (active(v1),…,active(vr− 1)) is a directed path-decomposition for g(Q).

Proof 32

Let g(Q) = (V,A) be the sequence digraph, s(Q) = (S,B) be the state digraph, and P = (v0,…,vr) be an arbitrary path from the initial state to the final state in s(Q). We next will verify the three conditions of a directed path-decomposition. Since types(Q) = V we identify the vertices with their types.

  • For any type ttypes(Q), let (vi− 1,vi) be the first arc on the path P labeled by t. Then tactive(vi) is valid, because later there is another arc (vj− 1,vj) with i < j, which is also marked with t, because there are always at least two items per type. It follows that V = active(v1) ∪… ∪active(vr− 1).

  • Let \((t,t^{\prime })\in A\). By the definition of g(Q) there is one sequence q such that there is an item b,m of type t and an item \(b_{\ell ,m^{\prime }}\) of type \(t^{\prime }\) such that \(m<m^{\prime }\). Thus there is a vertex vi in P such that b,mL(vi) − L(vi− 1) and a vertex vj in P such that \(b_{\ell ,m^{\prime }} \in L(v_{j}) - L(v_{j-1})\), and i < j. If (vi− 1,vi) is the first arc on the path P labeled by t then tactive(vi), else tactive(vi− 1). If (vj− 1,vj) is the first arc on the path P labeled by \(t^{\prime }\) then \(t^{\prime } \in \textit {active}(v_{j})\), else \(t^{\prime } \in \textit {active}(v_{j-1})\). Thus \(t \in \textit {active}(v_{i^{\prime }})\) and \(t^{\prime } \in \textit {active}(v_{j^{\prime }})\) for some \(i^{\prime } \leq j^{\prime }\).

  • Let (vi− 1,vi) be the first arc on path P labeled by t and let (vk,vk+ 1) be the last arc on path P labeled by t. Then tactive(vj) is valid for ijk, and tactive(vj) is valid for j < i or j > k. It follows that for each tactive(vi) ∩active(vk) it also holds tactive(vj) for ijk.

Thus, sequence (active(v1),…,active(vr− 1)) is a directed path-decomposition for g(Q). □

Example 12 (Paths in s(Q))

We consider two paths in s(Q) of Example 11.

  1. 1.

    The path

    $$ \begin{array}{@{}rcl@{}} P_{1} & = & ((0,0),(0,1),(0,2),(1,2),(2,2),(3,2),(3,3), \\ & & (3,4),(3,5),(4,5),(5,5),(6,5),(7,5) ~) \end{array} $$

    leads to the directed path-decomposition

    $$ \begin{array}{@{}rcl@{}} & & (\{e\},\{e,f\},\{a,e,f\},\{a,b,e,f\},\{a,b,c,e,f\},\{a,b,c,e\}, \\ & & \{a,b,c\},\{a,b\},\{a\},\{a,d\},\{a\} ~) \end{array} $$

    of width 4 for g(Q). The path is shown in red in Fig. 5.

  2. 2.

    The path

    $$ \begin{array}{@{}rcl@{}} P_{2} & =& ((0,0),(1,0),(1,1),(1,2),(1,3),(1,4),(2,4), \\ & & (3,4),(4,4), (5,4),(6,4),(7,4),(7,5) ~) \end{array} $$

    leads to the directed path-decomposition

    $$ (\{a\},\{a,e\},\{a,e,f\},\{a,e\},\{a\},\{a,b\}, \{a,b,c\},\{a,c\},\{a,c,d\},\{a,c\},\{c\}) $$

    of width 2 for g(Q). The path is shown in blue in Fig. 5.

Example 12 shows that \(P\in \mathcal {P}(Q)\) can lead to directed path-decompositions of non-optimal width. Lemma 26 leads to an upper bound on the directed path-width of g(Q) using the state digraph. The reverse direction is considered next.

Lemma 27

Let Q be some set of k sequences. If there is a directed path-decomposition \({\mathcal {X}}=(X_{1}, \ldots , X_{m})\) of width p − 1 for g(Q), then there is a path \((v_{0},\ldots ,v_{r})\in \mathcal {P}(Q)\) such that for every 1 ≤ ir it holds |active(vi)|≤ p.

Proof 33

For a type t let \(\alpha ({\mathcal {X}},t)\) be the smallest i such that tXi and \(\beta ({\mathcal {X}},t)\) be the largest i such that tXi, see Example 13. Then tXi if and only if \(\alpha ({\mathcal {X}},t)\le i \le \beta ({\mathcal {X}},t)\). If (t1,t2) is an arc of g(Q), then \(\alpha ({\mathcal {X}},t_{1}) \leq \beta ({\mathcal {X}},t_{2})\). This follows by (dpw-2) of the definition of a directed path-decomposition.

We define the path P = (u0,…,ur) inductive in the following way. Consider the last vertex u on the already constructed path. Let v1,…,vk be the neighbors of u in state digraph s(Q) and let tj be the type of the item that is considered in order to obtain vertex vj.

  • If there is a type tfront(u) such that tactive(u) then let vj be the next vertex on path P, if t = tj.

  • Otherwise, if there is no type tfront(u) such that tactive(u), then let tfront(u) be the type such that \(\alpha (\mathcal {X},t)\) is minimal.

We next show that for every vertex u of path P there is a bag Xi in the directed path-decomposition \({\mathcal {X}}=(X_{1}, \ldots , X_{m})\), such that \(\textit {active}(u) \subseteq X_{i}\). This implies that |active(u)|≤ p holds for each vertex u on path P.

First, let v be a vertex we get by case (b) from above, let u be the preceding vertex of v on path P, and let arc (u,v) be labeled with t in state digraph s(Q). Then \(\alpha ({\mathcal {X}},t)\) is minimal, and let \(t^{\prime } \in \textit {active}(u)\). We show that the intervals \([\alpha ({\mathcal {X}},t),\beta ({\mathcal {X}},t)]\) and \([\alpha ({\mathcal {X}},t^{\prime }),\beta ({\mathcal {X}},t^{\prime })]\) overlap, because \(\alpha ({\mathcal {X}},t) \leq \beta ({\mathcal {X}},t^{\prime })\) and \(\alpha ({\mathcal {X}},t^{\prime }) \leq \beta ({\mathcal {X}},t)\).

  1. (1)

    To show \(\alpha ({\mathcal {X}},t) \leq \beta ({\mathcal {X}},t^{\prime })\) we observe the following:

    Since \(t^{\prime } \notin \textit {front}(u)\), there has to be a type \(t^{\prime \prime } \in \textit {front}(u)\) such that \((t^{\prime \prime },t^{\prime })\) is an arc of g(Q). This implies that \(\alpha ({\mathcal {X}},t^{\prime \prime }) \leq \beta ({\mathcal {X}},t^{\prime })\). Since t is a type of front(u) for which \(\alpha ({\mathcal {X}},t)\) is minimal, we have \(\alpha ({\mathcal {X}},t) \leq \alpha ({\mathcal {X}},t^{\prime \prime })\) and thus \(\alpha ({\mathcal {X}},t) \leq \beta ({\mathcal {X}},t^{\prime })\).

  2. (2)

    To show \(\alpha ({\mathcal {X}},t^{\prime }) \leq \beta ({\mathcal {X}},t)\) we observe the following:

    Let \(w^{\prime }\) be the first vertex such that \(t^{\prime } \in \textit {active}(w^{\prime })\), and let w be the preceding vertex of \(w^{\prime }\) on path P. We distinguish two cases:

    1. (a)

      tfront(w). Since \(t^{\prime }\) is a type of front(w) for which \(\alpha ({\mathcal {X}},t^{\prime })\) is minimal, we have \(\alpha ({\mathcal {X}},t^{\prime }) \leq \alpha ({\mathcal {X}},t)\) and thus \(\alpha ({\mathcal {X}},t^{\prime }) \leq \beta ({\mathcal {X}},t)\).

    2. (b)

      tfront(w). Then there is a type \(t^{\prime \prime } \in \textit {front}(w)\) such that \((t^{\prime \prime },t)\) is an arc of g(Q). This implies that \(\alpha ({\mathcal {X}},t^{\prime \prime }) \leq \beta ({\mathcal {X}},t)\). Since \(t^{\prime }\) is a type of front(w) for which \(\alpha ({\mathcal {X}},t^{\prime })\) is minimal, we have \(\alpha ({\mathcal {X}},t^{\prime }) \leq \alpha ({\mathcal {X}},t^{\prime \prime }) \leq \beta ({\mathcal {X}},t)\).

Finally, let v be an arbitrary vertex on the path P. By the discussion above, we can conclude that for every pair ti,tjactive(v) the intervals \([\alpha ({\mathcal {X}},t_{i}),\beta ({\mathcal {X}},t_{i})]\) and \([\alpha ({\mathcal {X}},t_{j}),\beta ({\mathcal {X}},t_{j})]\) overlap, because ti first appears on path P or tj first appears on path P. Since the cut of all intervals \([\alpha ({\mathcal {X}},t_{i}),\beta ({\mathcal {X}},t_{i})]\), tiactive(v) mutually overlap, there is a bag Xj in the directed path-decomposition \({\mathcal {X}}\) such that \(\textit {active}(v) \subseteq X_{j}\). □

Example 13

Let Q = {q1,q2} be the set of sequences q1 = [a,b,c,b,d,d,a] and q2 = [e,f,f,e,c] from Example 11 and let \(\mathcal {X} = (\{a,e,f\}, \{a,b,c\},\{d\})\) be a directed path-decomposition. Then we get the following values for \(\alpha ({\mathcal {X}},t)\) and \(\beta ({\mathcal {X}},t)\).

figure b

The defined path in state digraph s(Q) is shown in Table 4.

Table 4 Construction of a path P = (v0,…,vr) for a given set Q of sequences and a directed path-decomposition of g(Q) of Example 13 to visualize the idea of the proof of Lemma 27

By Lemmas 26 and Lemma 27 we obtain the following result.

Corollary 9

Given some set Q of k sequences, then

$$ \text{d-pw}(\textit{g}(Q)) = \underset{(v_{0},\ldots,v_{r}) \in \mathcal{P}(Q)}{\min} \underset{1 \leq i \leq r-1}{\max} |\textit{active}(v_{i})| - 1. $$

In order to apply Corollary 9 we consider some general digraph problem. Let G = (V,A,f) be a directed acyclic vertex-labeled graph. Function \(f: V \to {\mathbb {Z}}\) assigns to every vertex vV a value f(v). Let sV and tV be two vertices. For some vertex vV and some path P = (v1,…,v) with v1 = s, v = v and (vi,vi+ 1) ∈ A we define \(val_{P}(v) := \max \limits _{u \in P} (f(u))\). Let \({\mathcal {P}}_{s}(v)\) denote the set of all paths from vertex s to vertex v. We define \(val(v) := \min \limits _{P \in {\mathcal {P}}_{s}(v)} (val_{P}(v))\). Then it holds:

$$ val(v) = \max\{ f(v), \underset{u \in N^{-}(v)}{\min}(val(u)) \}. $$

In Fig. 6 we give a dynamic programming solution to compute all the values of val(v), vV in time \(\mathcal {O}(|V|+|A|)\). This is possible, since the graph is directed and acyclic.

Fig. 6
figure 6

Computing a path where the maximum value is as small as possible

Corollary 9 allows us to apply the algorithm given in Fig. 6 on s(Q) to compute the directed path-width of g(Q).

Theorem 5

Given some set Q, such that g(Q) ∈ Sk, for some ≥ 1, then the directed path-width of g(Q) and a directed path-decomposition can be computed in time \(\mathcal {O}(k\cdot (1+\max \limits _{1\leq i \leq k}n_{i})^{k})\).

Proof 34

Let Q be some set, such that g(Q) ∈ Sk,. The state digraph s(Q) has at most \((1+\max \limits _{1\leq i \leq k}n_{i})^{k}\) vertices and can be found in time \(\mathcal {O}(k \cdot (1+\max \limits _{1\leq i \leq k}n_{i})^{k})\) from Q. By Corollary 9 the directed path-width of g(Q) can be computed by considering all paths from the initial state to the final state in s(Q). This can be done by the algorithm given in Fig. 6 on s(Q) = (V,A) using f(v) = |active(v)|, vV, s as the initial state, and t as the final state. Since every vertex of the state digraph has at most k outgoing arcs we have \(\mathcal {O}(|V|+|A|)\subseteq \mathcal {O}(k\cdot (1+\max \limits _{1\leq i \leq k}n_{i})^{k})\). Thus we can compute an optimal path in s(Q) in time \(\mathcal {O}(k\cdot (1+\max \limits _{1\leq i \leq k}n_{i})^{k})\). □

These results lead to an XP-algorithm for directed path-width w.r.t. number of sequences k needed to define the input graph. This implies that for each constant k, it is decidable in polynomial time whether for a given set Q on at most k sequences the digraph g(Q) has directed path-width at most w. If we know that some graph can be defined by one sequence, we can find this in linear time (Proposition 6). This implies that for each constant k, it is decidable in polynomial time whether for a digraph G, which is given by the union of at most k many \(\{\text {co-}(2\overrightarrow {P_{2}}),2K_{1\&\#x20E1;},\overrightarrow {C_{3}},D_{4}\}\)-free digraphs, digraph G has directed path-width at most w.

6 Conclusions and Outlook

In this paper, we have considered digraphs which can be defined by a set of k sequences. We have shown an XP-algorithm for directed path-width w.r.t. number of sequences k needed to define the input graph. For special digraphs our solution improves known solution w.r.t. the standard parameter as shown in Table 1. This implies that for each constant k, it is decidable in polynomial time whether for a given set Q on at most k sequences the digraph g(Q) has directed path-width at most w. If we know that some digraph can be defined by one sequence, we can find this in linear time (Proposition 6). This implies that for each constant k, it is decidable in polynomial time whether for a digraph G, which is given by the union of at most k many semicomplete \(\{\text {co-}(2\overrightarrow {P_{2}}),\overrightarrow {C_{3}},D_{4}\}\)-free digraphs, digraph G has directed path-width at most w.

There are several interesting open questions. (a) In Section 5.4 we have shown XP-algorithms for the directed path-width problem w.r.t. parameter k (number of sequences). It remains open whether there are also FPT-algorithms for this parameter. The same question is open for the standard parameter. (b) Does the hardness of Proposition 11 also hold for cQ ∈{2,3,4} and for dQ = 2? (c) By Theorem 1 one can decide in polynomial time whether a given digraph belongs to the class S1,1. By Lemma 12 this is also possible for every class Sk,1. Furthermore Theorem 3 allows to recognize the classes S1,2 in polynomial time. It remains to consider this problem for the classes Sk, for k ≥ 2 and 1 < ≤ 2k. (d) In order to apply Corollary 9 for some given digraph G we need a set Q such that g(Q) = G. Can we find a set Q with a smallest number of sequences in polynomial time? (e) Can we find a simple set Q with a smallest number of sequences in polynomial time? (f) By its equivalence to directed vertex separation number [22] directed path-width is a vertex ordering problem (layout problem). This motivates to solve similar problems such as directed cut-width or directed feedback arc set (see [23] for a survey) on sequence digraphs. Is there even a general approach to solve vertex ordering problem on sequence digraphs (see [23] for a general approach on undirected graphs)?