1 Introduction

For any \(n \in \mathbb {N}\), \(n \ge 2\), let \(\mathrm {Sing}_n\) be the semigroup of all singular (i.e. non-invertible) transformations on \([n]:=\left\{ 1,\ldots ,n\right\} \). It is well known (see [2]) that \(\mathrm {Sing}_n\) is generated by its idempotents of defect 1 (i.e. the transformations \(\alpha \in \mathrm {Sing}_n\) such that \(\alpha ^2 = \alpha \) and \(\mathrm {rk}(\alpha ) := \vert \mathrm {Im}(\alpha ) \vert = n-1\)). There are exactly \(n(n-1)\) such idempotents, and each one of them may be written as \((a \rightarrow b)\), for \(a,b \in [n]\), \(a \ne b\), where, for any \(v \in [n]\),

$$\begin{aligned} (v) (a \rightarrow b) := {\left\{ \begin{array}{ll} b &{}\quad \text {if } v = a,\\ v &{}\quad \text {otherwise}. \end{array}\right. } \end{aligned}$$

Motivated by this notation, we refer to these idempotents as arcs.

In this paper, we explore the natural connections between simple digraphs on [n] and subsemigroups of \(\mathrm {Sing}_n\). For any subset \(U \subseteq \mathrm {Sing}_n\), denote by \(\langle U \rangle \) the semigroup generated by U. For any simple digraph D with vertex set \(V(D)=[n]\) and edge set E(D), we associate the semigroup

$$\begin{aligned} \langle D \rangle := \left\langle (a \rightarrow b) \in \mathrm {Sing}_n : (a,b) \in E(D) \right\rangle . \end{aligned}$$

We say that a subsemigroup S of \(\mathrm {Sing}_n\) is arc-generated by a simple digraph D if \(S=\langle D \rangle \).

For the rest of the paper, we use the term ‘digraph’ to mean ‘simple digraph’ (i.e. a digraph with no loops or multiple edges). A digraph D is undirected if its edge set is a symmetric relation on V(D), and it is transitive if its edge set is a transitive relation on V(D). We shall always assume that D is connected (i.e. for every pair \(u, v \in V(D)\) there is either a path from u to v, or a path from v to u) because otherwise \(\langle D \rangle \cong \langle D_1\rangle \times \dots \times \langle D_k\rangle \), where \(D_1, \dots , D_k\) are the connected components of D. We say that D is strong (or strongly connected) if for every pair \(u,v \in V(D)\), there is a directed path from u to v. We say that D is a tournament if for every pair \(u,v \in V(D)\) we have \((u,v) \in E(D)\) or \((v,u) \in E(D)\), but not both.

Many famous examples of semigroups are arc-generated. Clearly, by the discussion of the first paragraph, \(\mathrm {Sing}_n\) is arc-generated by the complete undirected graph \(K_n\). In fact, for \(n \ge 3\), \(\mathrm {Sing}_n\) is arc-generated by D if and only if D contains a strong tournament (see [3]). The semigroup of order-preserving transformations \(\text {O}_n := \{ \alpha \in \mathrm {Sing}_n : u \le v \Rightarrow u \alpha \le v \alpha \}\) is arc-generated by an undirected path \(P_n\) on [n], while the Catalan semigroup \(\text {C}_n := \{ \alpha \in \mathrm {Sing}_n : v \le v \alpha , u \le v \Rightarrow u \alpha \le v \alpha \}\) is arc-generated by a directed path \(\vec {P}_n\) on [n] (see [9, Corollary 4.11]). The semigroup of non-decreasing transformations \(\text {OI}_n := \{ \alpha \in \mathrm {Sing}_n : v \le v \alpha \}\) is arc-generated by the transitive tournament \(\vec {T}_n\) on [n] (Fig. 1 illustrates \(\vec {T}_5\)).

Fig. 1
figure 1

\(\vec {T}_5\)

Connections between subsemigroups of \(\mathrm {Sing}_n\) and digraphs have been studied before (see [912]). The following definition, which we shall adopt in the following sections, appeared in [12]:

Definition 1

For a digraph D, the closure \({\bar{D}}\) of D is the digraph with vertex set \(V({\bar{D}}) := V\left( D\right) \) and edge set \(E({\bar{D}}):=E\left( D\right) \cup \left\{ \left( a,b \right) :\left( b ,a \right) \in E\left( D\right) \text { is in a} \text {directed cycle of} D\right\} \).

Say that D is closed if \(D = {\bar{D}}\). Observe that \(\langle D \rangle = \langle {\bar{D}} \rangle \) for any digraph D.

Recall that the orbits of \(\alpha \in \mathrm {Sing}_n\) are the connected components of the digraph on [n] with edges \(\{ (x, x\alpha ) : x \in [n] \}\). In particular, an orbit \(\Omega \) of \(\alpha \) is called cyclic if it is a cycle with at least two vertices. An element \(x \in [n]\) is a fixed point of \(\alpha \) if \(x\alpha =x\). Denote by \(\mathrm {cycl}(\alpha )\) and \(\mathrm {fix}(\alpha )\) the number of cyclic orbits and fixed points of \(\alpha \), respectively. Denote by \(\ker (\alpha )\) the partition of [n] induced by the kernel of \(\alpha \) (i.e. the equivalence relation \(\{ (x,y) \in [n]^2 : x\alpha = y \alpha \}\)).

We introduce some further notation. For any digraph D and \(v \in V(D)\), define the in-neighbourhood and the out-neighbourhood of v by

$$\begin{aligned} N^-(v) := \{ u \in V(D) : (u, v) \in E(D)\} \text { and } N^+(v) := \{u \in V(D) : (v,u) \in E(D) \}, \end{aligned}$$

respectively. We extend these definitions to any subset \(C \subseteq V(D)\) by letting \(N^\epsilon (C) := \bigcup _{c \in C} N^\epsilon (c)\), where \(\epsilon \in \{+,- \}\). The in-degree and out-degree of v are \(\deg ^-(v):=\vert N^-(v) \vert \) and \(\deg ^+(v):=\vert N^+(v) \vert \), respectively, while the degree of v is \(\deg (v) := \vert N^-(v) \cup N^+(v) \vert \). For any two vertices \(u,v \in V(D)\), the D-distance from u to v, denoted by \(d_D(u,v)\), is the length of a shortest path from u to v in D, provided that such a path exists. The diameter of D is \(\mathrm {diam}(D) := \max \{ d_D(u,v) : u,v \in V(D), \ d_D(u,v) \text { is defined} \}\).

Let D be any digraph on [n]. We are interested in the lengths of transformations of \(\langle D\rangle \) viewed as words in the free monoid \(D^* := \{ (a \rightarrow b ) : (a,b)\in E(D)\}^*\). Say that a word \(\omega \in D^*\) expresses (or evaluates to) \(\alpha \in \langle D\rangle \) if \(\alpha = \omega \phi \), where \(\phi : D^* \rightarrow \langle D\rangle \) is the evaluation semigroup morphism. For any \(\alpha \in \langle D \rangle \), let \(\ell (D,\alpha )\) be the minimum length of a word in \(D^*\) expressing \(\alpha \). For \(r \in [n-1]\), denote

$$\begin{aligned} \ell (D,r)&:= \max \left\{ \ell (D,\alpha ) : \alpha \in \langle D \rangle , \mathrm {rk}(\alpha ) = r \right\} ,\\ \ell (D)&:= \max \left\{ \ell (D,\alpha ) : \alpha \in \langle D \rangle \right\} . \end{aligned}$$

The main result in the literature in the study of \(\ell (D,\alpha )\) was obtained by Howie and Iwahori, independently, when \(D = K_n\).

Theorem 1.1

[4, 5] For any \(\alpha \in \mathrm {Sing}_n\),

$$\begin{aligned} \ell (K_n, \alpha ) = n+ \mathrm {cycl}(\alpha ) - \mathrm {fix}(\alpha ). \end{aligned}$$

Therefore, \(\ell (K_n, r) = n + \left\lfloor \frac{1}{2} (r-2) \right\rfloor \), for any \(r \in [n-1]\), and \(\ell (K_n) = \ell (K_n, n-1) = \left\lfloor \frac{3}{2} (n-1) \right\rfloor \).

In the following sections, we study \(\ell (D, \alpha )\), \(\ell (D,r)\), and \(\ell (D)\), for various classes of digraphs. In Sect. 2, we characterise all digraphs D on [n] such that either \(\ell (D, \alpha ) = n + \mathrm {cycl}(\alpha ) - \mathrm {fix}(\alpha )\) for all \(\alpha \in \langle D\rangle \), or \(\ell (D, \alpha ) =n - \mathrm {fix}(\alpha )\) for all \(\alpha \in \langle D\rangle \), or \(\ell (D, \alpha ) =n - \mathrm {rk}(\alpha )\) for all \(\alpha \in \langle D\rangle \). In Sect. 3, we are interested in the maximal possible length of a transformation in \(\langle D\rangle \) of rank r among all digraphs D on [n] of certain class \(\mathcal {C}\); we denote this number by \(\ell _{\max }^{\mathcal {C}}(n,r)\). In particular, when \(\mathcal {C}\) is the class of acyclic digraphs, we find an explicit formula for \(\ell _{\max }^{\mathcal {C}}(n,r)\). When \(\mathcal {C}\) is the class of strong tournaments, we find upper and lower bounds for \(\ell _{\max }^{\mathcal {C}}(n,r)\) (and for the analogously defined \(\ell _{\min }^{\mathcal {C}}(n,r)\)). Finally, in Sect. 4 we provide a list of conjectures and open problems.

2 Arc-generated semigroups with short words

Let D be a digraph on [n], \(n \ge 3\), and \(\alpha \in \langle D \rangle \). Theorem 1.1 implies the following three bounds:

$$\begin{aligned} \ell (D, \alpha ) \ge n + \mathrm {cycl}(\alpha ) - \mathrm {fix}(\alpha ) \ge n - \mathrm {fix}(\alpha ) \ge n- \mathrm {rk}(\alpha ). \end{aligned}$$
(1)

The lowest bound is always achieved for constant transformations (i.e. transformations of rank 1).

Lemma 2.1

For any digraph D on [n], if \(\alpha \in \langle D \rangle \) has rank 1, then \(\ell (D, \alpha ) = n - 1\).

Proof

It is clear that \(\ell (D, \alpha ) \ge n-1\) because \(\alpha \) has \(n-1\) non-fixed points. Let \(\mathrm {Im}(\alpha ) = \{v_0\} \subseteq [n]\). Note that, for any \(v \in [n]\), there is a directed path in D from v to \(v_0\) (as otherwise, \(\alpha \not \in \langle D \rangle \)). For any \(d \ge 1\), let

$$\begin{aligned} C_d := \{ v \in [n] : d_D(v,v_0) = d\}. \end{aligned}$$

Clearly, \([n] {\setminus } \{ v_0 \}= \bigcup _{d=1}^{m} C_d\), where \(m := \max _{v\in [n]}\{ d_{D}(v,v_0) \}\) and the union is disjoint. For any \(v \in C_d\), let \(v'\) be a vertex in \(C_{d-1}\) such that \((v \rightarrow v') \in D\). For any distinct \(v, u \in C_d\) and any choice of \(v', u' \in C_{d-1}\), the arcs \((v \rightarrow v')\) and \((u \rightarrow u')\) commute; hence, we can decompose \(\alpha \) as

$$\begin{aligned} \alpha = \bigcirc _{d=m}^1 \bigcirc _{v \in C_d} (v \rightarrow v'), \end{aligned}$$

where the composition of arcs is done from m down to 1. \(\square \)

Remark 1

Using a similar argument as in the previous proof, we may show that \(\langle D \rangle \) contains all constant transformations if and only if D is strongly connected.

Inspired by the bounds given in (1), we characterise all the connected digraphs D on [n] satisfying the following conditions:

figure a
figure b
figure c

2.1 Digraphs satisfying condition (C1)

Theorem 1.1 says that \(K_n\) satisfies (C1). In order to characterise all digraphs satisfying (C1), we introduce the following property on a digraph D:

(\(\star \)):

If \(d_D(v_0, v_2) = 2\) and \(v_0,v_1,v_2\) is a directed path in D, then \(N^+\left( \{v_1,v_2\}\right) \subseteq \{v_0,v_1,v_2\}\).

We shall study the strong components of digraphs satisfying property \((\star )\). We state few observations that we use repeatedly in this section.

Remark 2

Suppose that D satisfies property \((\star )\). If \(v_0, v_1, v_2\) is a directed path in D and \(\deg ^+(v_1) >2\), or \(\deg ^+(v_2) >2\), then \((v_0, v_2) \in E(D)\). Indeed, if \((v_0, v_2) \not \in E(D)\), then \(d_D(v_0, v_2) = 2\), so, by property \((\star )\), \(N^+\left( \{v_1,v_2\}\right) \subseteq \{v_0,v_1,v_2\}\); this contradicts that \(\deg ^+(v_1) >2\), or \(\deg ^+(v_2) >2\).

Remark 3

Suppose that D satisfies property \((\star )\). If \(v_0, v_1, v_2\) is a directed path in D and either \(v_1\) or \(v_2\) has an out-neighbour not in \(\{ v_0, v_1, v_2 \}\), then \((v_0,v_1) \in E(D)\).

Remark 4

If D satisfies property \((\star )\), then \(\mathrm {diam}(D) \le 2\). Indeed, if \(v_0, v_1, \dots , v_k\) is a directed path in D with \(d_D (v_0, v_k) = k \ge 3\), then \(v_0, v_1, v_2\) is a directed path in D and \(v_2\) has an out-neighbour \(v_3 \not \in \{ v_0, v_1, v_2 \}\); by Remark 3, \((v_0,v_2)\in E(D)\), which contradicts that \(d_D (v_0, v_k) = k\).

Note that digraphs satisfying property \((\star )\) are a slight generalisation of transitive digraphs.

Let D be a digraph and let \(C_1\) and \(C_2\) of be two strong components of D. We say that \(C_1\) connects to \(C_2\) if \((v_1, v_2) \in E(D)\) for some \(v_1 \in C_1\), \(v_2 \in C_2\); similarly, we say that \(C_1\) fully connects to \(C_2\) if \((v_1, v_2) \in E(D)\) for all \(v_1 \in C_1\), \(v_2 \in C_2\). The strong component \(C_1\) is called terminal if there is no strong component \(C \ne C_1\) of D such that \(C_1\) connects to C.

Lemma 2.2

Let D be a closed digraph satisfying property \((\star )\). Then, any strong component of D is either an undirected path \(P_3\) or complete. Furthermore, \(P_3\) may only appear as a terminal strong component of D.

Proof

Let C be a strong component of D. Since D is closed, C must be undirected. The lemma is clear if \(\vert C \vert \le 3\), so assume that \(\vert C \vert \ge 4\). We have two cases:

Case 1 :

Every vertex in C has degree at most 2. Then C is a path or a cycle. Since \(\vert C \vert \ge 4\) and \(\mathrm {diam}(D) \le 2\), then C is a cycle of length 4 or 5; however, these cycles do not satisfy property \((\star )\).

Case 2 :

There exists a vertex \( a \in C\) of degree 3 or more. Any two neighbours of a are adjacent: indeed, for any \(u,v \in N(a)\), uav is a path and \(\deg ^+(a) > 2\), so \((u,v) \in E(D)\) by Remark 2. Hence, the neighbourhood of a is complete and every neighbour of a has degree 3 or more. Applying this rule recursively, we obtain that every vertex in C has degree 3 or more, and the neighbourhood of every vertex is complete. Therefore, C is complete because \(\mathrm {diam}(D) \le 2\).

Finally, if \(P_3\) is a strong component of D, there cannot be any edge coming out of it because of property \((\star )\), so it must be a terminal component. \(\square \)

Lemma 2.3

Let D be a closed digraph satisfying property \((\star )\). Let \(C_1\) and \(C_2\) be strong components of D, and suppose that \(C_1\) connects to \(C_2\).

  1. (i)

    If \(C_2\) is non-terminal, then \(C_1\) fully connects to \(C_2\).

  2. (ii)

    Let \(|C_2| = 1\). If either \(|C_1| \ne 2\), or the vertex in \(C_1\) that connects to \(C_2\) has out-degree at least 3, then \(C_1\) fully connects to \(C_2\).

  3. (iii)

    Let \(|C_2| = 2\). If not all vertices in \(C_1\) connect to the same vertex in \(C_2\), then \(C_1\) fully connects to \(C_2\).

  4. (iv)

    If \(|C_2| \ge 3\), then \(C_1\) fully connects to \(C_2\).

Proof

Recall that \(C_1\) and \(C_2\) are undirected because D is closed. If \(|C_1| = 1\) and \(|C_2| = 1\), clearly \(C_1\) fully connects to \(C_2\). Henceforth, we assume \(|C_1| \ge 2\) or \(|C_2| \ge 2\). Let \(c_1 \in C_1\) and \(c_2 \in C_2\) be such that \((c_1,c_2) \in E(D)\). As \(C_1\) is a non-terminal, Lemma 2.2 implies that \(C_1\) is complete.

  1. (i)

    As \(C_2\) is non-terminal, there exists \(d \in D {\setminus } (C_1 \cup C_2)\) such that \((c_2,d) \in E(D)\). Suppose that \(|C_1| \ge 2\). Then, for any \(c'_1 \in C_1 {\setminus } \{ c_1 \}\), \(c'_1, c_1, c_2\) is a directed path in D with \(d \in N^{+}( c_2 )\), so Remark 3 implies \((c'_1, c_2) \in E(D)\). Suppose now that \(|C_2| \ge 2\). Then, for any \(c'_2 \in C_2 {\setminus } \{ c_2\}\), \(c_1, c_2, c'_2\) is a directed path in D with \(d \in N^{+}(c_2)\), so again \((c_1, c'_2) \in E(D)\). Therefore, \(C_1\) fully connects to \(C_2\).

  2. (ii)

    Suppose that \(|C_1| \ge 2\). If \(\vert C_1 \vert >2\), then \(\deg ^+(c_1) > 2\), because \(C_1\) is complete. Thus, for each \(c'_1 \in C_1 {\setminus } \{ c_1 \}\), \(c'_1, c_1, c_2\) is a directed path in D with \(\deg ^+(c_1) > 2\), so \((c'_1, c_2) \in E(D)\) by Remark 2. As \(|C_2| = 1\), this shows that \(C_1\) fully connects to \(C_2\).

  3. (iii)

    Let \(C_2 = \{ c_2, c'_2 \}\) and let \(c'_1 \in C_1 {\setminus } \{ c_1 \}\) be such that \((c'_1, c'_2) \in E(D)\). For any \(b ,d\in C_1 \), \(b \ne c_1\), \(d \ne c'_1\), both \(b, c_1, c_2\) and \(d, c'_1, c'_2\) are directed paths in D with \(c'_2 \in N^+(c_2)\) and \(c_2 \in N^+(c'_2)\); hence, \((b,c_2) , (d, c'_2) \in E(D)\) by Remark 3.

  4. (iv)

    Suppose that \(C_2 = P_3\). Say \(C_2 = \{ c_2, c'_2, c''_2\}\) with either \(d_{D}(c_2, c''_2)=2\) or \(d_{D}(c'_2, c''_2)=2\). In any case, \(c_1, c_2, c'_2\) is a directed path in D with \(c''_2 \in N^+ (\{c_2, c'_2 \})\), so \((c_1, c'_2) \in E(D)\) by Remark 3; now, \(c_1, c'_2, c''_2\) is a directed path in D with \(c_2 \in N^+ (\{c'_2, c''_2 \})\), so \((c_1, c''_2) \in E(D)\). Hence, \(c_1\) is connected to all vertices of \(C_2\). As \(C_1\) is complete, a similar argument shows that every \(c'_1 \in C_1 {\setminus } \{ c_1\}\) connects to every vertex in \(C_2\).

    Suppose now that \(C_2 = K_m\) for \(m \ge 3\). By a similar reasoning as the previous paragraph, we show that \((c_1, v) \in E(D)\) for all \(v \in C_2\). Now, for any \(c'_1 \in C_1 {\setminus } \{ c_1 \}\), \(v \in C_2\), \(c'_1, c_1, v\) is a directed path in D so \((c'_1, v) \in E(D)\) by Remark 3. \(\square \)

Lemma 2.4

Let D be a closed digraph satisfying property \((\star )\). Let \(C_i\), \(i=1,2,3\), be strong components of D, and suppose that \(C_1\) connects to \(C_2\) and \(C_2\) connects to \(C_3\). If \(C_1\) does not connect to \(C_3\), then \(|C_2| = |C_3| = 1\), \(C_3\) is terminal in D, and \(C_2\) is terminal in \(D {\setminus } C_3\).

Proof

By Lemma 2.3 (i), \(C_1\) fully connects to \(C_2\). Assume that \(C_1\) does not connect to \(C_3\). Let \(c_i \in C_i\), \(i=1,2,3\), be such that \((c_1, c_2), (c_2, c_3) \in E(D)\). If \(C_2\) has a vertex different from \(c_2\), Remark 3 ensures that \((c_1, c_3) \in E(D)\), which contradicts our hypothesis. Then \(\vert C_2 \vert =1\). The same argument applies if \(C_3\) has a vertex different from \(c_3\), so \(\vert C_3 \vert =1\). Finally, Remark 3 applied to the path \(c_1, c_2, c_3\) also implies that \(C_3\) is terminal in D and \(C_2\) is terminal in \(D {\setminus } C_3\). \(\square \)

The following result characterises all digraphs satisfying condition (C1).

Theorem 2.5

Let D be a connected digraph on [n]. The following are equivalent:

  1. (i)

    For all \(\alpha \in \langle D \rangle \), \(\ell (D, \alpha ) = n + \mathrm {cycl}(\alpha ) - \mathrm {fix}(\alpha )\).

  2. (ii)

    D is closed satisfying property \((\star )\).

Proof

In order to simplify notation, denote

$$\begin{aligned} g(\alpha ) := n + \mathrm {cycl}(\alpha ) - \mathrm {fix}(\alpha ). \end{aligned}$$

First, we show that (i) implies (ii). Suppose \(\ell (D,\alpha ) = g(\alpha )\) for all \(\alpha \in \langle D\rangle \). We use the one-line notation for transformations: \(\alpha = (1)\alpha \ (2)\alpha \ \dots \ (k)\alpha \), where \(x=(x)\alpha \) for all \(x >k\), \(x \in [n]\). Clearly, if D is not closed, there exists an arc \(\alpha \in \langle D\rangle \backslash D\), so \(1 < \ell (D, \alpha ) \ne g(\alpha ) = 1\). In order to prove that property \((\star )\) holds, let 1, 2, 3 be a shortest path in D. If \((2 \rightarrow v) \in \langle D\rangle \), for some \(v \in [n]{\setminus }\{1,2,3\}\), then \(\alpha = 3v3v \in \langle D\rangle \), but \(g(\alpha ) = 2 \ne \ell (D,\alpha ) = 3\). If \((3 \rightarrow v) \in \langle D\rangle \), then \(\alpha = 3vvv \in \langle D\rangle \), but \(g(\alpha ) = 3 \ne \ell (D,\alpha ) = 4\). Therefore, \(N^+(\{2,3 \}) \subseteq \{ 1,2,3 \}\), and \((\star )\) holds.

Conversely, we show that (ii) implies (i). Let \(\alpha \in \langle D\rangle \). We remark that any cycle of \(\alpha \) belongs to a strong component of D.

Claim 2.6

Let C be a strong component of D. Then either \(\alpha \) fixes all vertices of C or \(|(C \alpha ) \cap C| < |C|\).

Proof

Suppose that \(\alpha \vert _C\), the restriction of \(\alpha \) to C, is non-trivial and \(|(C \alpha ) \cap C| = |C|\). Then \(\alpha \vert _C\) is a permutation of C. Let \(u \in C\) and suppose that \((u \rightarrow v)\) is the first arc moving u in a word expressing \(\alpha \) in \(D^*\). If \(v \in C\), we have \(u \alpha = v \alpha \), which contradicts that \(\alpha \vert _C\) is a permutation. If \(v \in C'\) for some other strong component \(C'\) of D, then \(u \alpha \notin C\) which again contradicts our assumption. \(\square \)

Claim 2.7

Let \(u,v \in [n]\) be such that \(u \alpha = v\). If \(d_D(u, v) = 2\), then:

  1. 1.

    v is in a terminal component of D.

  2. 2.

    There is a path uwv of length 2 in D such that \(w \alpha = v \alpha = v\); for any other path uxv of length 2 in D, we have \(x \alpha \in \{x, v\}\).

Proof

Let \(C_1\) and \(C_2\) be strong components of D such that \(u \in C_1\) and \(v \in C_2\). We analyse the four possible cases in which \(d_D(u,v) = 2\). In the first three cases, we use the fact that \(\langle P_3\rangle \cong {\mathrm {O}}_3\), hence we can order \(u< w < v\) and \(\alpha \) is an increasing transformation of the ordered set \(\{u,w,v\}\); thus \(u \alpha = w \alpha = v \alpha = v\).

Case 1 :

\(C_1 = C_2 \). By Lemma 2.2, \(C_1 \cong P_3\) and it is a terminal component. Therefore, 2. holds as there is a unique path from u to v.

Case 2 :

\(C_1\) connects to \(C_2\) and \(|C_2| \ne 2\). As \(d_D(u, v) = 2\), \(C_1\) does not fully connect \(C_2\), so, by Lemma 2.3, \(|C_2| = 1\), \(C_2\) is terminal, \(|C_1| = 2\), and the vertex \(w \in C_1\) connecting to \(C_2=\{ v\}\) has out-degree 2. Then, by property \((\star )\), uwv is the unique path from u to v.

Case 3 :

\(C_1\) connects to \(C_2\) and \(|C_2| = 2\). As \(d_D(u, v) = 2\), \(C_1\) does not fully connect \(C_2\), so, by Lemma 2.3, \(C_2\) is terminal and uwv is the unique path of length two from u to v, where w is the other vertex of \(C_2\).

Case 4 :

\(C_1\) does not connect to \(C_2\). Since \(d_D(u, v) = 2\), there exist strong components \(C^{(1)}, \dots , C^{(k)}\) such that \(C_1\) connects to \(C^{(i)}\) and \(C^{(i)}\) connects to \(C_2\), for all \(1 \le i \le k\). By Lemma 2.4, \(C^{(i)} = \{ x_i \}\), \(C_2 = \{v\}\) is terminal and \(N^+(x_i) = \{v\}\) for all i. Thus \(u, x_i, v\) are the only paths of length two from u to v; in particular, \(x_i \alpha \in \{x_i, v\}\) for all \(x_i\). As \(u \alpha = v\), there must exist \(1 \le j \le k\) such that \(w := x_j\) is mapped to v. \(\square \)

Now we produce a word \(\omega \in D^*\) expressing \(\alpha \) of length \(g(\alpha )\). Define

$$\begin{aligned} U := \{ u \in D : d_D(u, u\alpha ) = 2 \}. \end{aligned}$$

For every \(u \in U\), let \(u^\prime \) be a vertex in D such that \(u, u^\prime , u \alpha \) is a path and \(u^\prime \alpha = u \alpha \). The existence of \(u'\) is guaranteed by Claim 2.7. Define a word \(\omega _0 \in D^*\) by

$$\begin{aligned} \omega _0 := \bigcirc _{u \in U} (u \rightarrow u^\prime ) (u^\prime \rightarrow u \alpha ). \end{aligned}$$

Sort the strong components of D in topological order: \(C_1, \dots , C_k\), i.e. for \(i \ne j\), \(C_i\) connects to \(C_j\) only if \(j > i\). For each \(1 \le i \le k\), define

$$\begin{aligned} S_i := \{v \in C_i {\setminus } (U \cup U^\prime ) : v \alpha \in C_i\}, \end{aligned}$$

where \(U^\prime := \{ u^\prime : u \in U \}\), and consider the transformation \(\beta _i : C_i \rightarrow C_i\) defined by

$$\begin{aligned} x \beta _i = {\left\{ \begin{array}{ll} x \alpha &{}\quad \text {if } x \in S_i\\ x &{}\quad \text {otherwise}. \end{array}\right. } \end{aligned}$$

If \(|C_i| \le 2\) or \(C_i \cong P_3\), then \(\mathrm {cycl}(\beta _i) = 0\) and \(\beta _i\) can be computed with \(\vert C_i \vert - \mathrm {fix}(\beta _i)\) arcs. Otherwise, \(C_i\) is a complete undirected graph. If \(\beta _i \in \mathrm {Sing}(C_i)\), then by Theorem 1.1, there is a word \(\omega _i \in C_i^* \subseteq D^*\) of length \(\vert C_i \vert + \mathrm {cycl}(\beta _i) - \mathrm {fix}(\beta _i)\) expressing \(\beta _i\). Suppose now that \(\beta _i\) is a non-identity permutation of \(C_i\). By Claim 2.6, \(\alpha \) does not permute \(C_i\) and there exists \(h_i \in C_i {\setminus } (C_i \alpha )\). Note that \(h_i \in C_i {\setminus } S_i\). Define \({\hat{\beta _i}} \in \mathrm {Sing}(C_i)\) by

$$\begin{aligned} x {\hat{\beta _i}} = {\left\{ \begin{array}{ll} x \alpha &{}\quad \text {if }x\in S_i\\ a_i &{} \quad \text {if } x = h_i \\ x &{}\quad \text {otherwise}, \end{array}\right. } \end{aligned}$$

where \(a_i\) is any vertex in \(S_i\). Then \(\alpha \vert _{S_i} = {\hat{\beta }}\vert _{S_i}\). Again by Theorem 1.1, there is a word \(\omega _i \in C_i^* \subseteq D^*\) of length \(\vert C_i \vert + \mathrm {cycl}({\hat{\beta }}_i) - \mathrm {fix}({\hat{\beta }}) =\vert C_i \vert + \mathrm {cycl}(\beta _i) - \mathrm {fix}(\beta _i) \) expressing \({\hat{\beta }}_i\).

The following word maps all the vertices in \([n] {\setminus } (U \cup U^\prime \cup C_i)\) that have image in \(C_i\):

$$\begin{aligned} \omega _i' = \bigcirc \left\{ (a \rightarrow a\alpha ) : a \in [n] {\setminus } (U \cup U^\prime \cup C_i), a\alpha \in C_i \right\} . \end{aligned}$$

Finally, let

$$\begin{aligned} \omega := \omega _0 \omega _k \omega _k' \dots \omega _1 \omega _1' \in D^*. \end{aligned}$$

It is easy to check that \(\omega \) indeed expresses \(\alpha \). Since \(\sum _{i=1}^k \mathrm {fix}(\beta _i) = \mathrm {fix}(\alpha ) + \sum _{i=1}^k \vert C_i {\setminus } S_i \vert \) and \(\sum _{i=1}^k \ell (\omega ^\prime _i) = \sum _{i=1}^k \vert C_i {\setminus } ( U \cup U^\prime \cup S_i) \vert \), we have

$$\begin{aligned} \ell (\omega ) = 2 \vert U \vert + \sum _{i=1}^k (\ell (\omega _i) + \ell (\omega _i^\prime )) = n + \sum _{i=1}^k \mathrm {cycl}(\beta _i) - \mathrm {fix}(\alpha ) = g(\alpha ). \end{aligned}$$

\(\square \)

2.2 Digraphs satisfying condition (C2)

The characterisation of connected digraphs satisfying condition (C2) is based on the classification of connected digraphs D such that \(\mathrm {cycl}(\alpha ) = 0\), for all \(\alpha \in \langle D\rangle \).

For \(k \ge 3\), let \(\Theta _k\) be the directed cycle of length k. Consider the digraphs \(\varGamma _1, \ \varGamma _2, \ \varGamma _3\) and \(\varGamma _4\) as illustrated below:

figure d

Lemma 2.8

Let D be a connected digraph on [n]. The following are equivalent:

  1. (i)

    For all \(\alpha \in \langle D \rangle \), \(\mathrm {cycl}(\alpha ) = 0\).

  2. (ii)

    D has no subdigraph isomorphic to \(\varGamma _1\), \(\varGamma _2\), \(\varGamma _3\), \(\varGamma _4\), or \(\Theta _k\), for all \(k \ge 5\).

Proof

In order to prove that (i) implies (ii), we show that if \(\varGamma \) is equal to \(\varGamma _i\) or \(\Theta _k\), for \(i\in [4]\), \(k \ge 5\), then there exists \(\alpha \in \langle \varGamma \rangle \) such that \(\mathrm {cycl}(\alpha ) \ne 0\).

  • If \(\varGamma = \varGamma _1\), take

    $$\begin{aligned} \alpha:= & {} (3 \rightarrow 4) (4 \rightarrow 5) (1 \rightarrow 4) (4 \rightarrow 3) (2 \rightarrow 4) (4 \rightarrow 1) (3 \rightarrow 4) (4 \rightarrow 2) \\= & {} 21555. \end{aligned}$$
  • If \(\varGamma = \varGamma _2\), take

    $$\begin{aligned} \alpha:= & {} (3 \rightarrow 4) (4 \rightarrow 5) (1 \rightarrow 3) (3 \rightarrow 4) (2 \rightarrow 3) (3 \rightarrow 1) (4 \rightarrow 3) (3 \rightarrow 2) \\= & {} 21555. \end{aligned}$$
  • If \(\varGamma = \varGamma _3\), take

    $$\begin{aligned} \alpha := (3 \rightarrow 4) (2 \rightarrow 3) (1 \rightarrow 2) (3 \rightarrow 1) = 2144. \end{aligned}$$
  • If \(\varGamma = \varGamma _4\), take

    $$\begin{aligned} \alpha = (3 \rightarrow 4) (4 \rightarrow 5) (2 \rightarrow 3) (3 \rightarrow 4) (1 \rightarrow 2) (4 \rightarrow 1) = 21555. \end{aligned}$$
  • Assume \(\varGamma = \Theta _k\) for \(k \ge 5\). Consider the following transformation of [k]:

    $$\begin{aligned} (u \Rightarrow v) := (u \rightarrow u_1) \dots (u_{d-1} \rightarrow v), \end{aligned}$$

    where \(u,u_1, \dots , u_{d-1}, v\) is the unique path from u to v on the cycle \(\Theta _k\). Take

    $$\begin{aligned} \alpha:= & {} (1 \Rightarrow k-3) (k \Rightarrow k-4) (k-1 \Rightarrow 1) (k-2 \Rightarrow k)\\&(k-3 \Rightarrow k-1) (k-4 \Rightarrow k-2). \end{aligned}$$

    Then, \(\alpha = (k-1)(k-1) \dots (k-1) \ k \ 1 \ (k-2) \), where \((k-1)\) appears \(k-3\) times, has the cyclic component \((k-2, k)\).

Conversely, assume that D satisfies (ii). If \(n \le 3\), it is clear that \(\mathrm {cycl}(\alpha ) = 0\), for all \(\alpha \in \langle D\rangle \), so suppose \(n \ge 4\). We first obtain some key properties about the strong components of \({\bar{D}}\).

Claim 2.9

Any strong component of \({\bar{D}}\) is an undirected path, an undirected cycle of length 3 or 4, or a claw \(K_{3,1}\) (i.e. a bipartite undirected graph on \([4] = [3] \cup \{4\}\)). Moreover, if a strong component of D is not an undirected path, then it is terminal.

Proof

Let C be a strong component of \({\bar{D}}\). Clearly, C is undirected and, by (ii), it cannot contain a cycle of length at least 5. If C has a cycle of length 3 or 4, then the whole of C must be that cycle and C is terminal (otherwise, it would contain \(\varGamma _3\) or \(\varGamma _4\), respectively). If C has no cycle of length 3 and 4, then C is a tree. It can only be a path or \(K_{3,1}\), for otherwise it would contain \(\varGamma _1\) or \(\varGamma _2\); clearly, \(K_{3,1}\) may only appear as a terminal component. \(\square \)

Suppose there is \(\alpha \in \langle D\rangle \) that has a cyclic orbit (so \(\mathrm {cycl}(\alpha ) \ne 0\)). This cyclic orbit must be contained in a strong component C of \({\bar{D}}\), and Claim 2.9 implies that \(C \cong \varGamma \), where \(\varGamma \in \{ K_{3,1}, {\bar{\Theta }}_s, P_r : s \in \{3,4\}, r \in \mathbb {N} \}\). If \(\varGamma = K_{3,1}\) or \(\varGamma = {\bar{\Theta }}_s\), then C is a terminal component, so \(\alpha \) acts on C as some transformation \(\beta \in \langle \varGamma \rangle \); however, it is easy to check that no transformation in \(\langle \varGamma \rangle \) has a cyclic orbit. If \(\varGamma = P_r\), for some r, then \(\alpha \) acts on C as a partial transformation \(\beta \) of \(P_r\). Since \(\langle P_r\rangle = {\mathrm {O}}_r\), \(\beta \) has no cyclic orbit. \(\square \)

We introduce a new property of a connected digraph D:

(\(\star \star \)):

For every strong component C of D, \(|C| \le 2\) if C is non-terminal, and \(|C| \le 3\) if C is terminal.

Lemma 2.10

Let D be a closed connected digraph on [n] satisfying property \((\star )\). The following are equivalent:

  1. (i)

    D satisfies property \((\star \star )\).

  2. (ii)

    D has no subdigraph isomorphic to \(\varGamma _1\), \(\varGamma _2\), \(\varGamma _3\), \(\varGamma _4\), or \(\Theta _k\), for some \(k \ge 5\).

Proof

If (i) holds, it is easy to check that D does not contain any subdigraphs isomorphic to \(\varGamma _1\), \(\varGamma _2\), \(\varGamma _3\), \(\varGamma _4\), or \(\Theta _k\) for some \(k \ge 5\).

Conversely, suppose that (ii) holds. Let C be a strong component of D. If C is non-terminal, Lemma 2.2 implies that C is complete; hence, \(|C| \le 2\) as otherwise D would contain \(\varGamma _4\) as a subdigraph. If C is terminal, Lemma 2.2 implies that C is complete or \(P_3\); hence, \(|C| \le 3\) as otherwise D would contain \(\varGamma _3\) as a subdigraph. \(\square \)

Theorem 2.11

Let D be a connected digraph on [n]. The following are equivalent:

  1. (i)

    For all \(\alpha \in \langle D \rangle \), \(\ell (D, \alpha ) = n - \mathrm {fix}(\alpha )\).

  2. (ii)

    D is closed satisfying properties \((\star )\) and \((\star \star )\).

Proof

Clearly, D satisfies (i) if and only if it satisfies condition (C1) and \(\mathrm {cycl}(\alpha ) = 0\), for all \(\alpha \in \langle D \rangle \). By Theorem 2.5 and Lemmas 2.8 and 2.10, D satisfies (i) if and only if D satisfies (ii). \(\square \)

2.3 Digraphs satisfying condition (C3)

The following result characterises digraphs satisfying condition (C3).

Theorem 2.12

Let D be a connected digraph on [n]. The following are equivalent:

  1. (i)

    For every \(\alpha \in \langle D \rangle \), \(\ell (D, \alpha ) = n - \mathrm {rk}(\alpha )\).

  2. (ii)

    \(\langle D \rangle \) is a band, i.e. every \(\alpha \in \langle D \rangle \) is idempotent.

  3. (iii)

    Either \(n=2\) and \(D \cong K_2\), or there exists a bipartition \(V_1 \cup V_2\) of [n] such that \((i_1,i_2) \in E(D)\) only if \(i_1 \in V_1\), \(i_2 \in V_2\).

Proof

Clearly (i) implies (ii): if \(\ell (D,\alpha ) = n - \mathrm {rk}(\alpha )\), then \(\mathrm {rk}(\alpha ) = \mathrm {fix}(\alpha )\) by inequality (1), so \(\alpha \) is idempotent.

Now we prove that (ii) implies (iii). If there exist \(u, v, w \in [n]\) pairwise distinct such that \((u,v), (v,w) \in E(D)\), then \(\alpha = (v \rightarrow w) (u \rightarrow v)\) is not an idempotent. Therefore, for \(n \ge 3\), if every \(\alpha \in \langle D \rangle \) is idempotent, then a vertex in D either has in-degree zero or out-degree zero: this corresponds to the bipartition of [n] into \(V_1\) and \(V_2\).

We finally prove that (iii) implies (i). Let \(n \ge 3\) and suppose that there exists a bipartition \(V_1 \cup V_2\) of [n] such that \((i_1,i_2) \in E(D)\) only if \(i_1 \in V_1\), \(i_2 \in V_2\). Then for any \(\alpha \in \langle D \rangle \), all elements of \(V_2\) are fixed by \(\alpha \) and \(i_1 \alpha \in \{i_1\} \cup N^+(i_1)\) for any \(i_1 \in V_1\). In particular, any non-fixed point of \(\alpha \) is mapped to a fixed point, so \(r:=\mathrm {rk}(\alpha ) = \mathrm {fix}(\alpha )\). Let \(J := \{v_1, \dots , v_{n-r}\} \subseteq V_1\) be the set of non-fixed points of \(\alpha \); therefore

$$\begin{aligned} \alpha = (v_1 \rightarrow v_1 \alpha ) \dots (v_{n-r} \rightarrow v_{n-r} \alpha ), \end{aligned}$$

where each one of the \(n-r\) arcs above belongs to \(\langle D\rangle \). The result follows by inequality (1). \(\square \)

3 Arc-generated semigroups with long words

Fix \(n \ge 2\). In this section, we consider digraphs D that maximise \(\ell (D,r)\) and \(\ell (D)\). For \(r \in [n-1]\), define

$$\begin{aligned} \ell _{\max }(n,r)&:= \max \left\{ \ell (D, r) : V(D) = [n] \right\} , \\ \ell _{\max }(n)&:= \max \left\{ \ell (D) : V(D) = [n] \right\} . \end{aligned}$$
Table 1 First values of \(\ell _{\max }(n,r)\)

The first few values of \(\ell _{\max }(n,r)\), calculated with the GAP package Semigroups [7], are given in Table 1. By Lemma 2.1, \(\ell _{\max }(n,1) = n-1\) for all \(n \ge 2\); henceforth, we shall always assume that \(n \ge 3\) and \(r \in [n-1] {\setminus } \{ 1\}\).

In the following sections, we restrict the class of digraphs that we consider in the definition of \(\ell _{\max }(n,r)\) and \(\ell _{\max }(n)\) to two important cases: acyclic digraphs and strong tournaments.

3.1 Acyclic digraphs

For any \(n \ge 3\), let \(\mathrm {Acyclic}_n\) be the set of all acyclic digraphs on [n], and, for any \(r \in [n-1]\), define

$$\begin{aligned} \ell _{\max }^{\mathrm {Acyclic}}(n,r)&:= \max \left\{ \ell (A, r) : A \in \mathrm {Acyclic}_n \right\} ,\\ \ell _{\max }^{\mathrm {Acyclic}}(n)&:= \max \left\{ \ell (A) : A \in \mathrm {Acyclic}_n \right\} . \end{aligned}$$

Without loss of generality, we assume that any acyclic digraph A on [n] is topologically sorted, i.e. \((u, v) \in E(A)\) only if \(v > u\).

In this section, we establish the following theorem.

Theorem 3.1

For any \(n\ge 3\) and \(r \in [n-1] {\setminus } \{ 1\}\),

$$\begin{aligned} \ell _{\max }^{\mathrm {Acyclic}}(n,r)&= \frac{(n-r)(n+r-3)}{2} + 1, \\ \ell _{\max }^{\mathrm {Acyclic}}(n)&= \ell _{\max }^{\mathrm {Acyclic}}(n,2) = \frac{1}{2} (n^2 -3n + 4). \end{aligned}$$

First of all, we settle the case \(r = n-1\), for which we have a finer result.

Lemma 3.2

Let \(n \ge 3\) and \(A \in \mathrm {Acyclic}_n\). Then, \(\ell (A,n-1)\) is equal to the length of a longest path in A. Therefore,

$$\begin{aligned} \ell _{\max }^{\mathrm {Acyclic}}(n,n-1) = n-1. \end{aligned}$$

Proof

Let \(v_1, \dots , v_{l+1}\) be a longest path in A. Then \(\alpha \in \langle A \rangle \) defined by

$$\begin{aligned} v \alpha := {\left\{ \begin{array}{ll} v_{i+1} &{}\quad \text {if } v = v_i, \ i \in [l], \\ v &{}\quad \text {otherwise}, \end{array}\right. } \end{aligned}$$

has rank \(n-1\) and requires at least l arcs, since it moves l vertices.

Conversely, let \(\alpha \in A\) be a transformation of rank \(n-1\), and consider a word expressing \(\alpha \) in \(A^*\):

$$\begin{aligned} \alpha = (u_1 \rightarrow v_1) (u_2 \rightarrow v_2) \dots (u_s \rightarrow v_s). \end{aligned}$$

Since \(\alpha \) has rank \(n-1\), we must have \(v_2 = u_1\) and by induction \(v_i = u_{i-1}\) for \(2 \le i \le s\). As A is acyclic, \(u_s, u_{s-1}, \dots , u_1, v_1\) forms a path in A, so \(s \le l\). \(\square \)

The following lemma shows that the formula of Theorem 3.1 is an upper bound for \(\ell _{\max }^{\mathrm {Acyclic}}(n,r)\).

Lemma 3.3

For any \(n\ge 3\) and \(r \in [n-1] {\setminus } \{ 1\}\),

$$\begin{aligned} \ell _{\max }^{\mathrm {Acyclic}}(n,r) \le \frac{(n-r)(n+r-3)}{2} + 1. \end{aligned}$$

Proof

Let A be an acyclic digraph on [n], let \(\alpha \in \langle A\rangle \) be a transformation of rank \(r \ge 2\), and let \(L \subset V(A)\) be the set of terminal vertices of A. For any \(u,v \in [n]\), denote the length of a longest path from u to v in A as \(\psi _A(u,v)\).

Claim 3.4

\(\ell (A, \alpha ) \le \sum _{v \in [n]} \psi _A(v, v \alpha )\).

Proof

Let \(\omega = (a_1 \rightarrow b_1) \dots (a_l \rightarrow b_l)\) be a shortest word expressing \(\alpha \) in \(A^*\), with \(l = \ell (A, \alpha )\). Say that the arc \((a_i \rightarrow b_i)\), \(i \ge 2\), carries \(v \in [n]\) if \(v (a_1 \rightarrow b_1) \dots (a_{i-1} \rightarrow b_{i-1}) = a_i\) (assume that \(a_1 \rightarrow b_1\) only carries \(a_1\)). Every arc \((a_i \rightarrow b_i)\) carries at least one vertex, for otherwise we could remove that arc form the word \(\omega \) and obtain a shorter word still expressing \(\alpha \). Let \(v \in [n]\), and denote \(v_0 = v\) and \(v_i = v (a_1 \rightarrow b_1) \dots (a_i \rightarrow b_i)\) (and hence \(v_l = v \alpha \)). Let us remove the repetitions in this sequence: let \(j_0 = 0\) and for \(i \ge 1\), \(j_i = \min \{j : v_j \ne v_{j_{i-1}}\}\). Then the sequence \(v = v_{j_0}, v_{j_1}, \dots , v_{j_{l(v)}} = v \alpha \) forms a path in A of length l(v), and hence \(l(v) \le \psi (v, v\alpha )\). For each \(v \in [n]\), there are l(v) arcs in \(\omega \) carrying v, so the length of \(\omega \) satisfies

$$\begin{aligned} l \le \sum _{v =1}^n l(v) \le \sum _{v \in [n]} \psi _A(v, v \alpha ). \end{aligned}$$

\(\square \)

Claim 3.5

If \(|L| \ge 2\), then \(\sum _{v \in [n]} \psi _A(v, v \alpha ) \le \frac{(n-r)(n+r-3)}{2}\).

Proof

As \(|L| \ge 2\), and A is topologically sorted, we have \(\{ n, n-1 \} \subseteq L\), and any \(\alpha \in \langle A\rangle \) fixes both \(n-1\) and n, i.e. \(\psi _A(v, v \alpha ) = 0\) for \(v \in \{n-1, n\}\). For any \(v \in [n-2]\), we have

$$\begin{aligned} \psi _A(v, v\alpha ) \le \min \{ n-1, v\alpha \} - v. \end{aligned}$$

Hence

$$\begin{aligned} \sum _{v \in [n]} \psi _A(v, v \alpha )&= \sum _{v \in [n-2]} \psi _A(v, v \alpha )\\&\le \sum _{v \in [n-2]} \left( \min \{ n-1, v\alpha \} - v \right) \\&= \sum _{w \in [n-2]\alpha } \left( \min \{ n-1, w\} |w \alpha ^{-1}| \right) - T_{n-2}, \end{aligned}$$

where \(T_k = \frac{k(k+1)}{2}\). The summation is maximised when \(|n \alpha ^{-1}| = n-r\) and \(|w \alpha ^{-1}| = 1\) for \(n-r+1 \le w \le n-2\), thus yielding

$$\begin{aligned} \sum _{v \in [n]} \psi _A(v, v \alpha )&\le (n-1)(n-r) + (T_{n-2} - T_{n-r}) - T_{n-2}\\&= \frac{(n-r)(n+r-3)}{2}. \end{aligned}$$

\(\square \)

Claim 3.6

If \(\vert L \vert = 1\), then \(\ell (A, \alpha ) \le \frac{(n-r)(n+r-3)}{2} + 1\).

Proof

As A is topologically sorted, \(L = \{ n\}\). We use the notation from the proof of Claim 3.4. We then have \(l(n) = 0\). We have three cases:

Case 1 :

\((n-1)\) is fixed by \(\alpha \). Then, \(l(n-1) = 0\) and \(l(v) \le \min \{n-1, v \alpha \} - v\) for all \(v \in [n-2]\). By the same reasoning as in Claim 3.5, we obtain \(\ell (A, \alpha ) \le \frac{(n-r)(n+r-3)}{2}\).

Case 2 :

\((n-1) \alpha = n\) and \(v \alpha \le n-1\) for every \(v \in [n-2]\). Then again \(l(v)\le \min \{n-1, v\alpha \} -v\), for all \(v \in [n-2]\), and \(\ell (A, \alpha ) \le \frac{(n-r)(n+r-3)}{2}\).

Case 3 :

n has at least two pre-images under \(\alpha \). Let \(\omega = (a_1 \rightarrow b_1) \dots (a_l \rightarrow b_l)\) be a shortest word expressing \(\alpha \) in \(A^*\), and denote \(\alpha _0 = \mathrm {id}\) and \(\epsilon _i = (a_i \rightarrow b_i)\), \(\alpha _i = \epsilon _1 \dots \epsilon _i\) for \(i \in [l]\). We partition \(n \alpha ^{-1}\) into two parts S and T:

$$\begin{aligned} S = \{v \in n \alpha ^{-1} : v_{l(v) - 1} = n-1\}, \quad T = n \alpha ^{-1} {\setminus } S. \end{aligned}$$

For all \(v \in S\), if the arc carrying v to \(n-1\) is \(\epsilon _j\), then \((n-1)\alpha _{j-1}^{-1} \subseteq S\) (v can only collapse with other pre-images of \(\alpha \)). Then the arc \((n-1 \rightarrow n)\) occurs only once in the word \(\omega \) (if it occurs multiple times, then remove all but the last occurrence of that arc to obtain a shorter word expressing \(\alpha \)). If we do not count that arc, we have \(l'(v) \le n-1-v\) arcs carrying v if \(v \in S\), \(l(v) \le n-1-v\) arcs carrying v if \(v \in T\), and \(l(v) \le v\alpha - v\) if \(v\alpha \ne n\). Again, we obtain \(\ell (A, \alpha ) \le \frac{(n-r)(n+r-3)}{2} + 1\). \(\square \)

Lemma 3.3 follows by the previous claims.\(\square \)

The following lemma completes the proof of Theorem 3.1.

Lemma 3.7

For any \(n \ge 3\) and \(r \in [n-1] {\setminus } \{ 1\}\), there exists an acyclic digraph \(Q_n\) on [n] and a transformation \(\beta _r \in \langle Q_n\rangle \) of rank r such that

$$\begin{aligned} \ell (Q_n, \beta _r) \ge \frac{(n-r)(n+r-3)}{2} + 1. \end{aligned}$$

Proof

Let \(Q_n\) be the acyclic digraph on [n] with edge set

$$\begin{aligned} E(Q_n) := \left\{ (u, u+1) : u \in [n-1] \right\} \cup \left\{ (n-2, n) \right\} . \end{aligned}$$

For any \(r \in [n-1] {\setminus } \{ 1\}\), define \(\beta _r \in \langle Q_n\rangle \) by

$$\begin{aligned} v\beta _r := {\left\{ \begin{array}{ll} n-r+v &{}\text {if } v \in [r-2], \\ n - 1 &{}\text {if } v \in [n-1] {\setminus } [r-2], \ n-v \equiv 0 \mod 2,\\ n &{}\text {if }v \in [n-1] {\setminus } [r-2], \ n-v \equiv 1 \mod 2,\\ n &{}\text {if } v = n. \end{array}\right. } \end{aligned}$$

Let \(\beta _r\) be expressed as a word in \(Q_n^*\) of minimum length as

$$\begin{aligned} \beta _r = (a_1 \rightarrow b_1) \dots (a_l \rightarrow b_l), \end{aligned}$$

where \(l= \ell (Q_n, \beta _r)\). Denote \(\alpha _0 := \mathrm {id}\), \(\epsilon _i := (a_i \rightarrow b_i)\), and \(\alpha _i := \epsilon _1 \dots \epsilon _i\), for \(i \in [l]\). Say that \(\epsilon _i\) carries \(u \in [n]\) if \(u \alpha _{i-1} = a_i\) and hence \(u \alpha _i \ne u \alpha _{i-1}\).

Claim 3.8

For each \(i \in [l]\), the arc \(\epsilon _i\) carries exactly one vertex.

Proof

First, \((a_1, b_1) \in E(Q_n)\) and \(a_1 \beta _r = b_1 \beta _r\) imply that \(a_1 = n-1\) and \(b_1 = n\). Suppose that there is an arc \(\epsilon _j\), \(j \in [l]\), that carries two vertices \(u < v\); take j to be minimal index with this property. We remark that \(v \le n-2\) and \(u \alpha _{j-1} = v \alpha _{j-1}\) imply \(u \beta _r = v \beta _r\). Then \(w := u+1\) satisfies \(w \beta _r \ne u \beta _r\), so w is not carried by \(\epsilon _j\). If \(w \alpha _{j-1} \le n-2\), then \(u \alpha _{j-1}< w \alpha _{j-1} < v \alpha _{j-1}\) since \(u< w < v\) and the graph induced by \([n-2]\) in \(Q_n\) is the directed path \(\vec {P}_{n-2}\); this contradicts that \(u \alpha _{j-1} = v \alpha _{j-1}\). Hence \(w \alpha _{j-1} \ge n-1\) and \(v \alpha _{j-1} \ge n-1\). If \(v \alpha _{j-1} = n\) or \(v \beta _r = n-1\), then \(\epsilon _j\) does not carry v. Thus, \(v\alpha _{j-1} = n-1\) and \(v \beta _r = n\). Then, in order to carry v to \(n-1\), we have \(\epsilon _s = (n-2 \rightarrow n-1)\) for at least one \(s \in [l]\), and \(\epsilon _j = (n-1 \rightarrow n)\). For \(s \in [j-1]\), replace all occurrences \(\epsilon _s = (n-2 \rightarrow n-1)\) with \(\epsilon _s^\prime := (n-2 \rightarrow n)\) and delete \(\epsilon _j\): this yields a word in \(Q_n^*\) of length \(l^\prime <l\) expressing \(\beta _r\), which is a contradiction. \(\square \)

For all \( i \in [l]\), denote \(\delta (i) := \sum _{v \in [n]} d_{Q_n}(v \alpha _i, v \beta _r)\). We then have \(\delta (l) = 0\), and by the claim, \(\delta (i) \ge \delta (i-1) - 1\) for all \(i \in [l]\). Thus \(l \ge \delta (0)\), where

$$\begin{aligned} \delta (0)&= \sum _{v \in [n]} d_{Q_n}(v, v \beta _r)\\&= \sum _{v=1}^{r-2} (n-r) + \sum _{v=r-1}^{n-2} (n-1 - v) + 1\\&= \frac{(n-r)(n+r-3)}{2} + 1. \end{aligned}$$

\(\square \)

3.2 Strong tournaments

Let \(n \ge 3\). Recall that if T is a strong tournament on [n], then \(\{ a \rightarrow b : (a,b) \in E(T) \}\) is a minimal generating set of \(\mathrm {Sing}_n\). Let \(\mathrm {Tour}_n\) denote the set of all strong tournaments on [n]. For \(r \in [n-1]\), define

$$\begin{aligned} \ell _{\max }^{\mathrm {Tour}}(n, r)&:= \max \{ \ell (T, r) : T \in \mathrm {Tour}_n \},\\ \ell _{\max }^{\mathrm {Tour}}(n)&:= \max \{ \ell (T) : T \in \mathrm {Tour}_n \}. \end{aligned}$$

Define analogously \(\ell _{\min }^{\mathrm {Tour}}(n,r)\) and \(\ell _{\min }^{\mathrm {Tour}}(n)\). The first few values of \(\ell _{\min }^{\mathrm {Tour}}(n,r)\) and \(\ell _{\max }^{\mathrm {Tour}}(n,r)\), calculated with the GAP package Semigroups [7] using data from [6], are given in Table 2. The calculation of these values has been the inspiration for the results of this section and the conjectures of the next one.

Table 2 First values of \(\left( \ell _{\min }^{\mathrm {Tour}}(n,r) , \ell _{\max }^{\mathrm {Tour}}(n,r) \right) \)

Lemma 3.9

Let \(n \ge 3\) and \(T \in \mathrm {Tour}_n\).

  1. 1.

    For any partition P of [n] into r parts, there exists an idempotent \(\alpha \in \mathrm {Sing}_n\) with \(\ker (\alpha ) = P\) such that \(\ell (T, \alpha )= n - r\).

  2. 2.

    For any r-subset S of [n], there exists an idempotent \(\alpha \in \mathrm {Sing}_n\) with \(\mathrm {Im}(\alpha ) = S\) such that \(\ell (T, \alpha )= n - r\).

Proof

  1. 1.

    Let \(P = \{ P_1, \dots , P_r \}\). For all \(1 \le i \le r\), the digraph \(T[P_i]\) induced by \(P_i\) is a tournament, so it is connected and there exists a vertex \(v_i\) reachable by any other vertex in \(P_i\): let \(\alpha \) map the whole of \(P_i\) to \(v_i\). Then \(\alpha \), when restricted to \(P_i\), is a constant map, which can be computed using \(|P_i| - 1\) arcs. Summing for i from 1 to r, we obtain that \(\ell (T, \alpha ) = n - r\).

  2. 2.

    Without loss of generality, let \(S = [r] \subseteq [n]\). For every \(v \in [n]\), define

    $$\begin{aligned} s(v) := \min \{ s \in S: d_T(s', v) \ge d_T(s,v), \forall s' \in S\}. \end{aligned}$$

    In particular, if \(v \in S\), then \(s(v) = v\). Moreover, if \(v = v_0, v_1, \dots , v_d = s(v)\) is a shortest path from v to s(v), with \(d = d_T(v,s(v))\), then \(s(v_i) = s(v)\) for all \(0 \le i \le d\). For each \(v \in [n ]\), fix a shortest path \(P_v\) from v to s(v), and consider the digraph D on [n] with edges

    $$\begin{aligned} E(D) := \{ (a,b) : (a,b) \in E(P_v) \text { for some } v \in [n]\}. \end{aligned}$$

    Then, D is acyclic and the set of vertices with out-degree zero in D is exactly S. Let sort [n] so that D has reverse topological order: \((a,b) \in E(D)\) only if \(a >b\). Note that S is fixed by this sorting. Let \(\alpha \) be given by \(v \alpha := s(v)\); hence, with the above sorting

    $$\begin{aligned} \alpha = \bigcirc _{v=n}^{r+1} (v \rightarrow v_1). \end{aligned}$$

    \(\square \)

Lemma 3.10

Let \(n \ge 3\), \(T \in \mathrm {Tour}_n\), and \(\alpha :=(u \rightarrow v) \in \mathrm {Sing}_n\), for \((u,v) \not \in E(T)\). Then

$$\begin{aligned} \ell (T, \alpha ) = 4 d_T(u,v) - 2. \end{aligned}$$

Proof

Let \(u = v_0, v_1, \dots , v_d = v\) be a shortest path from u to v in T, where \(d := d_T(u,v)\). As \((u,v) \not \in E(T)\) and T is a tournament, we must have \((v,u) \in E(T)\). By the minimality of the path, for any \(j +1 < i\), we have \((v_j, v_i) \not \in E(T)\), so \((v_i, v_j) \in E(T)\). Then, the following expresses \(\alpha \) with arcs in \(T^*\):

$$\begin{aligned} (v_0 \rightarrow v_d)&= (v_d \rightarrow v_0) (v_{d-1} \rightarrow v_d) (v_{d-2} \rightarrow v_{d-1}) \cdots (v_1 \rightarrow v_2) (v_0 \rightarrow v_1 ) \\&\qquad \left( (v_2 \rightarrow v_0) (v_1 \rightarrow v_2) \right) \left( (v_3 \rightarrow v_1) (v_2 \rightarrow v_3) \right) \\&\qquad \cdots \left( (v_d \rightarrow v_{d-2}) (v_{d-1} \rightarrow v_d) \right) \\&\qquad (v_{d-2} \rightarrow v_{d-1}) \cdots (v_0 \rightarrow v_1). \end{aligned}$$

So \(\ell (T, \alpha ) \le 4d-2\). For the lower bound, we note that any word in \(T^*\) expressing \((u \rightarrow v)\) must begin with \((v \rightarrow u)\). Then, u has to follow a walk in T towards v; say this walk has length \(l \ge d\). All the vertices on the walk must be moved away (as otherwise they would collapse with u) and have to come back to their original position (since \(\alpha \) fixes them all); as the shortest cycle in a tournament has length 3, this process adds at least \(3(l-1)\) symbols to the word. Altogether, this yields a word of length at least

$$\begin{aligned} 1 + l + 3(l-1) = 4l-2 \ge 4 d - 2. \end{aligned}$$

\(\square \)

Let \(n = 2m+1 \ge 3\) be odd, and let \(\kappa _n\) be the circulant tournament on [n] with edges \(E(\kappa _n):=\{ (i, (i+j) \mod n): i \in [n], j \in [m] \}\). Figure 2 illustrates \(\kappa _5\). In the following theorem, we use \(\kappa _n\) to provide upper and lower bounds for \(\ell _{\min }^{\mathrm {Tour}}(n,r)\) and \(\ell _{\max }^{\mathrm {Tour}}(n,r)\) when n is odd.

Fig. 2
figure 2

Circulant tournament \(\kappa _5\)

Theorem 3.11

For any n odd, we have

$$\begin{aligned} n + r - 2&\le \ell _{\min }^{\mathrm {Tour}}(n,r) \le n + 8r,\\ ({\hat{r}} + 1)(n - {\hat{r}}) - 1&\le \ell _{\max }^{\mathrm {Tour}}(n,r) \le 6rn + n -10r. \end{aligned}$$

where \({\hat{r}} = \min \{r-1, \lfloor n/2 \rfloor \}\).

Proof

Let \(T \in \mathrm {Tour}_n\) and \(2 \le r \le n-1\). We introduce the following notation:

$$\begin{aligned}{}[n]_r&:= \{ \mathbf{u} := (u_1, \dots , u_r) : u_i \ne u_j, \forall i, j \}, \\ \Delta (T, r)&:= \max \left\{ \sum _{i=1}^r d_T(u_i, v_i) : \mathbf{u}, \mathbf{v} \in [n]_r \right\} . \end{aligned}$$

The result follows by the next claims.

Claim 3.12

\(r'(\mathrm {diam}(T) - r' + 1) + r-r' \le \Delta (T,r) \le r \mathrm {diam}(T)\), where \(r' = \min \{r, \lfloor ( \mathrm {diam}(T)+1)/2 \rfloor \}\).

Proof

The upper bound is clear. For the lower bound, let \(u, v \in [n]\) be such that \(d_T(u,v) = \mathrm {diam}(T)\), and let \(u = v_0, v_1, \dots , v_d = v\) be a shortest path from u to v, where \(d = \mathrm {diam}(T)\). Then, \(d_T(v_i,v_j) = j-i\), for all \(0 \le i \le j \le D\). If \(1 \le r \le \lfloor (d+1)/2 \rfloor \), consider \(\mathbf{u}' = (v_0, \dots , v_{r-1})\) and \(\mathbf{v}' = (v_{d-r+1}, \dots , v_d)\), so we obtain \(\Delta (T, r) \ge r(d-r+1)\). If \(r \ge \lfloor (d+1)/2 \rfloor \), simply add vertices \(u'_j\) and \(v'_j\) such that \((u'_j, v'_j) \notin T\). \(\square \)

Claim 3.13

\(\min \{ \Delta (T,r) : T \in \mathrm {Tour}(n) \} = \Delta (\kappa _n,r) = 2r\).

Proof

Let \(\mathbf{u} = (u_1, \dots , u_n)\) form a Hamiltonian cycle, and choose \(\mathbf{v} = (u_n, u_1, \dots , u_{n-1})\). Then \(d_T(u_i, v_i) \ge 2\) for all i. Conversely, since \(\mathrm {diam}(\kappa _n) = 2\), we have \(\Delta (\kappa _n,r) = 2r\). \(\square \)

Claim 3.14

\(n-r + \Delta (T, r-1) \le \ell (T,r) \le n + 6 r \mathrm {diam}(T) - 4r\).

Proof

For the lower bound, consider \(\alpha \in \mathrm {Sing}_n\) as follows. Let \(\mathbf{u} = (u_1, \dots , u_{r-1})\) and \(\mathbf{v} = (v_1, \dots , v_{r-1})\) achieve \(\Delta (T,r-1)\), and let \(v \notin \{v_1, \dots , v_{r-1}\}\); define

$$\begin{aligned} x \alpha = {\left\{ \begin{array}{ll} v_i &{}\quad \text {if } x = u_i, \\ v &{}\quad \text {otherwise}. \end{array}\right. } \end{aligned}$$

Let \(\omega = e_1 \dots e_l\) (where \(e_i =(a_i \rightarrow b_i)\)) be a shortest word expressing \(\alpha \), where \(l := \ell (T,\alpha )\). Recall that an arc \(e_i\) carries a vertex c if \(c e_1 \dots e_{i-1} = a_i\). By the minimality of \(\omega \), every arc carries at least one vertex. Moreover, if c and d are carried by \(e_i\), then \(c \alpha = d \alpha \); therefore, we can label every arc \(e_i\) of \(\omega \) by an element \(c(e_i) \in \mathrm {Im}(\alpha )\) if \(e_i\) carries vertices eventually mapping to \(c(e_i)\). Denote the number of arcs labelled c as l(c), we then have \(l = \sum _{c \in \mathrm {Im}(\alpha )} l(c)\). For any \(u \in V\), there are at least \(d_T(u, u \alpha )\) arcs carrying u. Therefore,

$$\begin{aligned} l = \sum _{c \in \mathrm {Im}(\alpha )} l(c) \ge \sum _{i=1}^{r-1} d_T(u_i, v_i) + \sum _{a \notin \mathbf{u}} d_T(a, v) \ge \Delta (T, r-1) + n-r. \end{aligned}$$

For the upper bound, we can express any \(\alpha \in \mathrm {Sing}_n\) of rank r in the following fashion. By Lemma 3.9, there exists \(\beta \in \mathrm {Sing}_n\) with the same kernel as \(\alpha \) such that \(\ell (T, \beta ) = n-r\). Suppose that \(\mathrm {Im}(\alpha ) = \{ v_1, \dots , v_r \}\) and \(\mathrm {Im}(\beta ) = \{u_1, \dots , u_r \}\), where \(u_i \beta ^{-1} = v_i \alpha ^{-1}\), for \(i \in [r]\). Let \(h \in [n] {\setminus } \mathrm {Im}(\beta )\). Define a transformation \(\gamma \) of [n] by

$$\begin{aligned} x \gamma = {\left\{ \begin{array}{ll} v_i &{}\quad \text {if } x = u_i,\\ v_1 &{} \quad \text {if } x= h, \\ x &{}\quad \text {otherwise}. \end{array}\right. } \end{aligned}$$

Then \(\alpha = \beta \gamma \), where \(\gamma \in \mathrm {Sing}_n\), and by Theorem 1.1

$$\begin{aligned} \ell (K_n, \gamma ) = n - \mathrm {fix}(\gamma ) + \mathrm {cycl}(\gamma ) \le r + \frac{r}{2} = \frac{3r}{2}. \end{aligned}$$

By Lemma 3.10, each arc associated with \(K_n\) may be expressed in at most \(4 \mathrm {diam}(T) - 2\) arcs associated with T; therefore,

$$\begin{aligned} \ell (T, \gamma ) \le \frac{3r}{2}( 4 \mathrm {diam}(T) - 2) = 6r \mathrm {diam}(T) - 3r. \end{aligned}$$

Thus,

$$\begin{aligned} \ell (T,\alpha ) \le \ell (T,\beta ) + \ell (T,\gamma ) \le n + 6r\mathrm {diam}(T) -4r. \end{aligned}$$

\(\square \)

\(\square \)

4 Conjectures and open problems

We finish the paper by proposing few conjectures and open problems.

Let \(\pi _n\) be the tournament on [n] with edges \(E(\pi _n):=\{ ( i, (i+1) \mod n ) : i \in [n]\} \cup \{ (i, j) : j +1 < i \}\). Figure 3 illustrates \(\pi _5\).

Fig. 3
figure 3

\(\pi _5\)

Conjecture 4.1

For every \(n \ge 3\), \(r \in [n-1]\), and \(T \in \mathrm {Tour}_n\), we have

$$\begin{aligned} \ell (T, r) \le \ell (\pi _n, r) = \ell _{\max }^{\mathrm {Tour}}(n, r) , \end{aligned}$$

with equality if and only if \(T \cong \pi _n\). Furthermore,

$$\begin{aligned} \ell (\pi _n) = \ell _{\max }^{\mathrm {Tour}}(n) = \frac{n^2 + 3n - 6}{2}, \end{aligned}$$

which is achieved for \(\alpha : = n \ (n-1) \ \dots \ 2 \ n\).

Tournament \(\pi _n\) has appeared in the literature before: it is shown in [8] that \(\pi _n\) has the minimum number of strong subtournaments among all strong tournaments on [n]. On the other hand, it was shown in [1] that, for n odd, the circulant tournament \(\kappa _n\) has the maximal number of strong subtournaments among all strong tournaments on [n].

Conjecture 4.2

For every \(n \ge 3\) odd, \(r \in [n-1]\), and \(T \in \mathrm {Tour}_n\), we have

$$\begin{aligned} \ell _{\min }^{\mathrm {Tour}}(n, r) = \ell (\kappa _n, r). \end{aligned}$$

Furthermore,

$$\begin{aligned} \ell _{\min }^{\mathrm {Tour}}(n,2) = n+1 \ \text { and } \ \ell _{\min }^{\mathrm {Tour}}(n,r) = n+r, \end{aligned}$$

for all \(3 \le r \le \frac{n+1}{2}\).

Conjecture 4.3

There exists \(c > 0\) such that for every simple digraph D on [n], \(\ell (D) = O(n^c)\).

The referee of this paper noted that the automorphism groups of \(K_n\) and \(\langle K_n \rangle = \mathrm {Sing}_n\) are both isomorphic to \(\mathrm {Sym}_n\) and proposed the following problems.

Problem 1

Investigate connections between the automorphism groups of D and \(\langle D \rangle \). Is it possible to classify all digraphs D such that the automorphism group of D and of \(\langle D \rangle \) are isomorphic?

Problem 2

Generalise the ideas of this paper to oriented matroids. Is there a natural way to associate (not necessarily idempotent) transformations to each signed circuit of an oriented matroid?

In a forthcoming paper, we investigate the relationship between the graph theoretic properties of D and the semigroup properties of \(\langle D \rangle \).