1 Introduction to Part II

This paper continues our study, initiated in [2], of associative spectra of graph algebras. Introduced by Csákány and Waldhauser [1], the associative spectrum of a binary operation or of the corresponding groupoid is a method of quantifying the degree of (non)-associativity of the operation. Graph algebras were introduced by Shallon [5] as a way of encoding an arbitrary directed graph as an algebra with a binary operation. We refer the reader to the first part of this study [2]—henceforth called “Part I”—for formal definitions, background, motivations, and further details that will not be repeated in this outline. We continue the numbering of sections from Part I, so that we can conveniently refer to theorems, definitions, etc. of Part I simply by their numbers.

In Part I, we determined the possible associative spectra of undirected graphs and classified undirected graphs by their spectra; there are only three distinct possibilities: constant 1, powers of 2, and Catalan numbers. Furthermore, we characterized the antiassociative digraphs, and we determined the associative spectra of certain families of digraphs, such as paths, cycles, and graphs on two vertices.

In this paper, we turn our attention to graph algebras associated with arbitrary digraphs, which may be finite or infinite. In Sect. 7, we provide a necessary and sufficient condition for a graph algebra to satisfy a nontrivial bracketing identity. The condition is expressed in terms of several numerical structural parameters associated, on the one hand, with the digraph and, on the other hand, with a pair of bracketings. We discuss in Sect. 8 how some of the results of Part I are obtained as special cases of this condition.

This result seems a first step towards a general description of the associative spectra of graph algebras associated with arbitrary digraphs. Such a general result, however, eludes us. We can nevertheless establish bounds for the possible associative spectra of graph algebras. As shown in Sect. 9, the associative spectrum of a graph algebra is either a constant sequence bounded above by 2 or it grows exponentially, the least possible growth rate of an exponential spectrum being \(\alpha ^n\), where \(\alpha \approx 1.755\) is the following cubic algebraic integer:

$$\begin{aligned} \alpha = \frac{1}{3}\root 3 \of {\frac{25+3\sqrt{69}}{2}}+\frac{1}{3}\root 3 \of {\frac{25-3\sqrt{69}}{2}}+\frac{2}{3}. \end{aligned}$$

This stands in stark contrast with associative spectra of arbitrary groupoids, where various subexponential spectra such as polynomials of arbitrary degrees are possible.

In Sect. 10, we present some open problems related to this work and indicate possible directions for further research.

2 Satisfaction of bracketing identities by digraphs

We now turn to the general case of arbitrary directed graphs. We are going to define several numerical parameters pertaining, on the one hand, to a pair of distinct bracketings t and \(t'\) of size n and, on the other hand, to a digraph G. For easy reference, the various parameters are collected in Table 1 with cross-references to their definitions. With the help of these parameters, we can provide necessary and sufficient conditions for the graph algebra of a digraph to satisfy a bracketing identity. These conditions are put together in Theorem 7.31.

Table 1 Parameters of pairs of bracketings and graphs

Recall the basic definitions and notation from Sect. 2, as well as the parameters \(H_{t,t'}\), \(M_{t,t'}\), and \(L_{t,t'}\) from Definition 4.2. The following lemma extends Lemma 4.4.

Lemma 7.1

Let \(t, t' \in B_n\), \(t \ne t'\), and let G be a digraph such that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\). Denote \(H := H_{t,t'}\), \(M := M_{t,t'}\), \(L := L_{t,t'}\). Let r be the integer provided by Lemma 4.4. Then, there exists an integer s with \(L + 1 \le s \le r\) and \(s \equiv L \pmod {M}\) such that the following holds: if \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_H\) and \(v_L \rightarrow v'_{L+1} \rightarrow v'_{L+2} \rightarrow \dots \rightarrow v'_H\) are walks in G, then \(v_s \rightarrow v'_{L+1}\) and \(v'_s \rightarrow v_{L+1}\) are edges in G. In particular, \(v_{L+1}\) and \(v'_{L+1}\) belong to the same nontrivial strongly connected component.

Proof

By the definition of L, there exists a vertex \(x_d \in X_n\) such that either \(d_T(x_d) = L + 1 < d_{T'}(x_d)\) or \(d_{T'}(x_d) = L + 1 < d_T(x_d)\). By changing the roles of T and \(T'\), if necessary, we may assume that \(d_T(x_d) = L + 1 < d_{T'}(x_d)\). Let \(x_p\) be the parent of \(x_d\) in T, and let \(x_q\) be the parent of \(x_d\) in \(T'\).

Assume that \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_H\) and \(v_L \rightarrow v'_{L+1} \rightarrow v'_{L+2} \rightarrow \dots \rightarrow v'_H\) are walks in G. By applying Lemma 4.4 to the first walk mentioned and to the walk \(v_0 \rightarrow \dots \rightarrow v_L \rightarrow v'_{L+1} \rightarrow \dots \rightarrow v'_H\), we obtain the edges \(v_r \rightarrow v_{L+1}\) and \(v'_r \rightarrow v'_{L+1}\), so \(v_{L+1} \rightarrow \dots \rightarrow v_r \rightarrow v_{L+1}\) and \(v'_{L+1} \rightarrow \dots \rightarrow v'_r \rightarrow v'_{L+1}\) are closed walks in G. Let W be the walk that starts with \(v_0 \rightarrow \dots \rightarrow v_L\) and continues by going around the closed walk \(v_{L+1} \rightarrow \dots \rightarrow v_r \rightarrow v_{L+1}\) until it reaches length h(T), and let \(W'\) be the closed walk \(v'_{L+1} \rightarrow \dots \rightarrow v'_r \rightarrow v'_{L+1}\). Let \(\varphi :X_n \rightarrow V(G)\) be the collapsing map of \((T,x_d)\) on \((W,W')\) (see Definition 2.8). Since \(\varphi \) is a homomorphism of T into G, it is also a homomorphism of \(T'\) into G by Proposition 2.1. Since \((x_q, x_d) \in E(T')\), we have \((\varphi (x_q), \varphi (x_d)) \in E(G)\). By definition, \(\varphi (x_d) = v'_{L+1}\). In order to determine \(\varphi (x_q)\), note first that \(q < d\) because \((x_q, x_d)\) is an edge in \(T'\). This implies that \(x_q \notin T_{x_d}\), and thus, \(\varphi (x_q)\) lies in W, so \(\varphi (x_q) = v_s\) for some \(s \in \{0, 1, \dots , r\}\). Since \(d_T(x_q) \ge L+1\), \(\varphi (x_q)\) lies on the closed walk \(v_{L+1} \rightarrow \dots \rightarrow v_r \rightarrow v_{L+1}\). Therefore, s is the unique element of the set \(\{L+1, \dots , r\}\) such that \(s \equiv d_T(x_q) \pmod {r-L}\); note that the value of s does not depend on the walks \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_H\) and \(v_L \rightarrow v'_{L+1} \rightarrow v'_{L+2} \rightarrow \dots \rightarrow v'_H\) but only on t and \(t'\). Since \(r \equiv L \pmod {M}\), the number \(r - L\) is divisible by M; therefore, \(s \equiv d_T(x_q) \equiv L \pmod {M}\).

Switching the roles of the closed walks \(v_{L+1} \rightarrow \dots \rightarrow v_r \rightarrow v_{L+1}\) and \(v'_{L+1} \rightarrow \dots \rightarrow v'_r \rightarrow v'_{L+1}\), a similar argument shows that \((v'_s, v_{L+1}) \in E(G)\). Now we have the closed walk \(v_{L+1} \rightarrow \dots \rightarrow v_s \rightarrow v'_{L+1} \rightarrow \dots \rightarrow v'_s \rightarrow v_{L+1}\) in G. This means, in particular, that \(v_{L+1}\) and \(v'_{L+1}\) belong to the same nontrivial strongly connected component. \(\square \)

Definition 7.2

For a digraph G, let \(M_{G}\) be the least common multiple of the set of all numbers m for which there exists a strongly connected component of G that is an m-whirl (see Definition 4.7), with the convention that the least common multiple of the empty set is 1. If there is no finite upper bound on such numbers m, then define \(M_{G}:= \infty \).

Example 7.3

Consider the graph G shown in Fig. 1. Highlighted as shaded regions, the nontrivial strongly connected components are a 3-whirl and a 4-whirl. Consequently, \(M_{G}= {{\,\mathrm{lcm}\,}}(3,4) = 12\).

Fig. 1
figure 1

Graph G and its structural parameters

Definition 7.4

Let \(G = (V,E)\) be a digraph. Recall from Definition 4.10 that a walk in G is pleasant, if all its vertices belong to trivial strongly connected components (i.e., loopless one-vertex components). A walk in G is winding, if all its vertices belong to a single nontrivial strongly connected component of G.

Let K be a nontrivial strongly connected component of G. A path \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\ell \) in G is called an entryway to K if \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_{\ell -1}\) is a pleasant path and \(v_\ell \in K\). Analogously, \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\ell \) is called an outlet from K if \(v_0 \in K\) and \(v_1 \rightarrow v_2 \rightarrow \dots \rightarrow v_\ell \) is a pleasant path.

Denote by \(P_{G}\), \(E_{G}\) and \(O_{G}\) the length of the longest pleasant path, entryway, and outlet in G, respectively. If there is no finite upper bound on the length of pleasant paths, entryways, or outlets in G, then define \(P_{G}:= \infty \), \(E_{G}:= \infty \), \(O_{G}:= \infty \), respectively. If there is no pleasant path, entryway, or outlet in G, then let \(P_{G}:= -\infty \), \(E_{G}:= -\infty \), \(O_{G}:= -\infty \), respectively.

Example 7.5

In the graph G of Fig. 1, the longest pleasant path is \(p_0 \rightarrow p_1 \rightarrow \dots \rightarrow p_9\), the longest entryway is \(e_0 \rightarrow e_1 \rightarrow e_2 \rightarrow e_3 \rightarrow e_4\), and the longest outlet is \(o_0 \rightarrow o_1 \rightarrow o_2 \rightarrow o_3\). Therefore, \(P_{G}= 9\), \(E_{G}= 4\), \(O_{G}= 3\).

Lemma 7.6

If \(\mathbb {A}({G})\) for a digraph G satisfies the identity \(t \approx t'\) for \(t, t' \in B_n\), \(t \ne t'\), then \(M_{G}\mathrel {\!|\!}M_{t,t'}\) and \(P_{G}< H_{t,t'}\).

Proof

This follows immediately from Lemmata 4.8 and 4.11. \(\square \)

Lemma 7.7

Let \(t, t' \in B_n\), \(t \ne t'\), and let G be a digraph such that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\). Then, \(E_{G}\le L_{t,t'}+ 1\).

Proof

Denote \(H := H_{t,t'}\), \(L := L_{t,t'}\). Suppose, to the contrary, that there is an entryway \(W :v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_k\), where \(k > L + 1\). Then, \(v_k\) belongs to a nontrivial strongly connected component K and the other vertices of W belong to trivial strongly connected components. Extending W, if necessary, with vertices of K, we obtain a walk \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_H\), and Lemma 4.4 implies that \(v_{L+1}\) belongs to a nontrivial strongly connected component. This is a contradiction. \(\square \)

Definition 7.8

Let \(t, t' \in B_n\), \(t \ne t'\), and denote \(T := G(t)\), \(T' := G(t')\). Let \(Y_{t,t'}\) be the largest integer m such that for all \(x_i \in X_n\),

$$\begin{aligned} \bigl ( h(T_{x_i}) \le m \vee h(T'_{x_i}) \le m \bigr ) \implies T_{x_i} = T'_{x_i}. \end{aligned}$$

In other words, the rooted induced subtrees of T and \(T'\) of height at most \(Y_{t,t'}\) are identical. Note that \(-1 \le Y_{t,t'}< H_{t,t'}\), and the equality \(Y_{t,t'}= -1\) holds if and only if T and \(T'\) have different sets of leaves.

Example 7.9

Figure 2 shows two DFS trees corresponding to certain terms \(t, t' \in B_{14}\). It is easy to verify that \(Y_{t,t'}= 3\): all subtrees of height at most 3 are identical in the two trees, but the subtrees rooted at \(x_3\) are distinct and have height 4.

Fig. 2
figure 2

DFS trees with \(Y_{t,t'}= 3\), \(Z_{t,t'}= 2\)

Lemma 7.10

Let \(t, t' \in B_n\), \(t \ne t'\), and let G be a digraph such that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\). Then, \(O_{G}\le Y_{t,t'}+ 1\).

Proof

Denote \(Y := Y_{t,t'}\). By the definition of Y, there exists \(x_d \in X_n\) such that \(T_{x_d} \ne T'_{x_d}\) and \(h(T_{x_d}) = Y + 1 \le h(T'_{x_d})\) or \(h(T'_{x_d}) = Y + 1 \le h(T_{x_d})\). We may assume, by changing the roles of t and \(t'\) if necessary, that \(h(T_{x_d}) = Y + 1 \le h(T'_{x_d})\).

By the definition of a DFS tree, \(V(T_{x_d}) = X_{[d,e]}\) and \(V(T'_{x_d}) = X_{[d,e']}\) for some \(e, e' \in [{n}]\). Assume that \(N_\mathrm {o}^{T}({x_d}) = \{x_{i_1}, x_{i_2}, \dots , x_{i_\ell }\}\) with \(d + 1 = i_1< i_2< \dots < i_\ell \); hence, \(V(T_{x_{i_j}}) = X_{[i_j, i_{j+1} - 1]}\) for \(1 \le j \le \ell - 1\) and \(V(T_{x_{i_\ell }}) = X_{[i_\ell , e]}\). For all \(x_{i_j} \in N_\mathrm {o}^{T}({x_d})\) it holds that \(h(T_{x_{i_j}}) \le h(T_{x_d}) - 1 = Y\); hence, \(T_{x_{i_j}} = T'_{x_{i_j}}\) by the definition of Y. For all \(x_{i_j} \in N_\mathrm {o}^{T}({x_d})\) with \(i_j > e'\), we obviously have \(x_{i_j} \notin V(T'_{x_d})\), and hence, \(x_{i_j} \notin N_\mathrm {o}^{T'}({x_d})\). An easy inductive argument shows that \(x_{i_j} \in N_\mathrm {o}^{T'}({x_d})\) for all \(x_{i_j} \in N_\mathrm {o}^{T}({x_d})\) with \(i_j \le e'\),

We must have \(e \ne e'\). (Suppose \(e = e'\). Then, \(N_\mathrm {o}^{T}({x_d}) = N_\mathrm {o}^{T'}({x_d})\) and consequently \(T_{x_d} = T'_{x_d}\), contradicting our assumptions. Hence, we must have \(e \ne e'\).) If \(e < e'\), then \(N_\mathrm {o}^{T}({x_d}) \subset N_\mathrm {o}^{T'}({x_d})\); in particular, \(x_{e+1} \in N_\mathrm {o}^{T'}({x_d})\). If \(e > e'\), then \(N_\mathrm {o}^{T}({x_d}) \supset N_\mathrm {o}^{T'}({x_d})\); in particular, \(x_{e'+1} \in N_\mathrm {o}^{T}({x_d})\).

Suppose now, to the contrary of the statement of the lemma, that \(O_{G}> Y + 1\), i.e., that G has an outlet \(W :v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_k\) with \(k > Y + 1\). Then, \(v_0\) belongs to a nontrivial strongly connected component K and the remaining vertices of W belong to trivial strongly connected components. In particular, there exists a cycle C in K to which \(v_0\) belongs.

Consider first the case when \(e < e'\). Let \(W' :v_1 \rightarrow \dots \rightarrow v_k\), let \(x_p\) be the parent of \(x_d\) in T, and let \(\varphi :X_n \rightarrow V(G)\) be the collapsing map of \((T,x_d)\) on \((C,W')\) satisfying \(\varphi (x_p) = v_0\). By Proposition 2.1, \(\varphi \) is a homomorphism of \(T'\) into G. Since \((x_d,x_{e+1})\) is an edge of \(T'\), we have the edge \((\varphi (x_d), \varphi (x_{e+1})) \in E(G)\). Since \(\varphi (x_d) = v_1\) and \(\varphi (x_{e+1})\) belongs to C, this implies that \(v_1\) belongs to the strongly connected component K, a contradiction.

The case when \(e > e'\) is treated similarly. Let \(W' :v_1 \rightarrow \dots \rightarrow v_k\), let \(x_{p'}\) be the parent of \(x_d\) in \(T'\), and let \(\varphi :X_n \rightarrow V(G)\) be the collapsing map of \((T',x_d)\) on \((C,W')\) satisfying \(\varphi (x_{p'}) = v_0\). Note that in this case \(h(T'_{x_d}) = h(T_{x_d}) = Y+1 < k\), so it is indeed possible to collapse \(T'_{x_d}\) on \(v_1 \rightarrow \dots \rightarrow v_k\). A similar argument as above now shows that \((\varphi (x_d), \varphi (x_{e'+1})) \in E(G)\), which implies that \(v_1\) belongs to the strongly connected component K, a contradiction. \(\square \)

Definition 7.11

Let \(t, t' \in B_n\), \(t \ne t'\), and denote \(T := G(t)\), \(T' := G(t')\). Let \(Z_{t,t'}\) be the smallest nonnegative number m such that there exists \(x_i \in X_n\) with \(T_{x_i} = T'_{x_i}\), \(h(T_{x_i}) = h(T'_{x_i}) = m\), and \(x_i\) has distinct parents in T and \(T'\). Such a number m always exists (see Lemma 7.13) and it must clearly be smaller than the heights of T and \(T'\). Hence, \(0 \le Z_{t,t'}< H_{t,t'}\).

Example 7.12

For the DFS trees of Fig. 2, it holds that \(Z_{t,t'}= 2\), as witnessed by the subtrees rooted at \(x_{11}\).

The next lemma shows that the parameter \(Z_{t,t'}\) is well defined: for distinct DFS trees T and \(T'\) of size n, there always exists a vertex \(x_i \in X_n\) such that \(T_{x_i} = T'_{x_i}\) and \(x_i\) has distinct parents in T and \(T'\).

Lemma 7.13

Let T and \(T'\) be DFS trees of size n. Assume that for all \(x_i \in X_n \setminus \{x_1\}\), it holds that if \(T_{x_i} = T'_{x_i}\), then \(x_i\) has the same parent in T and in \(T'\). Then, \(T = T'\).

Proof

We proceed by induction on n. The statement obviously holds for \(n = 1\) and \(n = 2\). Assume that the statement holds for all DFS trees of size k. Let T and \(T'\) be DFS trees of size \(k+1\) satisfying the condition that for all \(x_i \in X_{k+1} \setminus \{x_1\}\), if \(T_{x_i} = T'_{x_i}\), then \(x_i\) has the same parent in T and \(T'\).

Since \(x_{k+1}\) is a leaf in both T and \(T'\), we have \(T_{x_{k+1}} = T'_{x_{k+1}}\); hence, \(x_{k+1}\) has the same parent in T and \(T'\), say \(x_p\). Consider \({\overline{T}} := T \setminus \{x_{k+1}\}\), \({\overline{T}}' := T' \setminus \{x_{k+1}\}\). Clearly \({\overline{T}}\) and \({\overline{T}}'\) are DFS trees of size k, and \(T = {\overline{T}} + (x_p, x_{k+1})\) and \(T' = {\overline{T}}' + (x_p, x_{k+1})\) (where the notation \({\overline{T}} + (x_p, x_{k+1})\) stands for adjoining a new vertex \(x_{k+1}\) and a new edge \((x_p, x_{k+1})\) to \({\overline{T}}\)). Let \(x_i \in X_k\) and assume that \({\overline{T}}_{x_i} = {\overline{T}}'_{x_i}\). If \(x_p \notin V({\overline{T}}_{x_i}) = V({\overline{T}}'_{x_i})\), then \(T_{x_i} = {\overline{T}}_{x_i} = {\overline{T}}'_{x_i} = T'_{x_i}\). If \(x_p \in V({\overline{T}}_{x_i}) = V({\overline{T}}'_{x_i})\), then \(T_{x_i} = {\overline{T}}_{x_i} + (x_p, x_{k+1}) = {\overline{T}}'_{x_i} + (x_p, x_{k+1}) = T'_{x_i}\). In either case, our assumption on T and \(T'\) implies that \(x_i\) has the same parent in T and \(T'\) and hence also in \({\overline{T}}\) and \({\overline{T}}'\). Consequently, \({\overline{T}}\) and \({\overline{T}}'\) satisfy the condition of the inductive hypothesis, so \({\overline{T}} = {\overline{T}}'\). Therefore, \(T = {\overline{T}} + (x_p, x_{k+1}) = {\overline{T}}' + (x_p, x_{k+1}) = T'\). \(\square \)

Definition 7.14

For a digraph G, let \(Z_{G}\) be the largest nonnegative integer m such that there exist a strongly connected component K of G that is a whirl, a block B of K, vertices \(u, w \in B\) and a walk \(u \rightarrow v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_m\) but \((w,v_0) \notin E(G)\). If there is no finite upper bound on such numbers m, then define \(Z_{G}:= \infty \). If no such number m exists, then define \(Z_{G}:= -\infty \).

Example 7.15

In the graph G of Fig. 1, vertices u and w belong to the same block of a whirl. The path \(u \rightarrow z_0 \rightarrow z_1\) and the non-edge \((w, z_0)\) witness that \(Z_{G}= 1\).

Lemma 7.16

Let \(t, t' \in B_n\), \(t \ne t'\), and let G be a digraph such that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\). Assume that u and w are vertices belonging to the same block of a nontrivial strongly connected component. If \(u \rightarrow v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_{Z_{t,t'}}\) is a walk in G, then \(w \rightarrow v_0\) is an edge. Consequently, \(Z_{G}< Z_{t,t'}\).

Proof

Denote \(M := M_{t,t'}\), \(Z := Z_{t,t'}\). By Lemma 4.8, the strongly connected component K containing u and w is an m-whirl for some divisor m of M; let \(B_a\) be the block containing u and w. By the definition of Z, there exists \(x_d \in X_n\) such that \(T_{x_d} = T'_{x_d}\), \(h(T_{x_d}) = Z\), and the parent \(x_p\) of \(x_d\) in T is distinct from the parent \(x_q\) of \(x_d\) in \(T'\). Observe that \(d_T(x_p) = d_T(x_d) - 1 \equiv d_{T'}(x_d) - 1 = d_{T'}(x_q) \equiv d_T(x_q) \pmod {M}\); hence, also \(d_T(x_p) \equiv d_T(x_q) \pmod {m}\). Let C be a cycle of length m in K containing the vertex u. Let \(W :v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_Z\) be any walk in G such that \(u \rightarrow v_0\) is an edge, and let \(\varphi :X_n \rightarrow V(G)\) be the collapsing map of \((T,x_d)\) on (CW) with \(\varphi (x_p) = u\) (also \(\varphi (x_q) = u\)). Let \(\psi :X_n \rightarrow V(G)\) be the map that coincides with \(\varphi \) everywhere except at \(x_q\) and satisfies \(\psi (x_q) = w\). Moreover, since \(T_{x_d} = T'_{x_d}\), the vertex \(x_q\) lies outside of \(T_{x_d}\) and so do its children in T (because \(x_d\) is not a child of \(x_q\) in T) and its parent in T (because if the parent of \(x_q\) lay in \(T_{x_d}\), then so would \(x_q\), as \(T_{x_d}\) is closed under descendants). Therefore, the images of these vertices under \(\varphi \) lie in K (actually in C). Since u and w belong to the same block \(B_a\), the inneighbours (outneighbours, resp.) of u and w within K are the same. Consequently, \(\psi \) is a homomorphism of T into G, so, by Proposition 2.1, \(\psi \) is a homomorphism of \(T'\) into G; hence, \((w, v_0) = (\psi (x_q), \psi (x_d)) \in E(G)\). \(\square \)

Definition 7.17

For a digraph G, let \(B_{G}\) be the largest integer m such that there exist a walk \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_m\) and edges \(v_m \rightarrow v_{m+1}\), \(v_m \rightarrow v'_{m+1}\) such that \(v_{m+1}\) and \(v'_{m+1}\) belong to distinct nontrivial strongly connected components. If there is no finite upper bound on such numbers m, then define \(B_{G}:= \infty \). If no such number m exists, then define \(B_{G}:= -\infty \).

Example 7.18

In the graph G of Fig. 1, the path \(b_0 \rightarrow b_1 \rightarrow b_2\) and the edges \(b_2 \rightarrow v\) and \(b_2 \rightarrow v'\) witness that \(B_{G}= 2\).

Lemma 7.19

Let \(t, t' \in B_n\), \(t \ne t'\), and let G be a digraph such that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\). Denote \(L := L_{t,t'}\). If \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_{L+1}\) is a walk and \(v_L \rightarrow v'_{L+1}\) is an edge in G such that \(v_{L+1}\) and \(v'_{L+1}\) belong to nontrivial strongly connected components K and \(K'\), respectively, then \(K = K'\). Consequently, \(B_{G}< L_{t,t'}\).

Proof

Denote \(H := H_{t,t'}\), \(L := L_{t,t'}\). Using the given walks and vertices of K and \(K'\), we can build walks \(v_0 \rightarrow \dots \rightarrow v_H\) and \(v_L \rightarrow v'_{L+1} \rightarrow \dots \rightarrow v'_H\). By Lemma 7.1, \(v_{L+1}\) and \(v'_{L+1}\) belong to the same strongly connected component, i.e., \(K = K'\). \(\square \)

Definition 7.20

Let \(t, t' \in B_n\), \(t \ne t'\), and denote \(T := G(t)\), \(T' := G(t')\). Let

$$\begin{aligned} \varDelta _{t,t'}&:= \{x \in X_n \mid T_x \ne T'_x\}, \\ \varOmega _{t,t'}&:= \bigl \{ (d_T(x), h(T_x)) \bigm | x \in \varDelta _{t,t'}\bigr \} \cup \bigl \{ (d_{T'}(x), h(T'_x)) \bigm | x \in \varDelta _{t,t'}\bigr \}, \\ \xi _{t,t'}&:= \min \{ d + h \mid (d,h) \in \varOmega _{t,t'}\}, \end{aligned}$$

and define the map \(\omega _{t,t'}:\mathbb {N}\rightarrow \mathbb {N}\) by the rule

$$\begin{aligned} \omega _{t,t'}(r) := {\left\{ \begin{array}{ll} \min \{ d + h \mid (d,h) \in \varOmega _{t,t'}\text { and }d \le r \}, &{} \text { if }r < \xi _{t,t'}, \\ \xi _{t,t'}, &{} \text { if }r \ge \xi _{t,t'}. \end{array}\right. } \end{aligned}$$

Note that \(\omega _{t,t'}(0) = H_{t,t'}\) and \(\omega _{t,t'}(r) > L_{t,t'}\) for all \(r \in \mathbb {N}\). Moreover, \(\omega _{t,t'}\) is a nonincreasing function, and we may specify \(\omega _{t,t'}\) by writing down the first few values of \(\omega _{t,t'}\) until \(\xi _{t,t'}\) is reached.

Example 7.21

Figure 3 shows two DFS trees corresponding to certain terms \(t, t' \in B_{20}\). Note that \(L_{t,t'}= 2\). It is easy to verify that

$$\begin{aligned} \varDelta _{t,t'}&= \{ x_1, x_2, x_3, x_4, x_5, x_7, x_8, x_9, x_{10}, x_{11}, x_{16}, x_{17}, x_{18}\}, \\ \varOmega _{t,t'}&= \{ \underbrace{(0,7), (0,6)}_{x_1}, \underbrace{(1,3), (1,4)}_{x_2}, \underbrace{(2,2), (2,3)}_{x_3}, \underbrace{(3,1), (3,2)}_{x_4}, \underbrace{(4,0), (4,1)}_{x_5}, \\&\qquad \underbrace{(1,6), (1,5)}_{x_7}, \underbrace{(2,5), (2,4)}_{x_8}, \underbrace{(3,4), (3,3)}_{x_9}, \underbrace{(4,3), (4,2)}_{x_{10}}, \underbrace{(5,2), (5,0)}_{x_{11}}, \\&\qquad \underbrace{(2,3), (2,2)}_{x_{16}}, \underbrace{(3,0), (3,1)}_{x_{17}}, \underbrace{(3,2), (4,0)}_{x_{18}} \}, \\ \xi _{t,t'}&= 3, \end{aligned}$$

whence \(\omega _{t,t'}:\mathbb {N}\rightarrow \mathbb {N}\) is the map \(0 \mapsto 6\), \(1 \mapsto 4\), \(2 \mapsto 4\), \(i \mapsto 3\) for \(i \ge 3\), or, using the shorthand, \(\omega _{t,t'}= (6,4,4,3,\dots )\).

Fig. 3
figure 3

DFS trees with \(\omega _{t,t'}= (6, 4, 4, 3, \ldots )\) and \(\lambda _{t,t'}= 1\)

Definition 7.22

Let G be a digraph. For \(\ell , r \in \mathbb {N}\) with \(\ell \ge r \ge 1\), let \(\omega _{G}(\ell ,r)\) be the largest integer m such that there exist a walk \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\ell \), where \(v_\ell \) belongs to a nontrivial strongly connected component, and a walk \(v_{r-1} \rightarrow v'_r \rightarrow v'_{r+1} \rightarrow \dots \rightarrow v'_m\) such that \(v'_\ell \) belongs to a trivial strongly connected component. If there is no finite upper bound on such numbers m, then define \(\omega _{G}(\ell ,r) := \infty \). If no such number m exists, then define \(\omega _{G}(\ell ,r) := -\infty \). Note that \(\omega _{G}(\ell ,r) \ge \ell + O_{G}- 1\) whenever \(O_{G}\ge 1\) (if \(o_0 \rightarrow o_1 \rightarrow \dots \rightarrow o_{O_{G}}\) is an outlet of length \(O_{G}\ge 1\), then consider a walk \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\ell \) going around the strongly connected component of \(o_0\) so that \(v_{\ell -1} = o_0\) and the walk \(v_{r-1} \rightarrow \dots \rightarrow v_{\ell -1} \rightarrow o_1 \rightarrow \dots \rightarrow o_{O_{G}}\)).

Example 7.23

It is not difficult to verify that for the graph G of Fig. 1, the parameter \(\omega _{G}(\ell ,r)\) has the value presented in the table in Fig. 1. For the values not shown in the table, that is, for \(\ell , r \in \mathbb {N}\) such that \(\ell \ge 6\) and \(\ell \ge r \ge 1\), it holds that \(\omega _{G}(\ell ,r) = \ell + 2\).

Lemma 7.24

Let \(t, t' \in B_n\), \(t \ne t'\), and let G be a digraph such that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\). Denote \(L := L_{t,t'}\), \(\omega := \omega _{t,t'}\). If \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_{L+1}\) is a walk in G such that \(v_{L+1}\) belongs to a nontrivial strongly connected component, \(r \in \{1, \dots , L+1\}\), and \(v_{r-1} \rightarrow v'_r \rightarrow v'_{r+1} \rightarrow \dots \rightarrow v'_{\omega (r)}\) is a walk in G (recall that \(\omega (r) \ge L + 1\)), then \(v'_{L+1}\) belongs to a nontrivial strongly connected component. Consequently, \(\omega _{G}(L_{t,t'}+ 1, r) < \omega _{t,t'}(r)\) for all \(r \in \{1, \dots , L_{t,t'}+ 1\}\).

Proof

Denote \(H := H_{t,t'}\), \(M := M_{t,t'}\), \(T := G(t)\), \(T' := G(t')\). Let K be the strongly connected component of \(v_{L+1}\). By Lemma 4.8, K is an m-whirl for some divisor m of M. Let \(B_a\) be the block of K containing \(v_{L+1}\), and let \(B_{a-1}\) be the predecessor block of \(B_a\).

If \(\omega (r) \ge H\), then the claim follows immediately from Lemma 4.4. We can thus assume that \(\omega (r) < H\). By the definition of \(\omega (r)\) and \(\varOmega _{t,t'}\), there exists a vertex \(x_d \in X_n\) such that \(T_{x_d} \ne T'_{x_d}\), and either \(d_T(x_d) \le r\) and \(d_T(x_d) + h(T_{x_d}) = \omega (r)\) or \(d_{T'}(x_d) \le r\) and \(d_{T'}(x_d) + h(T'_{x_d}) = \omega (r)\); moreover, for all \(x_i \in X_n\) such that \(T_{x_i} \ne T'_{x_i}\), it holds that \(d_T(x_i) \le r\) implies \(d_T(x_i) + h(T_{x_i}) \ge \omega (r)\), and \(d_{T'}(x_i) \le r\) implies \(d_{T'}(x_i) + h(T'_{x_i}) \ge \omega (r)\). We may assume, by changing the roles of t and \(t'\) if necessary, that \(d_T(x_d) \le r\) and \(d_T(x_d) + h(T_{x_d}) = \omega (r)\). Note that if \(d_T(x_d) \le L\) or \(d_{T'}(x_d) \le L\), then, by the definition of L, we have \(d_T(x_d) = d_{T'}(x_d)\). Since \(d_T(x_d) \le r \le L + 1\), it follows from our assumptions that either \(d_T(x_d) = d_{T'}(x_d) \le L + 1\) and \(h(T_{x_d}) \le h(T'_{x_d})\), or \(d_T(x_d) = L + 1 < d_{T'}(x_d)\).

We are going to make use of the homomorphism \(\varphi :T \rightarrow G\) that is defined as follows. Fix an m-cycle C in K that contains the vertex \(v_{L+1}\), and let W be a walk that starts with \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_{L+1}\) and continues around C until it reaches length h(T). Let \(W'\) be the walk \(v_{d_T(x_d)} \rightarrow \dots \rightarrow v_{r-1} \rightarrow v'_r \rightarrow v'_{r+1} \rightarrow \dots \rightarrow v'_{\omega (r)}\) if \(d_T(x_d) < r\) and \(v'_r \rightarrow v'_{r+1} \rightarrow \dots \rightarrow v'_{\omega (r)}\) if \(d_T(x_d) = r\). Note that \(W'\) has length exactly \(h(T_{x_d})\) because \(d_T(x_d) + h(T_{x_d}) = \omega (r)\). Let \(\varphi :X_n \rightarrow V(G)\) be the collapsing map of \((T,x_d)\) on \((W,W')\). By Proposition 2.1, \(\varphi \) is also a homomorphism of \(T'\) into G.

We have \(V(T_{x_d}) = X_{[d,e]}\) and \(V(T'_{x_d}) = X_{[d,e']}\) for some \(e, e' \in [{n}]\). Consequently \(V(T_{x_d}) \subseteq V(T'_{x_d})\) (if \(e \le e'\)) or \(V(T'_{x_d}) \subseteq V(T_{x_d})\) (if \(e' \le e\)). We will consider several cases and subcases.

Case 1: \(V(T_{x_d}) \subsetneq V(T'_{x_d})\), i.e., \(e < e'\). Then, necessarily \(r = d_T(x_d) = L + 1\) and \(x_{e+1} \in V(T'_{x_d}) \setminus V(T_{x_d})\); note that \(W'\) is the walk \(v'_{L+1} \rightarrow \dots \rightarrow v'_{\omega (r)}\). Let \(x_p\) be the parent of \(x_{e+1}\) in \(T'\). Then, \(d \le p < e + 1\), so \(x_p \in V(T_{x_d})\). Moreover, since \(x_{e+1}\) has different parents in T and \(T'\), we must have \(d_T(x_{e+1}) \ge L + 1\) by the definition of L. Since \(\varphi :T' \rightarrow G\) is a homomorphism, we have \((\varphi (x_p), \varphi (x_{e+1})) \in E(G)\). Since \(x_p \in V(T_{x_d})\), we have \(\varphi (x_p) \in \{v'_r, v'_{r+1}, \dots , v'_{\omega (r)}\}\); since \(x_{e+1} \notin V(T_{x_d})\) and \(d_T(x_{e+1}) \ge L + 1\), we have \(\varphi (x_{e+1}) \in K\). Now we can extend the walk \(v_0 \rightarrow \dots \rightarrow v_L \rightarrow v'_{L+1} \rightarrow \dots \rightarrow \varphi (x_p) \rightarrow \varphi (x_{e+1})\) with vertices of K so that we obtain a walk of length H, and Lemma 4.4 implies that \(v'_{L+1}\) belongs to a nontrivial strongly connected component, in fact, to K by Lemma 4.9.

Case 2: \(V(T_{x_d}) \supseteq V(T'_{x_d})\), i.e., \(e \ge e'\). Then, \(\varphi \) maps \(V(T'_{x_d})\) on \(W'\).

Case 2.1: \(h(T_{x_d}) < h(T'_{x_d}) =: h'\). Let \(x_d = u_0, u_1, \dots , u_{h'}\) be a longest path in \(T'_{x_d}\). Write \(d_i := d_T(u_i)\) for \(i \in \{0, \dots , h'\}\). Since \(h(T_{x_d}) < h(T'_{x_d})\), the sequence \(d_0, d_1, \dots , d_{h'}\) cannot be strictly increasing, so there is an index \(i \in \{0, \dots , h' - 1\}\) such that \(d_i \ge d_{i+1}\); in fact, \(d_{i+1} \ge L+1\) by the definition of L. Then, \((\varphi (u_i), \varphi (u_{i+1})) = (v'_{d_i}, v'_{d_{i+1}}) \in E(G)\), so \(v'_{d_{i+1}} \rightarrow \dots \rightarrow v'_{d_i} \rightarrow v'_{d_{i+1}}\) is a closed walk in G. Now, an application of Lemma 4.4 to the walk that starts with \(v_0 \rightarrow \dots \rightarrow v_{r-1} \rightarrow v'_r \rightarrow \dots \rightarrow v'_{d_{i+1}}\) and continues around the closed walk \(v'_{d_{i+1}} \rightarrow \dots \rightarrow v'_{d_i} \rightarrow v'_{d_{i+1}}\) until it reaches length H shows that \(v'_{L+1}\) belongs to a nontrivial strongly connected component.

Case 2.2: \(h(T_{x_d}) \ge h(T'_{x_d})\). Recall that either \(d_T(x_d) = d_{T'}(x_d) \le L + 1\) and \(h(T_{x_d}) \le h(T'_{x_d})\), or \(d_T(x_d) = L + 1 < d_{T'}(x_d)\). We consider separately these two cases.

Case 2.2.1: \(d_T(x_d) = d_{T'}(x_d) \le L + 1\) and \(h(T_{x_d}) \le h(T'_{x_d})\). It follows from our assumptions that \(h(T_{x_d}) = h(T'_{x_d})\). If \(V(T_{x_d}) \supsetneq V(T'_{x_d})\), then we can repeat the above argument with the roles of t and \(t'\) switched, and we will reach Case 1 and we are done. We can now assume that \(V(T_{x_d}) = V(T'_{x_d})\) (note that this holds if \(d_T(x_d) = d_{T'}(x_d) \le L\)). Observe that now the roles of t and \(t'\) are symmetric; we would reach this point in the argument even if t and \(t'\) were switched, and we may swap them if necessary.

Since \(T_{x_d} \ne T'_{x_d}\), there exists an element \(x_q \in V(T_{x_d})\) such that \(d_T(x_q) \ne d_{T'}(x_q)\); assume that the index q is the smallest possible. Swapping the roles of t and \(t'\), if necessary, we may assume that \(d_T(x_q) < d_{T'}(x_q)\); moreover, \(d_T(x_q) \ge L + 1\) by the definition of L. Let \(x_p\) be the parent of \(x_q\) in \(T'\). Then, \(p < q\), so by the choice of \(x_q\), we have \(d_T(x_p) = d_{T'}(x_p) = d_{T'}(x_q) - 1 \ge d_T(x_q) \ge L + 1\). Since \(\varphi :T' \rightarrow G\) is a homomorphism, we have \((\varphi (x_p), \varphi (x_q)) = (v'_{d_p}, v'_{d_q}) \in E(G)\), where \(d_p := d_T(x_p)\), \(d_q := d_T(x_q)\). Then, \(v'_{d_q} \rightarrow \dots \rightarrow v'_{d_p} \rightarrow v'_{d_q}\) is a closed walk in G. It then follows easily from Lemma 4.4 that \(v'_{L+1}\) belongs to a nontrivial strongly connected component.

Case 2.2.2: \(d_T(x_d) = L + 1 < d_{T'}(x_d)\). Since \(1 \le r \le L+1\) and \(d_T(x_d) \le r\), we have \(r = L+1\) in this case; therefore, \(W'\) is the walk \(v'_{L+1} \rightarrow \dots \rightarrow v'_{\omega (r)}\). Let \(x_p\) be the parent of \(x_d\) in \(T'\). Then, \(p < d\), so \(x_p \notin V(T_{x_d})\), and \(d_T(x_p) \equiv d_{T'}(x_p) = d_{T'}(x_d) - 1 \equiv d_T(x_d) - 1 = L \pmod {M}\). Moreover, \(d_{T'}(x_p) \ge L + 1\), so also \(d_T(x_p) \ge L + 1\) by the definition of L, and we have \(w := \varphi (x_p) \in B_{a-1}\). Since \(\varphi :T' \rightarrow G\) is a homomorphism, we have \((\varphi (x_p), \varphi (x_d)) = (w, v'_{L+1}) \in E(G)\).

Define homomorphisms \(\psi :T \rightarrow G\) and \(\psi ' :T' \rightarrow G\) as follows. Let \(\psi \) be the collapsing map of \((T,x_d)\) on \((C,W')\) that maps the parent of \(x_d\) in T to w, and let \(\psi '\) be the collapsing map of \((T',x_d)\) on \((C,W')\) that maps the parent of \(x_d\) in \(T'\) to w.

Recall that we are assuming that \(V(T_{x_d}) \supseteq V(T'_{x_d})\) and \(h(T_{x_d}) \ge h(T'_{x_d})\). If \(V(T_{x_d}) \supsetneq V(T'_{x_d})\), then using a similar argument as in Case 1 with the homomorphism \(\psi '\) in place of \(\varphi \), we can find an edge from \(W'\) to K, from which it follows that \(v'_{L+1}\) belongs to a nontrivial strongly connected component. We can thus assume that \(V(T_{x_d}) = V(T'_{x_d})\). If \(h(T_{x_d}) > h(T'_{x_d})\), then using a similar argument as in Case 2.1 with the homomorphism \(\psi '\) in place of \(\varphi \), we can find a closed walk in \(W'\), from which it follows that \(v'_{L+1}\) belongs to a nontrivial strongly connected component. We can thus assume that \(h(T_{x_d}) = h(T'_{x_d})\). Now, using a similar argument as in Case 2.2.1 with the homomorphism \(\psi \) or \(\psi '\) in place of \(\varphi \), we can find a closed walk in \(W'\), from which it again follows that \(v'_{L+1}\) belongs to a nontrivial strongly connected component. \(\square \)

Definition 7.25

Let \(t, t' \in B_n\), \(t \ne t'\), and denote \(T := G(t)\), \(T' := G(t')\). Let

$$\begin{aligned} \varLambda _{t,t'}:= \bigl \{ x \in X_n \bigm | d_T(x) \ne d_{T'}(x), \, L_{t,t'}+ 1 \in \{d_T(x), d_{T'}(x)\} \bigr \}, \end{aligned}$$

and let

$$\begin{aligned} \lambda _{t,t'}:= \min \bigl \{ \max (h(T_x), h(T'_x)) \bigm | x \in \varLambda _{t,t'}\bigr \}. \end{aligned}$$

Note that \(\varLambda _{t,t'}\ne \emptyset \) by the definition of \(L_{t,t'}\); hence, \(\lambda _{t,t'}\) is well defined and \(\lambda _{t,t'}\ge 0\).

Example 7.26

For the DFS trees of Fig. 3, it holds that

$$\begin{aligned} \varLambda _{t,t'}= & {} \{x_{14}, x_{18}, x_{19}\}, \\ \lambda _{t,t'}= & {} \min \{ \underbrace{\max (1,1)}_{x_{14}}, \underbrace{\max (2,0)}_{x_{18}}, \underbrace{\max (1,1)}_{x_{19}} \} = \min \{1, 2, 1\} = 1. \end{aligned}$$

Definition 7.27

Let G be a digraph. Let \(\lambda _{G}\) be the largest integer m such that there exist an entryway \(u_0 \rightarrow u_1 \rightarrow \dots \rightarrow u_{E_{G}}\) (of maximal length \(E_{G}\)) to a nontrivial strongly connected component K, a vertex w in K with \(w \rightarrow u_{E_{G}}\) and a walk \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_m\) such that exactly one of the pairs \((w,v_0)\) and \((u_{E_{G}-1},v_0)\) is an edge and the other is not. If there is no upper bound for such numbers m, then define \(\lambda _{G}:= \infty \). If no such number m exists (this holds in particular when \(E_{G}\le 0\)), then define \(\lambda _{G}:= -\infty \).

Example 7.28

In the graph G of Fig. 1, the longest entryway \(e_0 \rightarrow e_1 \rightarrow e_2 \rightarrow e_3 \rightarrow e_4\), the path \(\lambda _0 \rightarrow \lambda _1\), the edges \(v \rightarrow e_4\) and \(v \rightarrow \lambda _0\) and the nonedge \((e_3, \lambda _0)\) witness that \(\lambda _{G}= 1\).

Lemma 7.29

Let \(t, t' \in B_n\), \(t \ne t'\), and let G be a digraph such that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\). Denote \(L := L_{t,t'}\), \(\lambda := \lambda _{t,t'}\). Assume that \(E_{G}= L + 1\), \(u_0 \rightarrow u_1 \rightarrow \dots \rightarrow u_L \rightarrow u_{L+1}\) is an entryway to a nontrivial strongly connected component K, w is a vertex in K with \(w \rightarrow u_{L+1}\), and \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\lambda \) is a walk in G. Then, \(w \rightarrow v_0\) is an edge if and only if \(u_L \rightarrow v_0\) is an edge. (See Fig. 4.) Consequently, \(\lambda _{G}< \lambda _{t,t'}\).

Fig. 4
figure 4

Illustration for Lemma 7.29

Proof

Denote \(M := M_{t,t'}\), \(L := L_{t,t'}\), \(\lambda := \lambda _{t,t'}\). By the definition of \(\lambda \), there exists an element \(x_d \in X_n\) such that \(L + 1 \in \{d_T(x_d), d_{T'}(x_d)\}\), \(d_T(x_d) \ne d_{T'}(x_d)\), and \(\max (h(T_{x_d}), h(T'_{x_d})) = \lambda \). By changing the roles of t and \(t'\) if necessary, we may assume that \(d_T(x_d) = L + 1 < d_{T'}(x_d)\). Let \(x_p\) and \(x_q\) be the parents of \(x_d\) in T and \(T'\), respectively. Then, \(d_T(x_p) = d_T(x_d) - 1 = L\), \(d_{T'}(x_q) = d_{T'}(x_d) - 1 \ge L + 1\) and \(d_{T'}(x_q) = d_{T'}(x_d) - 1 \equiv d_T(x_d) - 1 = L \pmod {M}\).

Denote by W the entryway \(u_0 \rightarrow u_1 \rightarrow \dots \rightarrow u_L \rightarrow u_{L+1}\) and by \(W'\) the walk \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\lambda \). By Lemma 4.8, K is an m-whirl for some divisor m of M. Let C be an m-cycle in K that includes the vertices w and \(u_{L+1}\).

If \((u_L, v_0) \in E(G)\), then let \(W''\) be the walk that extends W with vertices of C to a walk of length h(T), and consider the collapsing map \(\varphi :X_n \rightarrow V(G)\) of \((T,x_d)\) to \((W'',W')\). Observe that \(\varphi (x_q) = w\). (In order to see this, we need to verify that \(x_q \notin T_{x_d}\), \(d_T(x_q) \ge L + 1\) and \(d_T(x_q) \equiv L \pmod {m}\). The condition \(x_q \notin T_{x_d}\) holds because \(q < d\), as \(x_q\) is the parent of \(x_d\) in \(T'\). If \(d_T(x_q) \le L\), then \(d_T(x_q) = d_{T'}(x_q)\) by the definition of L; hence, \(d_{T'}(x_q) \le L\), which is a contradiction because we have seen that \(d_{T'}(x_q) \ge L + 1\). We have also seen that \(d_{T'}(x_q) \equiv L \pmod {M}\), and \(d_T(x_q) \equiv d_{T'}(x_q) \pmod {M}\) by the definition of M. These imply \(d_T(x_q) \equiv L \pmod {M}\), and then \(d_T(x_q) \equiv L \pmod {m}\) follows, as \(m \mathrel {\!|\!}M\).) By Proposition 2.1, \(\varphi \) is a homomorphism \(T' \rightarrow G\), so \((\varphi (x_q), \varphi (x_d)) = (w, v_0) \in E(G)\).

If \((w, v_0) \in E(G)\), then let \(W''\) be the walk that extends W with vertices of C to a walk of length \(h(T')\), and consider the collapsing map \(\varphi ' :X_n \rightarrow V(G)\) of \((T',x_d)\) to \((W'',W')\). Observe that \(\varphi '(x_p) = u_L\). (In order to see this, we need to verify that \(d_{T'}(x_p) = L\). We know that \(d_T(x_p) = L\), so \(d_T(x_p) = d_{T'}(x_p)\) by the definition of L. From this it follows that \(d_{T'}(x_p) = L\).) By Proposition 2.1, \(\varphi '\) is a homomorphism \(T \rightarrow G\), so \((\varphi '(x_p), \varphi '(x_d)) = (u_L, v_0) \in E(G)\). \(\square \)

Remark 7.30

Note that the walk \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\lambda \) in Lemma 7.29 may include vertices in the nontrivial strongly connected component K. In particular, Lemma 7.29 asserts that if G satisfies \(t \approx t'\), \(L := L_{t,t'}\), \(E_G = L + 1\), and \(u_0 \rightarrow u_1 \rightarrow \dots \rightarrow u_L \rightarrow u_{L+1}\) is an entryway, then there is an edge \(u_L \rightarrow v\) for every vertex v in the block B of \(u_{L+1}\) in K. This follows by choosing any vertex w from the predecessor block of B and taking \(v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_\lambda \) to be any walk starting at v and going around K until it reaches length \(\lambda \).

We have established above several necessary conditions for a digraph to satisfy a bracketing identity. We show next that these conditions are also sufficient.

Theorem 7.31

Let G be a digraph, and let \(t, t' \in B_n\) with \(t \ne t'\). Then, \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\) if and only if the following conditions hold:

  1. (i)

    Every nontrivial strongly connected component of G is a whirl.

  2. (ii)

    There is no path from a nontrivial strongly connected component of G to another.

  3. (iii)

    \(M_{G}\mathrel {\!|\!}M_{t,t'}\).

  4. (iv)

    \(P_{G}< H_{t,t'}\).

  5. (v)

    \(E_{G}\le L_{t,t'}+ 1\).

  6. (vi)

    \(O_{G}\le Y_{t,t'}+ 1\).

  7. (vii)

    \(Z_{G}< Z_{t,t'}\).

  8. (viii)

    \(B_{G}< L_{t,t'}\).

  9. (ix)

    \(\omega _{G}(L_{t,t'}+ 1, r) < \omega _{t,t'}(r)\) for all \(r \in \{1, \dots , L_{t,t'}+ 1\}\).

  10. (x)

    If \(E_{G}= L_{t,t'}+ 1\), then \(\lambda _{G}< \lambda _{t,t'}\).

Proof

Denote \(T := G(t)\), \(T' := G(t')\), \(H := H_{t,t'}\), \(M := M_{t,t'}\), \(L := L_{t,t'}\), \(Y := Y_{t,t'}\), \(Z := Z_{t,t'}\), \(\omega := \omega _{t,t'}\), \(\lambda := \lambda _{t,t'}\). The necessity of the conditions is established in previous lemmata: condition (i) follows from Lemma 4.8, (ii) from Lemma 4.9, (iii) and (iv) from Lemma 7.6, (v) from Lemma 7.7, (vi) from Lemma 7.10, (vii) from Lemma 7.16, (viii) from Lemma 7.19, (ix) from Lemma 7.24, and (x) from Lemma 7.29.

For sufficiency, assume that the digraph \(G = (V,E)\) and the bracketings \(t, t' \in B_n\) satisfy the conditions. In order to show that \(\mathbb {A}({G})\) satisfies the identity \(t \approx t'\), it suffices, by Proposition 2.1, to show that a map \(\varphi :X_n \rightarrow V\) is a homomorphism of T into G if and only if it is a homomorphism of \(T'\) into G. So, assume that \(\varphi :X_n \rightarrow V\) is a homomorphism of T into G. We need to verify that \(\varphi \) is a homomorphism of \(T'\) into G.

The image of any path in T under \(\varphi \) is a walk in G. By conditions (ii), (v) and (vi), it is either a pleasant path, or it comprises an entryway (of length at most \(L+1\), possibly 0) to a nontrivial strongly connected component K, followed by a winding walk in K, again followed by an outlet from K (of length at most \(Y+1\), possibly 0). Since T contains a path of length \(h(T) \ge H\), condition (iv) implies that the image of \(\varphi \) contains a vertex belonging to a nontrivial strongly connected component of G.

Our goal is to show that for any edge (ab) of \(T'\), its image \((\varphi (a), \varphi (b))\) is an edge of G. Since T and \(T'\) are identical up to level L, it holds that if (ab) is an edge of \(T'\) with \(d_{T'}(a) < L\), then (ab) is also an edge of T and hence \((\varphi (a), \varphi (b)) \in E(G)\). Therefore, we can focus on edges \((a,b) \in E(T')\) with \(d_{T'}(a) \ge L\).

Let \(x_\ell \in X_n\) be an arbitrary vertex with \(d_{T'}(x_\ell ) = L\). Then, also \(d_T(x_\ell ) = L\) and \(V(T_{x_\ell }) = V(T'_{x_\ell }) = X_{[\ell ,\ell ']}\) for some \(\ell ' \ge \ell \). We will be done if we show that \((\varphi (a), \varphi (b)) \in E(G)\) holds for every edge (ab) of the rooted induced subtree \(T'_{x_\ell }\). The remainder of the proof is a case analysis. The first case distinction is made according to which vertices of \(T_{x_\ell }\), if any, are mapped to nontrivial strongly connected components. Each case leads to several subcases. Figure 5 illustrates several main cases and subcases, showing relevant parts of the tree T and highlighting vertices that are mapped to nontrivial strongly connected components.

Fig. 5
figure 5

Various cases considered in the proof of Theorem 7.31. Hollow vertices are mapped to a nontrivial strongly connected component of G

Case 1: Assume that \(\varphi \) maps no vertex of \(T_{x_\ell }\) to a nontrivial strongly connected component of G. Let \(x_1 =: u_0 \rightarrow u_1 \rightarrow \dots \rightarrow u_L := x_\ell \) be the path from \(x_1\) to \(x_\ell \) in \(T'\) (equivalently, in T). We make a further case distinction on whether any vertex on this path is mapped to a nontrivial strongly connected component.

Case 1.1: Assume that there is an index \(i \in \{0, \dots , L-1\}\) such that \(\varphi (u_i)\) lies in a nontrivial strongly connected component of G. It follows from condition (vi) that \(h(T_{x_\ell }) \le Y\); hence, \(T_{x_\ell } = T'_{x_\ell }\) by the definition of Y. Therefore, \((\varphi (a),\varphi (b))\) is clearly an edge of G for every edge (ab) of \(T'_{x_\ell }\).

Case 1.2: Assume that for all \(i \in \{0, \dots , L-1\}\), \(\varphi (u_i)\) belongs to a trivial strongly connected component. Since the image of \(\varphi \) contains a vertex belonging to a nontrivial strongly connected component of G, there exists an index \(j \in \{0, \dots , L-1\}\) such that \(T_{u_j}\) contains a vertex that is mapped by \(\varphi \) to a nontrivial strongly connected component (at least \(T_{x_1} = T_{u_0}\) satisfies this). Assume that j is the largest such index. By condition (v), \(T_{u_j}\) contains a vertex w such that \(\varphi (w)\) lies in a nontrivial strongly connected component K and \(c := d_T(w) \le L+1\). Let \(x_1 =: v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_c\) be the path from \(x_1\) to w in T; note that \(v_i = u_i\) for all \(i \le j\). Then, \(\varphi (v_0) \rightarrow \varphi (v_1) \rightarrow \dots \rightarrow \varphi (v_c)\) is a walk in G. Continuing this in a suitable way with vertices from K, we obtain a walk of length \(L+1\) in G, the last vertex of which belongs to K. Let then y be a vertex of maximum depth in \(T_{u_{j+1}}\), let \(d := d_T(y)\), and consider the path \(u_0 \rightarrow u_1 \rightarrow \dots \rightarrow u_{j+1} \rightarrow u'_{j+2} \rightarrow \dots \rightarrow u'_d\) from \(x_1\) to y in T. By the choice of j, the walk \(\varphi (u_0) \rightarrow \varphi (u_1) \rightarrow \dots \rightarrow \varphi (u_{j+1}) \rightarrow \varphi (u'_{j+2}) \rightarrow \dots \rightarrow \varphi (u'_d)\) is pleasant. It follows from condition (ix) that \(d < \omega (j+1)\). By the definition of \(\omega \) and \(\varOmega _{t,t'}\) we have \(T_{u_{j+1}} = T'_{u_{j+1}}\) and hence \(T_{x_\ell } = T'_{x_\ell }\), and it follows that \((\varphi (a),\varphi (b)) \in E(G)\) for every edge (ab) of \(T'_{x_\ell }\).

Case 2: Assume that \(\varphi (x_\ell )\) belongs to a nontrivial strongly connected component K of G. By conditions (i) and (iii), K is an m-whirl for a divisor m of M. By condition (ii), \(\varphi \) maps each vertex of \(T_{x_\ell }\) to K or to an outlet from K. Let (ab) be an edge of \(T'_{x_\ell }\). We consider different cases according to whether a and b are mapped to K or not.

Case 2.1: Assume that \(\varphi (a) \notin K\). Then, \(h(T_a) < O_{G}\le Y + 1\) by condition (vi); therefore, \(T_a = T'_a\) by the definition of Y, so \((a,b) \in E(T)\) and hence \((\varphi (a), \varphi (b)) \in E(G)\).

Case 2.2: Assume that \(\varphi (a), \varphi (b) \in K\). Since \(d_T(a) \equiv d_{T'}(a) = d_{T'}(b) - 1 \equiv d_T(b) - 1 \pmod {M}\), the vertices \(\varphi (a)\) and \(\varphi (b)\) lie in consecutive blocks of the m-whirl K. Therefore, \((\varphi (a), \varphi (b)) \in E(G)\).

Case 2.3: Assume that \(\varphi (a) \in K\) and \(\varphi (b) \notin K\). Again by condition (vi), we have \(h(T_b) < O_{G}\le Y + 1\), and therefore, \(T_b = T'_b\). Let c be the parent of b in T; note that \(c \in V(T_{x_\ell })\). If \(c = a\), then \((\varphi (a), \varphi (b)) = (\varphi (c), \varphi (b)) \in E(G)\) and we are done. If \(c \ne a\), then \(h(T_b) \ge Z \ge 0\), so there exists a path \(b =: v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_Z\) in T. Then, \(\varphi (c) \rightarrow \varphi (b) \rightarrow \varphi (v_1) \rightarrow \dots \rightarrow \varphi (v_Z)\) is a walk in G. We must also have \(\varphi (c) \in K\). (Suppose, to the contrary, that \(\varphi (c) \notin K\). Then, \(h(T_c) \le Y\) by condition (vi); hence, \(T_c = T'_c\) by the definition of Y, so (cb) is an edge of both T and \(T'\). This contradicts the fact that a is the unique parent of b in \(T'\).) Moreover, \(d_T(a) \equiv d_{T'}(a) = d_{T'}(b) - 1 \equiv d_T(b) - 1 = d_T(c) \pmod {M}\). Therefore, \(\varphi (a)\) and \(\varphi (c)\) belong to the same block of the m-whirl K, and it now follows from condition (vii) that \((\varphi (a), \varphi (b)) \in E(G)\).

Case 3: Assume that \(\varphi \) maps some vertices of \(T_{x_\ell }\) to nontrivial strongly connected components of G but \(\varphi (x_\ell )\) belongs to a trivial strongly connected component. If v is a vertex of \(T_{x_\ell }\) such that \(\varphi (v) \in K\), where K is a nontrivial strongly connected component, and \(x_1 =: u_0 \rightarrow u_1 \rightarrow \dots \rightarrow u_L \rightarrow \dots \rightarrow u_q := v\) is the path from \(x_1\) to v in T, then \(\varphi (u_i) \in K\) for all \(i \in \{L+1, \dots , q\}\) by conditions (ii) and (v). Together with condition (viii), this implies that if v and \(v'\) are vertices of \(T_{x_\ell }\) such that \(\varphi (v) \in K\), \(\varphi (v') \in K'\), where K and \(K'\) are nontrivial strongly connected components, then \(K = K'\). So, let us assume that K is the unique nontrivial strongly connected component with nonempty intersection with \(\varphi (V(T_{x_\ell }))\). By conditions (i) and (iii), K is an m-whirl for a divisor m of M. Moreover, \(\varphi (u_0) \rightarrow \varphi (u_1) \rightarrow \dots \rightarrow \varphi (u_{L+1})\) is an entryway of length \(L+1\), so condition (v) implies \(E_{G}= L + 1\). Now condition (x) in turn implies \(\lambda _{G}< \lambda \).

Let \(x_r \in V(T'_{x_\ell })\) with \(d_{T'}(x_r) = L + 1\), i.e., \(x_r\) is a child of \(x_\ell \) in \(T'\), and let \(x_\ell =: v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_z := x_r\) be the path from \(x_\ell \) to \(x_r\) in T. We are going to show that \((\varphi (x_\ell ),\varphi (x_r)) \in E(G)\) and that \((\varphi (a),\varphi (b)) \in E(G)\) for every edge (ab) of \(T'_{x_r}\). Since \(x_r\) was chosen arbitrarily among the children of \(x_\ell \), this will cover all edges of \(T'_{x_\ell }\) and we will be done. We consider different possibilities.

Case 3.1: Assume that \(\varphi (x_r) \notin K\).

Case 3.1.1: Assume that \(\varphi (v_i) \in K\) for some \(i \in \{1, \dots , z-1\}\). Then, necessarily \(z > 1\); hence, \(d_T(x_r) > L + 1\). In particular, \(\varphi (v_1) \in K\) by condition (v) and \(\varphi (x_r)\) lies on an outlet, so \(h(T_{x_r}) \le Y\) by condition (vi). Consequently, \(T_{x_r} = T'_{x_r}\) by the definition of Y; therefore, \((\varphi (a),\varphi (b)) \in E(G)\) for every edge (ab) of \(T'_{x_r}\). It remains to show that \((\varphi (x_\ell ),\varphi (x_r)) \in E(G)\).

Observe that also \(\varphi (v_{z-1}) \in K\). (Suppose, to the contrary, that \(\varphi (v_{z-1}) \notin K\). Then, a similar argument as above shows that \(T_{v_{z-1}} = T'_{v_{z-1}}\). Recall that the parent of \(x_r\) in \(T'\) is \(x_\ell \). Since \(z > 1\), we must have \(v_{z-1} \ne x_\ell \). Consequently, \((v_{z-1}, x_r) \notin E(T'_{v_{z-1}})\), which contradicts the fact that \((v_{z-1}, x_r) \in E(T_{v_{z-1}}) = E(T'_{v_{z-1}})\).)

This means that

$$\begin{aligned} d_T(v_{z-1})&= d_T(x_r) - 1 \equiv d_{T'}(x_r) - 1 = d_{T'}(x_\ell ) \\&= L = d_T(x_\ell ) = d_T(v_1) - 1 \pmod {M}, \end{aligned}$$

so \(\varphi (v_{z-1})\) and \(\varphi (v_1)\) lie on consecutive blocks of K. Since \(d_{T'}(x_r) = L + 1 < d_T(x_r)\) and \(T_{x_r} = T'_{x_r}\), we have \(\lambda \le \max (h(T_{x_r}), h(T'_{x_r})) = h(T_{x_r})\) by the definition of \(\lambda \). Therefore, there exists a path \(x_r \rightarrow y_1 \rightarrow \dots \rightarrow y_\lambda \) in T, and its image \(\varphi (x_r) \rightarrow \varphi (y_1) \rightarrow \dots \rightarrow \varphi (y_\lambda )\) is a walk of length \(\lambda \) in G. Since \(\varphi (x_1) \rightarrow \dots \rightarrow \varphi (x_\ell ) \rightarrow \varphi (v_1)\) is an entryway of length \(L+1 = E_{G}\) and we have edges \((\varphi (v_{z-1}), \varphi (v_1)), (\varphi (v_{z-1}), \varphi (x_r)) \in E(G)\), the inequality \(\lambda _{G}< \lambda \) implies \((\varphi (x_\ell ), \varphi (x_r)) \in E(G)\), as desired.

Case 3.1.2: Assume that \(\varphi (v_i) \notin K\) for all \(i \in \{1, \dots , z-1\}\). Then, actually \(\varphi (x) \notin K\) for every vertex \(x \in V(T_{v_1})\) (for, if there were \(x \in V(T_{v_1})\) such that \(\varphi (x) \in K\), then, since \(d_T(v_1) = L + 1 = E_{G}\), we would have \(\varphi (v_1) \in K\), a contradiction). There is, however, an edge \((x_\ell , y)\) in T with \(\varphi (y) \in K\), so condition (ix) implies that \(d_T(v_1) + h(T_{v_1}) \le \omega _{G}(L+1,L+1) < \omega (L+1)\) because \(d_T(v_1) = L+1\). It follows from the definition of \(\omega (L+1)\) that \((d_T(v_1), h(T_{v_1})) \notin \varOmega _{t,t'}\); hence, \(T_{v_1} = T'_{v_1}\). We have \(x_r \in V(T_{v_1})\). The only rooted induced subtrees of \(T'_{x_\ell }\) containing the vertex \(x_r\) are \(T'_{x_r}\) and \(T'_{x_\ell }\); hence, \(v_1 = x_r\) or \(v_1 = x_\ell \). The case \(v_1 = x_\ell \) is impossible because \(v_1\) is the vertex following \(x_\ell \) on the path from \(x_\ell \) to \(x_r\) in T; therefore, \(v_1 = x_r\). Then, \((\varphi (x_\ell ), \varphi (x_r)) = (\varphi (x_\ell ), \varphi (v_1)) \in E(G)\). Furthermore, \(T_{v_1} = T'_{v_1}\) implies that \((\varphi (a), \varphi (b)) \in E(G)\) for every edge (ab) of \(T'_{v_1} = T'_{x_r}\).

Case 3.2: Assume that \(\varphi (x_r) \in K\). Then, \(\varphi (v_i) \in K\) for all \(i \in \{1, \dots , z\}\). We have

$$\begin{aligned} d_T(x_r) \equiv d_{T'}(x_r) = d_{T'}(x_\ell ) + 1 = d_T(x_\ell ) + 1 = d_T(v_1) \pmod {M}, \end{aligned}$$

so \(\varphi (x_r)\) and \(\varphi (v_1)\) are in the same block \(B_i\) of K. Let w be a vertex in the predecessor block \(B_{i-1}\); then, \(w \rightarrow \varphi (x_r)\) and \(w \rightarrow \varphi (v_1)\) are edges. Since \(\varphi (x_1) \rightarrow \dots \rightarrow \varphi (x_\ell ) \rightarrow \varphi (v_1)\) is an entryway of length \(L+1 = E_{G}\) and since there certainly exists a walk of length \(\lambda \) starting from \(\varphi (x_r)\) (just walk along vertices of K), the inequality \(\lambda _{G}< \lambda \) implies that \((\varphi (x_\ell ), \varphi (x_r)) \in E(G)\).

We are going to show that \(\varphi \) maps \(T'_{x_r}\) homomorphically into G. We go through the vertices in \(T'_{x_r}\) in depth-first-search order, and we show that every edge of \(T'_{x_r}\) is mapped to an edge of G. As we will see, it suffices to go along each branch of \(T'_{x_r}\) only so far until we reach a vertex v such that \(\varphi (v) \notin K\); once such a vertex is reached, the induced subtree rooted at v will automatically be mapped homomorphically into G.

So, let \((a,b) \in E(T'_{x_r})\) and assume that we have already shown that every vertex on the path \(x_r \rightarrow \dots \rightarrow a\) in \(T'\) is mapped into K by \(\varphi \) and every edge along this path is mapped to an edge of G. In particular, \(\varphi (a) \in K\). Let c be the parent of b in T; \((c,b) \in E(T)\). If \(a = c\), then we clearly have \((\varphi (a), \varphi (b)) = (\varphi (c), \varphi (b)) \in E(G)\). Assume from now on that \(a \ne c\). We need to consider several cases.

Case 3.2.1: Assume that \(\varphi (b) \in K\). Then, \(d_T(a) \equiv d_{T'}(a) = d_{T'}(b) - 1 \equiv d_T(b) - 1\), that is, \(\varphi (a)\) and \(\varphi (b)\) lie in consecutive blocks of K; then, clearly \((\varphi (a), \varphi (b)) \in E(G)\).

Case 3.2.2: Assume that \(\varphi (b) \notin K\).

Case 3.2.2.1: Assume that \(\varphi (c) \in K\). Then, \(\varphi (b)\) lies in an outlet, so \(h(T_b) \le Y\), whence \(T_b = T'_b\). Since \(a \ne c\), we have \(h(T_b) \ge Z \ge 0\) by the definition of Z, so G has an outlet of length at least \(Z + 1\) starting with \(\varphi (c) \rightarrow \varphi (b) \rightarrow \cdots \). Moreover, \(d_T(c) = d_T(b) - 1 \equiv d_{T'}(b) - 1 = d_{T'}(a) \equiv d_T(a) \pmod {M}\), so \(\varphi (a)\) and \(\varphi (c)\) are in the same block of K. Now it follows from condition (vii) that \((\varphi (a), \varphi (b)) \in E(G)\). From \(T_b = T'_b\) it follows that \(\varphi \) maps all edges of the subtree \(T'_b\) to edges of G.

Case 3.2.2.2: Assume that \(\varphi (c) \notin K\). We claim that \(c = x_\ell \). Suppose, to the contrary, that the path \(x_\ell =: y_0 \rightarrow y_1 \rightarrow \dots \rightarrow y_p := c\) from \(x_\ell \) to c in T has length \(p \ge 1\). Then, \(\varphi (y_i) \notin K\) for all \(i \in \{0, 1, \dots , p\}\) (otherwise \(\varphi (c)\) would lie in an outlet, so \(h(T_c) \le Y\), whence \(T_c = T'_c\), which is clearly a contradiction since (cb) is an edge in T but not in \(T'\)). In fact, \(\varphi (x) \notin K\) for all \(x \in V(T_{y_1})\) by condition (v). Recall the path \(x_\ell =: v_0 \rightarrow v_1 \rightarrow \dots \rightarrow v_z := x_r\) in T. Since \(\varphi (x_\ell ) \notin K\), \(\varphi (x_r) \in K\), and \(d_T(v_1) = L + 1\), condition (v) implies \(\varphi (v_1) \in K\). Then, condition (ix) implies that \(d_T(y_1) + h(T_{y_1}) \le \omega _{G}(L+1,L+1) < \omega (L+1)\); hence, \((d_T(y_1), h(T_{y_1})) \notin \varOmega _{t,t'}\), so \(T_{y_1} = T'_{y_1}\). Since (cb) is an edge in \(T_{y_1}\), this implies that (cb) is also an edge of \(T'\), a contradiction.

Since \(c = x_\ell \), we have \(d_T(b) = L + 1\). Since \(\varphi (b) \notin K\), condition (v) implies that \(\varphi (x) \notin K\) for all \(x \in V(T_b)\). Using again the fact that \(x_\ell \rightarrow v_1\) is an edge of T, \(\varphi (v_1) \in K\), and \(d_T(v_1) = L + 1\), condition (ix) implies \(d_T(b) + h(T_b) \le \omega _{G}(L+1,L+1) < \omega (L+1)\); hence, \((d_T(b), h(T_b)) \notin \varOmega _{t,t'}\), so \(T_b = T'_b\). On the other hand, \(d_{T'}(b) > L + 1\). Therefore, \(\lambda \le \max (h(T_b), h(T'_b)) = h(T_b)\) by the definition of \(\lambda \), so there is a path of length \(\lambda \) starting at \(\varphi (b)\). Furthermore, \(d_T(a) \equiv d_{T'}(a) = d_{T'}(b) - 1 \equiv d_T(b) - 1 = d_T(c) = L = d_T(v_1) - 1 \pmod {M}\), so \(\varphi (a)\) and \(\varphi (v_1)\) lie in consecutive blocks of K, that is, \(\varphi (a) \rightarrow \varphi (v_1)\) is an edge. Now the inequality \(\lambda _{G}< \lambda \) implies that \((\varphi (a), \varphi (b)) \in E(G)\). From \(T_b = T'_b\) it follows that \(\varphi \) maps all edges of the subtree \(T'_b\) to edges of G.

This exhausts all cases, and we conclude that \(\varphi \) is a homomorphism of \(T'\) to G. Switching the roles of T and \(T'\), the same argument shows that every homomorphism of \(T'\) to G is a homomorphism of T to G. Proposition 2.1 now yields \(\mathbb {A}({G}) \models t \approx t'\). \(\square \)

3 Special cases

As an illustration of the parameters and results of the previous section, we now present how some of the main results of Part I can be derived as special cases of Theorem 7.31. When restricted to undirected graphs, Theorem 7.31 is reduced to the following proposition, which together with Lemma 3.1 leads to Theorem 3.3.

Proposition 8.1

Let G be an undirected graph.

  1. (i)

    If every connected component of G is either trivial or a complete graph with loops, then \(\mathbb {A}({G})\) satisfies every bracketing identity.

  2. (ii)

    If every connected component is either trivial, a complete graph with loops, or a complete bipartite graph, and the last case occurs at least once, then G satisfies a nontrivial bracketing identity \(t \approx t'\) if and only if \(M_{t,t'}\) is even.

  3. (iii)

    Otherwise G satisfies no nontrivial bracketing identity.

Proof

The strongly connected components of an undirected graph are just its connected components, and every symmetric edge is part of a cycle. Therefore, an undirected graph G has no pleasant path of nonzero length and consequently no entryway nor outlet of nonzero length; thus, \(P_{G}\le 0\), \(E_{G}\le 0\), \(O_{G}\le 0\). It also clearly holds that \(B_{G}= -\infty \), \(\lambda _{G}= -\infty \), and \(\omega _{G}(\ell ,r) = -\infty \) for all \(\ell , r \in \mathbb {N}\) with \(\ell \ge r \ge 1\). The only whirls with symmetric edges are 1-whirls (i.e., complete graphs with loops) and 2-whirls (i.e., complete bipartite graphs). From this it also easy to see that \(Z_{G}= -\infty \),

For this reason, condition (ii) of Theorem 7.31 is automatically satisfied, and conditions (iv)–(x) obviously hold for any \(t, t' \in B_n\) with \(t \ne t'\). Therefore, it is only conditions (i) and (iii) that matter.

Consider first the case that every nontrivial connected component of G is a 1-whirl. Then, \(M_{G}= 1\). Since \(1 \mathrel {\!|\!}M_{t,t'}\) for any \(t, t' \in B_n\), \(t \ne t'\), it holds that \(\mathbb {A}({G})\) satisfies every bracketing identity.

Consider now the case that every nontrivial connected component of G is a 1-whirl or a 2-whirl and at least one of the components is a 2-whirl. Then, \(M_{G}= 2\), so \(\mathbb {A}({G})\) satisfies a nontrivial bracketing identity \(t \approx t'\) if and only if \(2 \mathrel {\!|\!}M_{t,t'}\).

Finally, in the case when G has a nontrivial connected component that is not a whirl, \(\mathbb {A}({G})\) satisfies no nontrivial bracketing identity. \(\square \)

A characterization of associative digraphs (i.e., digraphs satisfying \(x_1 (x_2 x_3) \approx (x_1 x_2) x_3\)) equivalent to Proposition 4.1 is obtained as a special case of Theorem 7.31.

Proposition 8.2

Let G be a digraph. Then, \(\mathbb {A}({G})\) satisfies the identity \(x_1 (x_2 x_3) \approx (x_1 x_2) x_3\) if and only if the nontrivial strongly connected components of G are complete graphs with loops, and for every vertex \(v \in V(G)\), the outneighbourhood of v is a nontrivial strongly connected component.

Proof

Denote \(t := x_1 (x_2 x_3)\) and \(t' := (x_1 x_2) x_3\). It is straightforward to verify that this pair of bracketings has the following parameters (see Figure 5 of Part I):

$$\begin{aligned} H_{t,t'}&= 1, \quad L_{t,t'}= 0, \quad M_{t,t'}= 1, \quad Y_{t,t'}= -1, \quad Z_{t,t'}= 0, \\ \varOmega _{t,t'}&= \{(0,2), (0,1), (1,1), (1,0)\}, \quad \omega _{t,t'}= (1,1,\dots ), \\ \varLambda _{t,t'}&= \{x_3\}, \quad \lambda _{t,t'}= 0. \end{aligned}$$

With these parameters, the conditions of Theorem 7.31 for \(\mathbb {A}({G})\) to satisfy the identity \(t \approx t'\) are reduced to the following:

  1. (i)

    Every nontrivial strongly connected component of G is a whirl.

  2. (ii)

    There is no path from a nontrivial strongly connected component of G to another.

  3. (iii)

    \(M_{G}= 1\).

  4. (iv)

    \(P_{G}\le 0\).

  5. (v)

    \(E_{G}\le 1\). (This follows already from (iv).)

  6. (vi)

    \(O_{G}\le 0\).

  7. (vii)

    \(Z_{G}= -\infty \). (This is also a consequence of (i) and (vi).)

  8. (viii)

    \(B_{G}= -\infty \). In view of conditions (iv) and (vi), this means that all outneighbours of a vertex belong to the same nontrivial strongly connected component.

  9. (ix)

    \(\omega _{G}(1,1) = -\infty \). (This is also a consequence of (iv) and (vi).)

  10. (x)

    If \(E_{G}= 1\), then \(\lambda _G = -\infty \). This means that for any vertex v belonging to a trivial strongly connected component, if (vu) is an edge, then (vw) is an edge for all vertices w in the strongly connected component of u.

The above conditions are easily seen to be equivalent to the following: the nontrivial strongly connected components of G are complete graphs with loops, and for every vertex \(v \in V(G)\), the outneighbourhood of v is an entire nontrivial strongly connected component. \(\square \)

4 Spectrum dichotomy

Theorem 7.31 provides a necessary and sufficient condition for a graph algebra to satisfy a nontrivial bracketing identity. However, the theorem does not directly give information on the number of distinct term operations of a graph algebra induced by the bracketings of a given size. Although a general description of the associative spectra of digraphs still eludes us, we can find some bounds for the possible associative spectra. In fact, as we will see in Theorem 9.6, the associative spectrum of a graph algebra is either constant at most 2 or it grows exponentially.

In preparation for this dichotomy result, we shall determine the associative spectrum of the graph algebra corresponding to a certain graph on three vertices (see Proposition 9.3).

Lemma 9.1

For \(n\ge 2\) let \(R_n\) be the set of words \(\rho \) of length n over the alphabet \(\{0,1\}\) that satisfy the following three conditions:

  1. (i)

    \(\rho \) does not start with 01,

  2. (ii)

    \(\rho \) does not end with 10,

  3. (iii)

    \(\rho \) does not contain 101.

Then, \(|{R_n}|\) is asymptotically \(\Theta (\alpha ^n)\),Footnote 1 where \(\alpha \approx 1.755\) is the unique positive root of the polynomial \(x^4 - x^3 - x^2 - 1\).

Proof

It is straightforward to verify that the map \(\psi \) defined by the following formula is a bijection from \(R_{n-1} \cup R_{n-2} \cup R_{n-4}\) to \(R_n\) for all \(n \ge 6\):

$$\begin{aligned} \psi (\rho ) = {\left\{ \begin{array}{ll} \rho 1, &{} \text {if }\rho \in R_{n-1}, \\ \rho 00, &{} \text {if }\rho \in R_{n-2}, \\ \rho 1000, &{} \text {if }\rho \in R_{n-4}. \end{array}\right. } \end{aligned}$$

Thus, we have the recurrence relation \(|{R_n}| = |{R_{n-1}}| + |{R_{n-2}}| + |{R_{n-4}}|\). The characteristic polynomial of this linear recurrence is \(x^4 - x^3 - x^2 - 1\), and its roots are

$$\begin{aligned} \alpha \approx 1.755, \quad \beta \approx 0.123 + 0.745i, \quad \gamma \approx 0.123 - 0.745i, \quad \delta = -1. \end{aligned}$$

Therefore, \(|{R_n}| = a \cdot \alpha ^n + b \cdot \beta ^n + c \cdot \gamma ^n + d \cdot \delta ^n\) for suitable complex numbers abcd. Since \(\alpha \) is the only characteristic root of absolute value greater than one, the dominant term is \(a \cdot \alpha ^n\); hence, we have \(|{R_n}| = \Theta (\alpha ^n)\). \(\square \)

Remark 9.2

The sequence of values \(|{R_n}|\) appears as sequence A005251 in the OEIS [6].

Proposition 9.3

The associative spectrum \(s_n\) of the graph algebra corresponding to the graph G given by \(V(G) = \{u,v,w\}\), \(E(G) = \{(u,v),(u,w),(w,w)\}\) is \(s_n = |{R_{n-1}}|\) for all \(n \ge 3\). Hence, \(s_n\) is asymptotically \(\Theta (\alpha ^n)\).

Proof

For any DFS tree T of size \(n \ge 3\), a map \(\varphi :X_n \rightarrow \{u,v,w\}\) is a homomorphism of T into G if and only if either \(\varphi (X_n) = w\), or \(\varphi (x_1) = u\) and all vertices mapped to v are leaves of depth one in T:

$$\begin{aligned} \forall p \in X_n :\varphi (p) = v \implies d_{T}(p) = 1 \text { and } h(T_p) = 0. \end{aligned}$$

By Proposition 2.1, this implies that \(\mathbb {A}({G})\) satisfies a bracketing identity \(t \approx t'\) if and only if the corresponding DFS trees G(t) and \(G(t')\) have the same leaves on level one. Thus, \(s_n\) counts the number of subsets of \(S \subseteq \{x_2, \dots , x_n\}\) that can occur as the set of “depth-one leaves” of a DFS tree of size n. We claim that such sets S are characterized by the following three conditions:

  1. (a)

    if \(x_3 \in S\), then \(x_2 \in S\);

  2. (b)

    if \(x_{n-1} \in S\), then \(x_n \in S\);

  3. (c)

    if \(x_i, x_{i+2} \in S\), then \(x_{i+1} \in S\) for all \(2 \le i \le n - 2\).

It is clear that these conditions are necessary. Conversely, assume that \(S = \{x_{i_1}, \dots , x_{i_s}\} \subseteq \{x_2, \dots , x_n\}\) with \(2 \le i_1< \dots < i_s \le n\) satisfies the three conditions above. Let us construct a DFS tree T of size n as follows. For each \(x_{i_k} \in S\), let \(x_{i_k}\) be a child of the root \(x_1\), and let \(x_{i_k}\) have no children. If \(k < s\) and \(i_{k+1} > i_k+1\), then let \(x_{i_k+1}\) be also a child of \(x_1\), and let \(x_{i_k+2}, \dots , x_{i_{k+1}-1}\) be the children of \(x_{i_k+1}\). Note that condition (c) guarantees that this is a nonempty set of children; hence, \(x_{i_k+1}\) is not a leaf. In addition, if \(x_2 \notin S\) (i.e., \(i_1 > 2\)), then let \(x_2\) be a child of \(x_1\), and let \(x_3, \dots , x_{i_1-1}\) be the children of \(x_2\). Again, condition (a) ensures that at least \(x_3\) will be a child of \(x_2\); hence, \(x_2\) is not a leaf in this case. Similarly, if \(x_n \notin S\) (i.e., \(i_s < n\)), then let \(x_{i_s+1}\) be a child of \(x_1\), and let \(x_{i_s+2}, \dots , x_n\) be the children of \(x_{i_s+1}\). Condition (b) guarantees that \(x_{i_s+1}\) is not a leaf. This construction yields a DFS tree T whose depth-one leaves are exactly the elements of S.

If we encode a set \(S \subseteq \{x_2, \dots , x_n\}\) by a word \(\chi \in \{0,1\}^{n-1}\) in a standard way (i.e., \(\chi _i = 1\) if and only if \(i + 1 \in S\)), then conditions (a)–(c) translate to conditions (i)–(ii) of Lemma 9.1. Thus, we can conclude that \(s_n = |{R_{n-1}}| = \Theta (\alpha ^n)\). \(\square \)

Lemma 9.4

For \(n > 1\), the number of DFS trees on n vertices of height at most 2 is \(2^{n-2}\).

Proof

The depth sequence of a DFS tree on n vertices of height at most 2 is clearly an element of \(\{0\} \times \{1\} \times \{1,2\}^{n-2}\), because the root \(x_1\) is the only vertex at depth 0, \(x_2\) must have depth 1, and the remaining vertices may have depth 1 or 2. Conversely, every tuple \((d_1, d_2, \dots , d_n) \in \{0\} \times \{1\} \times \{1,2\}^{n-2}\) is a zag sequence and hence a depth sequence of some DFS tree by Proposition 2.6. The claim now follows, since DFS trees are uniquely determined by their depth sequences by Proposition 2.5, and \(|{\{0\} \times \{1\} \times \{1,2\}^{n-2}}| = 2^{n-2}\). \(\square \)

Lemma 9.5

Let \(\sim \) be the equivalence relation on \(B_n\) that relates t and \(t'\) if and only if \(T: = G(t)\) and \(T' := G(t')\) coincide up to level one, i.e.,

$$\begin{aligned} \forall p \in X_n :d_{T}(p) = 1 \iff d_{T'}(p) = 1. \end{aligned}$$

Then, \(|{B_n/{\sim }}| = 2^{n-2}\) for \(n \ge 2\).

Proof

We need to count sets \(S\subseteq \{x_2,\dots ,x_n\}\) that can occur as the set of depth-one vertices of a DFS tree of size n. Clearly, \(x_2 \in S\) holds for such sets. We claim that this condition is also sufficient. Indeed, let \(S = \{x_{i_1}, \dots , x_{i_s}\} \subseteq \{x_2, \dots , x_n\}\) with \(2 = i_1< \dots < i_s \le n\), and let us construct a DFS tree T as follows. For each \(x_{i_k} \in S\), let \(x_{i_k}\) be a child of the root \(x_1\), and let \(x_{i_k+1}, \dots , x_{i_{k+1}-1}\) be the children of \(x_{i_k}\) (it is possible that this is an empty set of children). Then, the depth-one vertices of T are exactly the elements of S. We can conclude that \(|{B_n/{\sim }}|\) is the number of subsets of \(\{x_2, \dots , x_n\}\) that contain \(x_2\), and this is obviously \(2^{n-2}\). \(\square \)

By a directed bipartite graph we mean a bipartite graph \(G = (V,E)\) with bipartition \(V = V_1 \cup V_2\) such that \(E \subseteq V_1 \times V_2\) (i.e., all edges go to the “same direction”). The weakly connected components of a digraph G are its induced subgraphs on (the vertex sets of) the connected components of the underlying undirected graph of G.

Theorem 9.6

For any digraph G, we have the following three mutually exclusive cases.

  1. (i)

    The associative spectrum of \(\mathbb {A}({G})\) is constant 1. These digraphs are characterized in Proposition 4.1 or, equivalently, in Proposition 8.2.

  2. (ii)

    The associative spectrum of \(\mathbb {A}({G})\) is constant 2. This holds if and only if each weakly connected component of G is either associative or a directed bipartite graph with at least one edge, and the latter occurs at least once.

  3. (iii)

    In all other cases the associative spectrum of \(\mathbb {A}({G})\) is bounded below by the spectrum of the graph given in Proposition 9.3, i.e., \(s_n(\mathbb {A}({G})) \ge |{R_{n-1}}| = \Theta (\alpha ^n)\) (cf. Lemma 9.1).

Proof

Let G be an arbitrary digraph, and let \(s_n = s_n(\mathbb {A}({G}))\) denote the associative spectrum and \(\sigma _n = \sigma _n(\mathbb {A}({G}))\) denote the fine associative spectrum of the corresponding graph algebra. Let us assume that \(s_n\) does not grow exponentially. Then, G satisfies conditions (i) and (ii) of Theorem 7.31 (otherwise the associative spectrum would consist of the Catalan numbers). If \(M_{G}\ge 2\), then G contains an induced subgraph that is isomorphic to the directed cycle \({\mathsf {C}}_{m}\) for some \(m \ge 2\); hence, \(s_n \ge s_n({\mathsf {C}}_{m}) \ge s_n({\mathsf {C}}_{2}) = 2^{n-2}\) by Proposition 5.4 and Remark 5.5, contradicting our assumption on the growth of the spectrum. If \(P_{G}\ge 2\), then condition (iv) of Theorem 7.31 shows that all bracketings corresponding to DFS trees of height at most 2 fall into different equivalence classes of the fine spectrum \(\sigma _n\). Therefore, Lemma 9.4 implies that \(s_n \ge 2^{n-2}\), a contradiction. If \(E_{G}\ge 2\), then by condition (v) of Theorem 7.31, bracketings \(t, t' \in B_n\) fall into different equivalence classes of the fine spectrum whenever the corresponding DFS trees differ at level one. Hence, by Lemma 9.5, we have \(s_n \ge 2^{n-2}\), which is a contradiction again. A similar argument using condition (vi) of Theorem 7.31 and Lemma 5.6 shows that \(O_{G}\ge 1\) also leads to the contradiction \(s_n \ge 2^{n-2}\).

We have proved thus far that if \(\mathbb {A}({G})\) has a subexponential spectrum, then G satisfies conditions (i) and (ii) of Theorem 7.31 and the (in)equalities \(M_{G}= 1\), \(P_{G}\le 1\), \(E_{G}\le 1\), \(O_{G}\le 0\). Let us assume that conditions (i) and (ii) of Theorem 7.31 and these (in)equalities hold, and let \(V_0\) be the union of the vertex sets of the nontrivial strongly connected components of G (if there are any). From \(P_{G}\le 1\), \(E_{G}\le 1\) and \(O_{G}\le 0\) we can see that no vertex of \(V \setminus V_0\) can have an inneighbour and an outneighbour at the same time. Let \(V_1\) be the set of vertices from \(V \setminus V_0\) that have an outneighbour, and let \(V_2 := V \setminus (V_0 \cup V_1)\). Thus, \(V = V_0 \cup V_1 \cup V_2\) (some of these sets might be empty), and the subgraph induced on \(V_1 \cup V_2\) is a directed bipartite graph, whereas the subgraph induced on \(V_0\) is a disjoint union of complete graphs with loops by conditions (i) and (ii) of Theorem 7.31 and by \(M_{G}= 1\). Since \(O_{G}\le 0\), there is no edge from \(V_0\) to \(V_1 \cup V_2\), and there is no edge from \(V_2\) to \(V_0\) by the definition of \(V_2\), but we may have edges from \(V_1\) to \(V_0\).

Let \((v_1, v_0)\) be such an edge (i.e., \(v_1 \in V_1\) and \(v_0 \in V_0\)). If \(v'_0\) is another vertex in the strongly connected component of \(v_0\), then we must have the edge \((v_1, v'_0)\). Indeed, if this was not the case, then subgraph induced on \(\{v_1, v_0, v'_0\}\) would be isomorphic to the graph of Proposition 5.9, and it has an exponential spectrum. (Note that the spectrum of any induced subgraph provides a lower estimate of the spectrum of the whole graph.) On the other hand, if \(v'_0\) belongs to another nontrivial strongly connected component, then the presence of the edge \((v_1, v'_0)\) would give rise to an induced subgraph isomorphic to that of Proposition 5.8, again contradicting our assumption about the subexponential growth of the spectrum. Thus, we have proved that if a vertex of \(V_1\) has outneighbours in \(V_0\), then these outneighbours form a nontrivial strongly connected component.

Finally, if a vertex \(v_1 \in V_1\) has an outneighbour \(v_0 \in V_0\) and also an outneighbour \(v_2 \in V_2\), then the subgraph induced on \(\{v_1, v_2, v_0\}\) is isomorphic to the graph of Proposition 9.3, forcing again an exponential spectrum. Thus, some vertices of \(V_1\) have outneighbours only in \(V_0\), while others have outneighbours only in \(V_2\). The former vertices together with \(V_0\) form an associative graph (see Proposition 8.2), while the latter vertices together with \(V_2\) form a directed bipartite graph. This proves that every digraph with a subexponential associative spectrum belongs to cases (i) or (ii) of the current theorem.

It only remains to prove that the spectrum of a directed bipartite graph with at least one edge is constant 2. But this is easily done with the help of Theorem 7.31. All conditions except for (iv) are satisfied trivially for all \(t, t' \in B_n\) with \(t \ne t'\). Condition (iv) gives \(1 = P_{G}< H_{t,t'}\), which means that \(\sigma _n\) has two equivalence classes: \(\{t\}\) and \(B_n \setminus \{t\}\), where \(t = ((\cdots ((x_1 x_2) x_3) \cdots ) x_{n-1}) x_n\) is the bracketing that corresponds to the unique DFS tree of size n and height 1. \(\square \)

Remark 9.7

Theorem 9.6 implies that there are only two different bounded spectra of graph algebras, namely constant 1 and constant 2. For arbitrary groupoids, all sequences of the form \((2, \dots , 2, 1, 1, \dots )\) can occur as associative spectra, and there are other bounded spectra (e.g., constant 3), too [1]. Theorem 9.6 also implies that unbounded spectra of graph algebras grow exponentially, the smallest growth rate being \(\Theta (\alpha ^n)\). This is not true for arbitrary groupoids either: there exist groupoids with polynomial spectra of arbitrary degrees [3].

5 Open problems and directions for further research

We conclude this paper with a few open problems and possible directions for further research.

  1. 1.

    Theorem 7.31 characterizes the graph varieties (in the sense of Pöschel [4]) defined by bracketing identities. Natural questions about them arise. For example, can we find generators for such graph varieties? Is a graph variety definable by a set of bracketing identities definable by a finite set of bracketing identities, or even by a single bracketing identity?

  2. 2.

    It follows from the characterization of graph varieties (see Pöschel [4]) that the associative spectrum of a digraph G is bounded below by the spectrum of any induced subgraph, any strong homomorphic image, and any direct power of G. How is the associative spectrum affected by other graph constructions, such as formation of graph minors?

  3. 3.

    Could the results on bracketing identities be adapted to other kinds of identities? A case that looks similar and might be doable is that of identities in which each term is linear, i.e., every variable occurs exactly once, but the order of variables is not specified.

  4. 4.

    Let us call two graphs equivalent if all of their parameters (listed in the second column of Table 1) coincide. By Theorem 7.31, the graph algebras of equivalent graphs have the same (fine) associative spectrum. Is the converse true? If negative, are there infinitely many equivalence classes of graphs with the same spectrum?

  5. 5.

    Find a canonical representative in each equivalence class of graphs that is in some sense the simplest, smallest, or nicest. It would then suffice to study the spectra of these graphs.

  6. 6.

    Is it true that for every graph G there exists a finite graph \(G'\) such that \(\mathbb {A}({G})\) and \(\mathbb {A}({G'})\) have the same associative spectrum?

  7. 7.

    Are there uncountably many different associative spectra of graph algebras? (A positive answer to the previous question would give a negative answer to this one.) The graph parameters are elements of \(\mathbb {N}\cup \{\infty , -\infty \}\) except for \(\omega _{G}\), so it is only the parameter \(\omega _{G}\) that may permit uncountably many equivalence classes.