An introduction to diagram groups

To every semigroup presentation $\mathcal{P}= \langle \Sigma \mid \mathcal{R} \rangle$ and every baseword $w \in \Sigma^+$ can be associated a diagram group $D(\mathcal{P},w)$, defined as the fundamental group of the so-called Squier complex $S(\mathcal{P},w)$. Roughly speaking, $D(\mathcal{P},w)$ encodes the lack of asphericity of $\mathcal{P}$. Examples of diagram groups include Thompson's group $F$, the lamplighter group $\mathbb{Z} \wr \mathbb{Z}$, the pure planar braid groups, and various right-angled Artin groups. This survey aims at summarising what is known about the family of diagram groups.


Introduction
Defined by J. Meakin and M. Sapir (unpublished), and first investigated by V. Kilibarda in her thesis [Kil97], diagram groups have been mainly promoted by V. Guba and M. Sapir, in particular through their monograph [GS97]. Since then, many articles have been dedicated to the understanding of which groups can be described as (subgroups of) diagram groups and which properties can be deduced from such a description. Perspectives on the subject include computational problems such that the word, conjugacy, and commutation problems [GS97,GS99], finiteness properties [Far03], homology [GS06a], orderability [Wie03,GS06b], median geometry [Far03,Gen18,Gen19a], Hilbertian geometry [AGS06], negatively curved geometry [Gen17b,Gen20].
In this survey, our goal is to organise in a coherent and essentially self-contained way what is known about the family of diagram groups.
In Section 2, we first present three different, but equivalent, descriptions of diagram groups: as a way to encode the lack of asphericity of a semigroup presentation (Section 2.1); as a two-dimensional analogue of free groups, where words are replaced with diagrams over semigroup presentations (Section 2.2); and finally as second fundamental groups of directed 2-complexes (Section 2.3). Next, we record explicit examples of diagram groups in Section 2.4, including Thompson's group F , its commutator subgroup F , the lamplighter group Z Z, the pure planar braid groups, and various right-angled Artin groups. Most properties satisfied by diagram groups are listed in Section 2.5, sometimes accompanied with ideas of proofs. Section 3, we are mainly concerned with algorithmic and computational aspects of diagrams. In Section 3.1, we show how one can compute efficiently presentations of diagram groups. Sections 3.2 and 3.3 essentialy deal with the combinatorics of semigroup diagrams, with a focus on the conjugacy problem in Section 3.2 and on centralisers in Section 3.3. In Section 3.4, we show how to determine efficiently whether an element of a diagram group belongs to the commutator subgroup. Finally, in Section 3.5, we exploit the point of view given by directed 2-complexes in order to adapt the well-known foldings of Stallings from free groups to diagram groups. This allows us to solve the membership problem for some specific subgroups.
In Section 4, we consider diagram groups from a more geometric perspective. After a crash course on median geometry in Section 4.1, we show in Section 4.2 that diagram groups naturally act on median graphs. This geometry allows us to extract some valuable information about diagram groups regarding finiteness properties, once combined with a combinatorial version of Morse theory (Section 4.3); Hilbert space compression (Section 4.4); and acylindrical hyperbolicity (Section 4.6). The structure of hyperplanes in the nonpositively curved cube complexes whose fundamental groups are the diagram groups is studied in Section 4.5, with applications to residual finiteness and subgroup separability. Finally, in Section 4.7, we introduce diagram products, a version of diagram groups with coefficients coming from a family of groups indexed by the alphabet of the underlying semigroup presentation. We show that these products naturally act on quasi-median graphs, and we exploit this geometry in order to extract some information on the structure of diagram products.
We conclude this survey by describing various possible generalisations of diagram groups, most of them already available in the literature (Section 5); and by listing several open questions and problems that we find appealing (Section 6), with the hope that this could motivate future works on diagram groups.

A first taste 2.1 Diagram groups as lack of asphericity
Let P = Σ | R be a semigroup presentation, i.e. an alphabet Σ and a collection of relations R of the form u = v where u, v are positive words written over Σ. In the sequel, we will always assume that R does not contain obvious redundancy, i.e. if u = v is in R we will assume that v = u is not in R. In particular, R does not contains a relation of the form u = u. As an example, we can take P = a, b | ab = ba, a = a 2 .
The presentation P is said to be aspherical if, given two positive words p, q ∈ Σ + representing the same element in the semigroup, there is essentially a unique way to derive q from p by applying relations in R. Depending on the meaning one gives to such a uniqueness, one may obtain distinct notions of asphericity. For instance, the words abba and bab represent the same element in the semigroup given by P = a, b | ab = ba, a = a 2 , a natural derivation being abba → baba → baab → bab.
However, such a derivation is far from being unique. For instance, instead of applying the relation ab = ba to first half of abba and next to the second half, we can apply the relation to the second half of the word and next to the first half: Even worth, we can apply a relation and next undo what we have just did, e.g.
However, we do not consider such variations as being essentially different from our initial derivations. In order to formalise this idea, we use some algebraic topology.
Definition 2.1. Let P = Σ | R be a semigroup presentation. The Squier square complex S(P) is the complex whose vertices are the positive words written over Σ; whose edges [a, u = v, b] connect two words aub and avb if one can be obtained from the other by applying a relation u = v from R; and whose squares [a, u = v, b, p = q, c] bound the 4-cycles given by edges [a, u = v, bpc], [a, u = v, bqc], [aub, p = q, c], [avb, p = q, c]. Then, one says that our presentation P is aspherical if the fundamental group of each connected component of the correspond Squier square complex is trivial. Thus, the fundamental groups of the connected components of S(P) encode the lack of asphericity of P. These groups are our diagram groups.
Definition 2.2. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. The diagram group D(P, w) is the fundamental group π 1 (S(P), w) of the Squier square complex S(P) based at w. This is the shortest definition one can get of diagram groups, and it already allows us to construct examples. For instance, the diagram group given by Figure 1 is a free group of rank two. However, Definition 2.2 does not explain why we are focusing on semigroup presentations instead of monoid or group presentations, and its formulation has nothing to do with diagrams, so the terminology we are using remains mysterious. These points will be clarified in the next section.

Diagrammatic representation
Let P = Σ | R be a semigroup presentation. Given two positive words w 1 , w 2 ∈ Σ + representing the same element in the semigroup given by P a derivation from w 1 to w 2 , or equivalently a path in the Squier complex S(P) from w 1 to w 2 , can be encoded by a diagram over P. For instance, if P = a, b | ab = ba, a = a 2 , then the derivation abba → baba → baab → bab → abb can be represented by the diagram The diagram is constructed as follows. We start with a top path (oriented from left to right) labelled by our initial word abba. The first step abba → baba in our derivation applies the relation ab = ba to the first half of the word abba, so we glue a 2-cell to our path with a boundary which is the disjoint union of a top path ab and a bottom path ba. Similarly, following the second step baba → baab in our derivation, we glue a 2-cell with a boundary which is the disjoint union of a top path ba and a bottom path ab. So far, we have a diagram with two 2-cells, whose top path is labelled by abba, and whose bottom path is labelled by baab. Following the third step baab → bab of our derivation, we glue a 2-cell with a boundary which is the disjoint union of a top bath labelled aa and a bottom path labelled a. Finally, we glue a forth 2-cell corresponding the forth step bab → abb from our derivation.
Formally, a diagram of a semigroup presentation P = Σ | R is a planar oriented graph ∆ whose oriented edges are labelled by letters from Σ such that: • ∆ has a unique source and a unique sink; • the boundary of every cell is a disjoint union of two oriented paths, referred to as the top and bottom paths of the cell; • for every cell, if u and v denote the labels of its top and bottom paths, then u = v or v = u belongs to R.
By definition, a diagram comes with a fixed embedding in the plane. Two diagrams only differing by an isotopy of the plane are considered as identical. In the sequel, orientations of edges in diagrams will be clear from our embeddings (from left to right) so they will not be specified.
Our diagrams are the analogues for semigroups of van Kampen diagrams for groups. In particular, two positive words w 1 , w 2 ∈ Σ + represent the same element of the semigroup given by P if and only if there exists a diagram ∆ over P with top(∆) = w 1 and bot(∆) = w 2 .
Thus, every path in the Squier complex S(P) from some vertex w 1 to another vertex w 2 can be represented by a diagram over P whose top and bottom words respectively are w 1 and w 2 . Notice that two paths can be represented by the same diagram. For instance, the diagram given above also represents the path abba → abab → baab → baba → abb.
Clearly, the paths represented by a given diagram ∆ correspond to the different ways one has to construct ∆ by gluing 2-cells successively. In our example, we can glue the top left cell first and next the top right cell, or we can glue the top right cell first and next the top left cell. These two possibilities correspond to the two paths we gave.
It is worth noticing that that all the paths encoded by a diagram are pairwise homotopic. However, two homotopic paths may not be represented by the same diagram.
In a square complex, two paths in the one-skeleton are homotopy equivalent if and only if one can be obtained from the other by a sequence of elementary moves, namely flipping a square and adding or removing a backtrack. It is clear that flipping a square does not modify the diagram representing our path. However, adding or removing a backtrack does modify the diagram. This motivates the following definition.
Definition 2.3. Let P = Σ | R be a semigroup presentation and ∆ a diagram over P. A dipole in ∆ is the data of two cells π 1 , π 2 ⊂ ∆ such that bot(π 1 ) = top(π 2 ) and such that π 1 , π 2 correspond to a relation of R and its inverse. One reduces the dipole by identifying the paths top(π 1 ) and bot(π 2 ).
For instance, the blue diagram above contains a dipole, namely the two right cells.
Reducing the dipole provides the red diagram. It worth noticing that the diagram associated to a path with a backtrack necessarily contains a dipole. However, the converse is not true, as shown by the blue diagram above.
Proposition 2.4. Let P be a semigroup presentation. Two paths in the Squier complex S(P) having the same endpoints are homotopy equivalent if and only if the diagrams over P representing them have the same reduction.
Here, the reduction of a diagram refers to the diagram obtained after reducing all the dipoles. A priori, the diagram thus obtained could differ depending on the order we following when reducing the dipoles. It turns out not to be the case; see [GS97,Theorem 3.17]. Thus, the reduction of a diagram is well-defined.
Proposition 2.4 immediately implies: Corollary 2.5. Let P be a semigroup presentation. The map that sends a path in S(P) to its diagram over P induces an isomorphism from the fundamental groupoid of S(P) to the diagram groupoid D(P) whose elements are the diagrams over P up to dipole reduction and whose product sends any two diagrams ∆ 1 , ∆ 2 with bot(∆ 1 ), top(∆ 2 ) labelling by the same word to the diagram ∆ 1 • ∆ 2 obtained by gluing ∆ 2 below ∆ 2 .
Here, we think as a groupoid as a set endowed with a product only partially defined but satisfying basically the same axioms as groups: the product, when it is defined, is associative; there are neutral elements (not unique); and every element admits a unique inverse. The example to keep in mind is the fundamental groupoid of a topological space: its elements are the oriented paths up to homotopy and the product between two paths α, β is well-defined when the terminal point of α coincides with the initial vertex point of β in which case the product is just the concatenation of α and β. Neutral elements are single points and the inverse of an element is obtained by reversing the orientation. In D(P), the neutral elements are the diagrams with no 2-cells and the inverse of a diagram is given by its mirror image (along a horizontal axis). As a particular case of Corollary 2.5, given a semigroup presentation P = Σ | R and a baseword w ∈ Σ + , the diagram group D(P, w) can be described as the set of (w, w)diagrams over P (i.e. the diagrams whose top and bottom paths are labelled by w) up to dipole reductions endowed with the concatenation product.

Diagram groups as two-dimensional free groups
There is an analogy between our previous description of diagram groups and the construction of free groups. Elements of free groups are words (which can be thought of as linear objects) up to reductions xx −1 = 1 (corresponding to dipole reductions), which we concatenate together (similarly to concatenations of diagrams). The analogy can be pushed further. In the same way that free groups can be described as fundamental groups of graphs, diagram groups can be described as second fundamental groups of directed 2-complexes. This point of view was developed in [GS06a], and will be crucial in Section 3.5. However, since it will not be essentially used elsewhere and is rather technical, the present section can be skept in a first reading.
Definition 2.6. A directed 2-complex is the data of a directed graph Γ, a set of 2-cells F , two maps top, bot sending each 2-cell to a directed path in Γ, and a map ι : F → F such that: • for every f ∈ F , bot(f ) and top(f ) are non-empty and have common initial and terminal vertices; • ι is a fixed-point free involution satisfying top(ι(f )) = bot(f ) and bot(ι(f )) = top(f ) for every f ∈ F .
For instance, given a semigroup presentation P, a diagram ∆ over P is naturally a directed 2-complex (drawn on the plane). If the top and bottom paths of ∆ have the same label, then one can identify top(∆) with bot(∆) in order to obtain another directed 2-complex (drawn on the sphere).
Mimicking the construction of a cellular 2-complex from a group presentation, one can also associate a directed 2-complex X (P) to our semigroup presentation P = Σ | R . Namely, X (P) has a single vertex, one directed edge for each generator in Σ, and, for each relation u = v in R, we add two 2-cells whose top and bottom paths are respectively labelled by u, v and v, u.
Now, our goal is to define a second fundamental groupoid of a directed 2-complex. Roughly speaking, it is given by homotopy classes of 2-paths (i.e. paths of paths) endowed with the usual concatenation.
Definition 2.7. Let X be a directed 2-complex. A 1-path is a directed path in the underlying directed graph. An elementary transformation of a 1-path α is the replacement of a subsegment β ⊂ α which coincides with the bottom path of some 2-cell π with top(π). A 2-path is a finite sequence of 1-paths such that each 1-paths is obtained from the previous one by an elementary transformation.
One should think of an elementary transformation as pushing a 1-path α through a 2-cell having its bottom path in α. Observe that, given a semigroup presentation P, a 2-path in the directed 2-complex X (P) is naturally encoded by a diagram over P. In other words, the first elementary equivalence tells us that pushing a 1-path through a 2-cell and next through its inverse amounts to doing nothing. The second elementary equivalence tells us that, given two 2-cells π 1 , π 2 having their bottom paths in our 1-path ζ and disjoint, pushing α through π 1 and next through π 2 amounts to pushing α through π 2 and next through π 1 .
As previously mentioned, a 2-path in the directed 2-complex X (P) associated to a semigroup presentation P is naturally encoded by a diagram over P. It should be clear from our definition that any two homotopy equivalent 2-paths are encoded by the same diagram modulo dipole reduction.
Definition 2.9. Let X be a directed 2-complex. The second fundamental groupoid Π 2 (X ) of X is the set of 2-paths up to homotopy equivalence endowed with concatenation. Given a 1-path α, the fundamental group π 2 (X , α) is the set of 2-paths starting and ending at α up to homotopy equivalence endowed with concatenation.
Observe that neutral elements of Π 2 (X ) are 2-paths reduced to single 1-paths, and that the inverse of a 2-path is the same 2-path but read in the reversed order.
Interestingly, second fundamental groups of directed 2-complexes define the same class of groups as diagram groups [GS06a,Theorem 4.3].
Theorem 2.10. For every semigroup presentation P, the map that sends a 2-path in X (P) to the diagram encoding it induces an groupoid isomorphism Π 2 (X (P)) → D(P). Conversely, every directed 2-complex X can be turned into the directed 2-complex associated to a semigroup presentation P such that Π 2 (X ) and D(P) are isomorphic.
The first assertion should be clear from what we already said. We refer to [GS06a] for more information on the second assertion.

Examples of diagram groups
The simplest diagram group is given by the semigroup presentation The connected component S(P, a) containing a of the Squier complex S(P) is just a 3-cycle with vertices a, b, c, so D(P, a) is infinite cyclic. From this example, it is possible to construct new diagram groups by combination.
Proof. Let I be a set. For every i ∈ I, let P i := Σ i | R i be a semigroup presentation and w i ∈ Σ + i a baseword. Without loss of generality, we assume that the alphabets Σ i are pairwise disjoint. Set Then D(Q, o) is isomorphic to the free product * i∈I D(P i , w i ) because S(Q, o) coincides with the disjoint union of the S(P i , w i ) together with the new vertex o which is adjacent to all the w i .
Thus, free groups are diagram groups. By applying the construction above, a group freely generated by a set I can be represented as the diagram group given by the semigroup presentation and the baseword o.
Proof. Fix an integer n ≥ 1, and, for every 1 ≤ i ≤ n, let P i := Σ i | R i be a semigroup presentation and w i ∈ Σ + i a baseword. Without loss of generality, we assume that the alphabets Σ i are pairwise disjoint. Set and w := w 1 · · · w n . Then D(Q, w) is isomorphic to D(P 1 , w 1 ) ⊕ · · · ⊕ D(P n , w n ) because S(Q, w) coincides with the (2-skeleton of the) product S(P 1 , w 1 ) × · · · × S(P n , w n ).
Thus, free abelian groups of finite ranks are diagram groups. By applying the construction above, if then D(P, a n ) is free abelian of rank n.
Comparing Proposition 2.12 with Proposition 2.11, it is natural to ask whether direct sums of infinitely many diagram groups are still diagram groups. The construction used in Proposition 2.12 does not work anymore, but one can apply a trick: Proposition 2.13 ( [GS99]). Directs sums of countably many diagram groups are diagram groups.
Sketch of proof. For every i ≥ 1, let P i := Σ i | R i be a semigroup presentation and w i ∈ Σ + i a baseword. Without loss of generality, we assume that the alphabets Σ i are pairwise disjoint. Following Proposition 2.12, what we would like to do is to consider the infinite word w := w 1 w 2 · · · and to apply derivations on the w i independently according to the P i respectively. However, infinite words are not allowed. The trick is to introduce a new letter x in the alphabet and to "hidde" the infinite part of our w inside x. More precisely, set The claim is that D(Q, x) is isomorphic to i≥1 D(P i , w i ). For every i ≥ 1, derivations of the form correspond to the elements of the factor D(P i , w i ) in our direct sum.
Thus, a free abelian group of countable rank is a diagram group. By applying the construction above, it can be represented as the diagram group given by the semigroup presentation x, a, b, c | a = b, b = c, c = a, a n x = a n+1 x (n ≥ 0) and the baseword x.
Proposition 2.14 ( [GS99]). If G is a diagram group, then so is G Z.
Recall that the wreath product A B of two groups A, B is the semidirect product B A B where B acts on the direct sum by permuting the factors according to the action on itself by left multiplication.
Sketch of proof. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword such that G coincides with the diagram group D(P, w). Let a, b, s be two new letters that do not belong to Σ. Set The letter s can be thought of as a separation letter. It prevents us from applying a relation from R to two adjacent w. This letter can be removed when no relation from R can be applied to a subword of some w · · · w overlapping between two copies of w.
The claim is that D(Q, aswsb) is isomorphic to D(P, w) Z. For every diagram ∆ over Q, let η(∆) denote the number of (b, bsws)-cells in ∆ minus the number of (bsws, b)cells in ∆; it is worth noticing that η(∆) depends only on the class of ∆ modulo dipole reduction. One gets a morphism η : D(Q, aswsb) Z. For instance, the diagram Ξ associated to the derivation aswsb −→ b=swsb aswsswsb −→ asws=a aswsb is sent to 1 under η. For every i ≥ 0, D(Q, aswsb) contains a copy D i of D(P, w) whose elements correspond to the derivations of the form Similarly, for every i < 0, D(Q, aswsb) contains a copy D i of D(P, w) whose elements correspond to the derivations of the form Clearly, each D i lies in the kernel of η. In fact, one can shows that the D i generate ker(η). Therefore, D(Q, aswsb) decomposes as D i , i ∈ Z Ξ . In order to conclude, it suffices to verify that D i , i ∈ Z decomposes as i∈Z D i and that Ξ · D i · Ξ −1 = D i+1 for every index i ∈ Z.
It is worth noticing that D(Q, ab) is isomorphic to D(Q, aswsb), because ab and aswsb belong to the same connected component of the Squier complex S(P). Therefore, D(Q, ab) can also be taken as a description of D(P, w) Z as a diagram group.
Thus, the wreath product Z Z is a diagram group. By applying the construction above, it can be represented as the diagram group given by the semigroup presentation and the baseword ab.
Let us mention two last group operations preserving diagram groups. First, given two groups A and B, let A • B denote the group given by the (relative) presentation A, B, t | a, t n bt −n = 1 for all a ∈ A, b ∈ B, and n ≥ 0 .
As an alternative description [Gen19a, Example 4.29], A • B can be described as the subgroup A, B, yx in (A * Z) × (B * Z) where x (resp. y) denotes a generator of the left (resp. right) factor Z. For instance, the group Z • Z = a, b, t | [a, t n bt −n ] = 1, n ≥ 0 coincides with the kernel of the morphism F 2 × F 2 Z that sends each generator to 1 (sometimes referred to as the Bestvina-Brady group of F 2 × F 2 ).

Proposition 2.15 ([GS97]
). The •-product of two diagram groups is again a diagram group.
Sketch of proof. Let P 1 = Σ 1 | R 1 and P 2 = Σ 2 | R 2 be two semigroup presentations. Without loss of generality, we assume that Σ 1 ∩ Σ 2 = ∅. Fix two basewords w 1 ∈ Σ + 1 and w 2 ∈ Σ + 2 . The claim is that, given the semigroup presentation the diagram group D(Q, w 1 w 2 ) coincides with D(P 1 , w 1 ) • D(P 2 , w 2 ). More precisely, D(Q, w 1 w 2 ) naturally contains copies D 1 and D 2 of D(P 1 , w 1 ) and D(P 2 , w 2 ), corresponding to applications of derivations in P 1 and P 2 to w 1 and w 2 . Then an isomorphism D(P 1 , w 1 ) • D(P 2 , w 2 ) → D(Q, w 1 w 2 ) is obtained by sending D(P 1 , w 1 ) to D 1 , D(P 2 , w 2 ) to D 2 , and the generator t to the diagram Ξ associated to the derivation Thus, the group Z • Z previously mentioned is a diagram group, and, by applying the construction above, it can be described as the diagram group given by the semigroup presentation and the baseword a 1 b 1 . Next, given two groups A and B, let A B denote the group given by the (relative) presentation Proposition 2.16 ([Gen17a]). The -product of two diagram groups is again a diagram group.
Proof. Let P 1 = Σ 1 | R 1 and P 2 = Σ 2 | R 2 be two semigroup presentations. Without loss of generality, we assume that Σ 1 ∩Σ 2 = ∅. Fix two basewords w 1 ∈ Σ + 1 and w 2 ∈ Σ + 2 . The claim is that, given the semigroup presentation the diagram group D(Q, w 1 xw 2 ) coincides with D(P 1 , w 1 ) D(P 2 , w 2 ). The key observation is that the Squier complex S(Q, w 1 xw 2 ) contains two natural copies (of the two-skeleton) of S(P 1 , w 1 ) × S(P 2 , w 2 ), which we denote by S(P 1 , w 1 )xS(P 2 , w 2 ) and S(P 1 , w 1 )yS(P 2 , w 2 ). Observe that the two copies of S(P 1 , w 1 ) span (the two-skeleton of) a product S(P 1 , w 1 ) × [0, 1]; and similarly for S(P 2 , w 2 ). Thus, we get a decomposition of S(Q, w 1 xw 2 ) as a graph of spaces which implies that D(Q, w 1 xw 2 ) decomposes as the fundamental group of graph of groups with two vertices, both labelled by D(P 1 , w 1 ) × D(P 2 , w 2 ), and two edges, respectively identifying the two copies of D(P 1 , w 1 ) and D(P 2 , w 2 ). Hence the relative presentation where A 1 , A 2 (resp. B 1 , B 2 ) are two copies of A (resp. of B), which can be simplified as the presentation given above for A B.
As an application, we can describe our group Z Z as the diagram group given by the semigroup presentation , a 1 x = a 1 y, xb 1 = yb 1 and the baseword a 1 xb 1 .
Given an integer n ≥ 1, the planar braid group T n , also referred to as the twin group or the group of flat braids, is the fundamental group of i.e. the configuration space of n (unordered) points moving in R, where collisions between two points, but no more, is allowed. Elements of T n can be represented as planar braids subject to the following relations: The planar braid group T n turns out to be naturally isomorphic to the right-angled Coxeter group The kernel of the natural morphism T n → S n is the pure planar braid group P T n .
Proposition 2.17 ( [Gen20,Far21]). For every n ≥ 1, the pure planar braid group P T n is isomorphic to D(P n , x 1 · · · x n ) where P n := x 1 , . . . , The isomorphism between the diagram group D(P n , x 1 · · · x n ) and the planar braid group P T n is illustrated by the figure on the left. It shows that every diagram over P n with top path labelled x 1 · · · x n is naturally dual to a planar braid. The correspondence is clearly compatible with the group structures.
It is worth noticing that diagram groups given by the same semigroup presentation P n as in Proposition 2.17 but with different basewords lead to interesting variations. For instance, D(P n , x r 1 1 · · · x rn n ) corresponds to the group of the pure planar braids with r 1 + · · · + r n strands, coloured with n colours such that there are r i strands coloured with the ith colour, such that no two strands with the same colour are allowed to cross. Now, let us turn probably to the most famous example of diagram group, namely Thompson's group F . There are many possible definitions of F . The shortest is the following: F is the group of the increasing piecewise linear homeomorphisms [0, 1] → [0, 1] whose breakpoints have dyadic coordinates and whose slopes are powers of 2. We refer to [CFP96] for more information on Thompson's groups.
The key observation is that a diagram ∆ over P with no dipoles decomposes as the concatenation of two diagrams ∆ + · ∆ − where the 2-cells of ∆ + (resp. ∆ − ) are labelled by the relation x → x 2 (resp. x 2 → x). The figure below illustrates how to associated an element of F from an element of D(P, w) both in terms of pairs of trees and of piecewise linear homeomorphisms.
In the right part of the figure, one should think of a 2-cell from the top part of the diagram as a map [0, 1] → [0, 2] defined by x → 2x and of a 2-cell from the bottom part of the diagram as a map [0, 2] → [0, 1] defined by x → x/2. This is a particular case of the construction mentioned in Section 6 after Question 6.13.
Clearly, the arguments above generalise to every Thompson's group F n (defined from n-adic numbers instead of 2-adic numbers). Thus, the diagram groups D(P n , x) given by P n := x | x = x n is isomorphic to F n for every n ≥ 2.
Interestingly, there turns out to exist (algebraically) simple diagram groups:

Proposition 2.19 ([GS99]). Given the semigroup presentation
Recall that the elements in F coincide with the homeomorphisms [0, 1] → [0, 1] fixing pointwise neighbourhoods of 0 and 1. In terms of pairs of trees, the elements in F correspond to the pairs (T 1 , T 2 ) such that the leftmost leaves of T 1 and T 2 have the same dyadic representations, and same thing for the rightmost leaves of T 1 and T 2 . Here, the dyadic representation of a vertex in a planar 2-regular rooted tree refers to the digits associated to it when we label the root by ∅, its left child by 0, its right child by 1, the left child of 0 by 00, the right child of 0 by 01, the left child of 1 by 10, etc. For instance, the leftmost leaves of the top and bottom trees in the figure below have 00 as dyadic representatives. However, the leftmost leaves of the top and bottom trees in the figure above have 0 and 00 as dyadic representatives; therefore, the element of F represented does not belong to the commutator subgroup F . (See also Example 3.26 below for an equivalent description of F in F .) The figure below shows how to associate a pair of trees, and a fortiori an element of F , to every diagram with no dipole over the presentation given by Proposition 2.19. The key observation is that such a diagram corresponds to a derivation starting with with the moves a 1 → a 2 x → a 3 xx → · · · → a r x r−1 and b 1 → xb 2 → xxb 3 → · · · → x s−1 b s and ending with the moves a r x r−1 → a r−1 x r−2 → · · · a 1 and This is why the leftmost (resp. rightmost) leaves in the top and bottom trees have the same dyadic representation.
Let us end this section by mentioning a last interesting families of groups. Given a (simplicial) graph Γ, the right-angled Artin group A(Γ), also referred to as partially commutative group, is given by the presentation where V (Γ) and E(Γ) denote the vertex-and edge-sets of Γ. Because diagram groups include Z and are stable under direct sums and free products, we already know that many right-angled Artin groups are diagram groups. However, not every right-angled Artin group is a diagram group, and the question of which right-angled Artin groups are diagram groups is still open; see Question 6.11.
An easily recognisable family of right-angled Artin groups that are diagram groups is the following. Recall that a graph Γ is an interval graph if there exist an n ≥ 1 and a collection C of intervals in {1, . . . , n} such that C is the vertex-set of Γ and such that two intervals are connected by an edge whenever they are disjoint.

Proposition 2.20 ([Gen18]). If Γ is a finite interval graph, then A(Γ) is a diagram group.
More precisely, if our interval graph Γ is given by a collection C of intervals in {1, . . . , n}, then the diagram group given by the baseword x 1 · · · x n and the semigroup presentation Another source of examples can be found in [GS06b]. As a particular case of interest: In fact, one can prove something stronger. One can prove that, if Γ is either a finite interval graph or a finite tree, then a graph product of diagram groups over Γ is again a diagram group. Recall that, given a (simplicial) graph Γ and a collection of groups G = {G u | u ∈ V (Γ)} indexed by the vertices of Γ, the graph product ΓG is given by the (relative) presentation where [G u , G v ] = 1 is a shorthand for [a, b] = 1 for all a ∈ G u and b ∈ G v . Notice that graph products of infinite cyclic groups coincide with right-angled Artin groups.

First properties of diagram groups
So far, we have described diagram groups from several perspectives in Sections 2.1, 2.2, and 2.3, and we have shown in Section 2.4 that there exist many interesting groups that turn out to be diagram groups. Now, the natural question is: what can we learn from the fact that a given group can be described as a diagram group? In this section, our goal is to show that, despite the fact that the family of diagram groups is very broad, being a diagram groups turns out to be quite restrictive; or, in other words, it provides valuable information on the group. As a complement of the previous section, this will also allow us to give examples of groups that are not diagram groups.
For the statements below, we include ideas of proofs, following the arguments given in the original articles. However, as it will be explained in Section 4, some of these arguments based on the combinatorics of diagrams follow almost for free from the median geometry described in Section 4.2.
Let us first explain that diagram groups are torsion-free, which already prevents many groups from being diagram groups. Let P = Σ | R be a semigroup presentation. A diagram ∆ over P is reduced if it does not contain any dipole. Assuming that ∆ is spherical (i.e. if its top and bottom paths have the same label), one says that ∆ is absolutely reduced if ∆ n is reduced for every n ≥ 1. A key property is that every reduced spherical diagram ∆ decomposes (up to dipole reduction) as Ψ • ∆ 0 • Ψ −1 for some absolutely reduced diagram ∆ 0 [GS97, Lemma 15.10]. We emphasize that Ψ may not be spherical.
Consequently, given a baseword w ∈ Σ + and a reduced diagram ∆ ∈ D(P, w), we decompose ∆ as Ψ • ∆ 0 • Ψ −1 for some absolutely reduced diagram ∆ 0 . Then ∆ n is trivial in D(P, w) if and only if so is ∆ n 0 in D(P, w 0 ), where w 0 denotes the word labelling the top and bottom paths of ∆ 0 . But ∆ 0 is absolutely reduced, so ∆ n 0 is trivial if and only if ∆ 0 is itself trivial, which amounts to saying that ∆ is trivial. Thus, we have shown that the only torsion element in D(P, w) is the trivial element.
Theorem 2.23 ([GS99]). In diagram groups, nilpotent and polycyclic subgroups are free abelian and undistorted when they are finitely generated.
We refer to Sections 3.3 and 4.2 for elements of proofs.
As a consequence of Theorem 2.23, there are no interesting examples of nilpotent or polycyclic diagram groups. For instance, the fundamental group of the Klein bottle or the Heisenberg groups are not diagram groups. Nevertheless, there are metabelian but not abelian diagram groups, such as Z Z; as well as solvable diagram groups of arbitrary lengths, such as ((Z Z) Z) · · · Z. The absence of distortion given by Theorem 2.23 also allows us to discard non-amenable groups from diagram groups, such as most Baumslag-Solitar groups. The proof of this proposition is fundamentally based on the median geometry that will be described in Section 4.2. The idea is the following. Let D(P, w) be a diagram group with no Z 2 and let M (P, w) denote the median graph on which it acts naturally. Given a finitely generated subgroup H ≤ D(P, w), we want to prove that H is free. We can assume without loss of generality that H is freely irreducible. The trick is to choose carefully some hyperplane J in M (P, w) such that no two H-translates of J are transverse and the H-stabiliser of J is trivial. Thus, the orbit H · J induces an arboreal structure on M (P, w) and H acts on the dual tree (non-trivially and) with trivial edgestabilisers. This implies that H splits over the trivial group, which amounts to saying that H is either trivial or infinite cyclic, as desired. Of course, the difficulty is to choose the good hyperplane J, and this is where we use the assumption that there is not Z 2 in D(P, w).
It follows from Theorem 2.24 that free groups are the only hyperbolic groups that are diagram groups. In particular, surface groups are not diagram groups. Nevertheless, it is worth mentioning that surface groups are subgroups of diagram groups. Indeed, the complement graph P 7 of the path P 7 of length seven (i.e. the graph whose vertices are the vertices of P 7 and whose edges connect two vertices whenever they are not adjacent in P 7 ) is an interval graph, so it follows from Proposition 2.20 that the right-angled Artin group A(P 7 ) is a diagram group. This group contains A(C n ) for every n ≥ 5, where C n denotes the cycle of length n [CRDK13, Corollary 4.4]; and a fortiori every surface group [CRDK13, Corollary 4.5]. (Here, by a surface group, we mean the fundamental group of an orientable closed surface of genus ≥ 2.) As a corollary, it follows that subgroups of diagram groups may not be diagram groups themselves.

Theorem 2.25 ([GS06b]). Diagram groups are bi-orderable, hence locally indicable.
Recall that a group G is (bi-)orderable if there exists a total order ≤ and G such that, for all a, b, c ∈ G, if a ≤ b then ac ≤ bc (and ca ≤ cb). A group is locally indicable if all its finitely generated subgroups surjects onto Z. Locally indicable groups are automatically orderable, but the converse does not hold. However, bi-orderable groups are locally indicable.
It has been first proved in [Wie03] that diagram groups are orderable. (See also Corollary 4.47 below.) Both [Wie03] and [GS06b] use the same strategy: first, they construct a "universal" group containing all the diagram groups; and next they show this universal group is (bi-)orderable. The universal groups are however very different in the two articles. In [Wie03], this is a braid groups on infinitely many strands. In [GS06b], this is a well-chosen diagram group which turns out to splits as a semi-direct product between a right-angled Artin group and Thompson's group F .
Observe that, as an immediate consequence of Theorem 2.25, no finitely generated diagram group can be simple. This contrasts with the fact that the commutator subgroup F of Thompson's group F , which is simple but not finitely generated, is a diagram group (Proposition 2.19). This a consequence of the orderability of G. Indeed, given some a, b ∈ G satisfying a k = b k for some k ≥ 1, it is clear that a < b implies that a k = a · · · aa < a · · · ab < a · · · bb < · · · < b · · · bb = b k , which would contradict that a k = b k ; and similarly for b < a. Therefore, we must have a = b, as desired. Nevertheless, it is possible and instructive to prove directly Corollary 2.26 thanks to the combinatorics of diagrams. See [GS97,Theorem 15.25] for more details.  We refer to Section 3.2 for a proof of the proposition.
We conclude this section with some information on homology groups of diagram groups. The main result in this direction is: . Homology groups over Z of diagram groups are free abelian.
Some elements from the proof of the theorem are given in Section 3.1. Interestingly, with some restrictions on the underlying semigroup presentations, further information can be extracted from the proof of theorem: GS06a]). Let P be a finite and complete presentation of a finite semigroup. A diagram group over P has a rational Poincaré series.
Recall that the Poincaré series of a group G is the series P G (t) := n≥0 r n t n where r n denotes the rank of H n (G, Z) for every n ≥ 0. Complete semigroup presentation will be defined in Section 3.1.
As a particular case of Theorem 2.28, abelianisations of diagram groups are free abelian (also proved in [GS97], see Corollary 3.5 below). This contrasts with Pride's result from [Pri10]: for every abelian group A which is a finite or countably infinite direct product of cyclic groups, there exists a diagram grop G such that

Computation of presentations and homology groups
In this section, we are concerned with the following problem: Given a semigroup presentation P := Σ | R and a baseword w ∈ Σ + , how can we compute efficiently a presentation for the diagram group D(P, w)? Or equivalently, how can we compute efficiently a presentation for the fundamental group of the Squier square complex S(P, w)?
We describe here the solution proposed in [GS97,Chapter 9]. See also Section 4.5 for a decomposition of diagram groups as fundamental groups of graphs of groups.
The starting idea is simple. We want to fix, in our Squier square complex S(P, w), an orientation of the edges and a spanning tree T (P, w) so that oriented edges in S(P, w) edges in T (P, w) are trivial the boundary of a square is trivial defines a presentation of our diagram group D(P, w). As an illustration, consider the semigroup presentation Draw the Squier complex S(P, c), orient the edges, and choose a spanning tree as illustrated on the left. One gets the presentation p, q, r, s, u, v | u = q = r = s = 1, qrsp = 1 of the diagram group D(P, c), which can be simplified as v | .
The difficulty is to find an automatic procedure constructing a spanning tree. This is why we restrict ourselves to complete semigroup presentations, which we define now.
Let P = Σ | R be a semigroup presentation. Given two positive words w 1 , w 2 ∈ Σ + , we write w 1 → w 2 if w 2 can be obtained from w 1 by applying a(n ordered) relation of R, i.e. if we can write w 1 = aub and w 2 = avb for some u = v in R. We emphasize that, because v = u does not belong to R, w 1 → w 2 does not necessarily imply w 2 → w 1 . We denote by → the transitive closure of →, i.e. given two words and terminating (i.e. every sequence w 1 → w 2 → · · · eventually terminates). For instance, the presentation From now on, we assume that our semigroup presentation P = Σ | R is complete. As a consequence, every positive word w ∈ Σ + has a unique reduced form, i.e. a positive wordw ∈ Σ + such that w →w and such that there is no u ∈ Σ + such thatw → u. (Because → is terminating, such a word exists; and because → is confluent, such a word is unique.) However, a derivation from a word to its reduction may not be uniquely defined. What we want to do is to define a canonical way to reduced words and to define our spanning tree in the Squier square complex as the union of all the paths given by these reductions. These canonical reductions are defined by the elementary moves associated to the following edges in our Squier complex: is a principal left edge if the following conditions hold: • each proper prefix of the word u is reduced; • is the longest suffix of u which is the left side of a relation in R; • if there is a relation = r in R with r = r , then r is smaller than r in the ShortLex order.
Here, we think of the letters in Σ as totally ordered (say following the left-right order when we write the presentation P) so that positive words are naturally totally ordered by the corresponding ShortLex order, namely: given w 1 , w 2 ∈ Σ + , we write w 1 ≤ w 2 if w 1 is shorter than w 2 or if w 1 , w 2 have the same length and w 1 is smaller than w 2 with respect to the lexicographic order given by our total order on Σ.
Let us illustrate with an example how to reduce a word by following the pattern given by the previous definition (which seems to be difficult to digest, but which turns out to quite natural when we understand how it works). So let us consider the semigroup presentation which is complete. The word aba 3 ba 4 is not reduced.
• Identify the smallest prefix of aba 3 ba 4 that is not reduced. This is aba 3 .
• Identify the longest suffix of aba 3 that can be modified by applying a relation. This is ba 3 .
• Observe that ba 3 = a 3 b is the only relation having ba 3 as its left side, so this the relation we have to apply.
Thus, the first step in our derivation from aba 3 ba 4 to its reduction is aba 3 ba 4 → a 4 b 2 a 4 . Our new word is again not reduced, so another step is necessary.
• Identify the smallest prefix of a 4 b 2 a 4 that is not reduced. This is a 3 .
• Identify the longest suffix of a 3 that can be modified by applying a relation. This is a 3 .
• We have two relation having a 3 as their left sides, namely a 3 = a and a 3 = a 2 . Compare the right sides a and a 2 with respect to the ShortLex order. Since a is shorter than a 2 , the relation we must apply is a 2 = a.
Thus, the second step in our derivation is a 4 b 2 a 4 → a 2 b 2 a 4 . Keeping applying the procedure, we eventually find which is the canonical reduction we are looking for.
The union of all the principal left edges given by Definition 3.1 define a spanning forest in our Squier complex, as previous claimed [GS97, Lemma 9.4], which allows us to deduce the following statement: ). Let P = Σ | R be a complete semigroup presentation and w ∈ Σ + a baseword. The diagram group D(P, w) admits the following presentation. The generators are the triples is not a principal left edge. The defining relations are all the relations of the form Here, we use the notation a b = b −1 ab. It is worth mentioning that the presentation given by Theorem 3.2 is in general not optimal since the second type of relations allows us to decrease the number of generators. It is possible to extract a presentation with a minimal number of generators (which turns out to coincide with the rank of the abelianisation), but at the cost of a more technical statement. We refer the interested reader to [GS97,Theorem 9.8].
An interesting consequence of Theorem 3.2 is that diagram groups over complete semigroup presentations are examples of LOG groups.
LOG stands for Labelled Oriented Graph. It is worth noticing that not all diagram groups are LOG. Indeed, it is clear that every LOG group surjects onto Z (it suffices to send all the generators to 1), but we know from Proposition 2.19 that the commutator subgroup F of Thompson's group F is a simple diagram group. Thus, F is a diagram group but not a LOG group. We also deduce that F cannot be described as a diagram group over a complete semigroup presentation, so we lost some generality when restricting ourselves to complete semigroup presentation. Nevertheless, as shown by Lemma 3.6 below, it turns out that every diagram group can be described (more or less explicitly) as a retract inside some diagram group over a complete semigroup presentation, so it is also possible to compute presentations of diagram groups over incomplete semigroup presentations thanks to the techniques developed in this section (see [GS97,Lemma 9.11] and the related discussion).

Example 3.4.
Consider the semigroup presentation P = x | x 2 = x , which is complete. Notice that the principal left edges in S(P, x) are the edges of the form (∅, x 2 → x, x n ), n ≥ 0. A direct application of Theorem 3.2 shows that D(P, x), which is isomorphic to the Thompson group F according to Proposition 2.18, admits a presentation whose generators are the triples (x, x 2 → x, x n ) for n ≥ 0, and whose relations are Setting The presentation can be simplified as a finite presentation; see [GS97, Example 9.10] for details.
Let us mention a theoretical application of Theorem 3.2, namely: Corollary 3.5. Diagram groups have free abelianisations.

Lemma 3.6. Every diagram group is a retract in a diagram group over a complete semigroup presentation.
Recall that, given a group G, a subgroup H ≤ G is a retract if there exists a morphism ρ : G → H that restricts to the identity on H.
Proof of Lemma 3.6. Let P = Σ | R be a semigroup presentation. We fix a total order on Σ with no infinite decreasing sequence and order the positive words in Σ + by using the corresponding ShortLex order. Up to replacing some u = v in R with v = u, we assume that, for every u = v in R, v is smaller than u with respect to the ShortLex order. Let R denote the collection of all the relations u = v such that v is smaller than u with respect to the ShortLex order and such that u = v mod P. Notice that R ⊂ R .
Observe that P := Σ | R is complete. Indeed, the fact that our initial order on Σ has no infinite decreasing sequence implies that the corresponding ShortLex order has no infinite decreasing sequence either. Moreover, for every w ∈ Σ + , there exists a unique ShortLex-minimal wordw ∈ Σ + among all the positive words equal to w mod P; and, for all u, v ∈ Σ + satisfying w → u and w → v, we have u →w and v →w by definition of R . Thus, P is terminating and confluent.
Fix a baseword w ∈ Σ + . Because a (reduced) diagram over P is also a (reduced) diagram over P , there is an obvious injective morphism D(P, w) → D(P , w). From now on, we identify D(P, w) with its image in D(P , w). For every u = v in R but not in R, we know that u = v mod P, so there must exist a diagram ∆(u, v) with its top path labelled u and its bottom path labelled v. Define a map D(P , w) → D(P, w) by sending a diagram over P to the diagram over P obtained by replacing each to cell labelled by u = v with (u = v) ∈ R (resp. with (v = u) ∈ R) with a copy of ∆(u, v) (resp. ∆(u, v) −1 ). We can verify that this map is a well-defined morphism; see [GS97,Theorem 7.7] for more details. Moreover, this morphism is clearly the identity on D(P, w).
Proof of Corollary 3.5. We know that diagram groups over complete semigroup presentations are LOG groups, and clearly LOG groups have free abelianisations. Therefore, it follows from Lemma 3.6 that the following observation is sufficient to conclude the proof of our corollary:

Fact 3.7. Let G be a group and H ≤ G a retract. The abelianisation of H embeds into the abelianisation of G.
Let α : G → G ab denote the abelianisation map of G and let ρ : G → H be a retraction. The restriction of α to H yields a morphism H → G ab , which factors through ϕ : H ab → G ab . Let g ∈ H ab be an element in the kernel of ϕ. Fix a pre-imageḡ of g in H. By definition of ϕ, α(ḡ) is trivial. In other words,ḡ belongs to [G, G]. Hencē which implies that g is trivial in H ab . Thus, we have proved that ϕ : H ab → G ab is injective.
As already mentioned in Section 2.5, Corollary 3.5 can be generalised by showing that homology groups of diagram groups are free abelian. The strategy in similar in spirit to the proof of Corollary 3.5. We refer to [GS06a] for more details, and only sketch the argument below (in the language of diagrams instead of directed 2-complexes).
Given a semigroup presentation P = Σ | R and a baseword w ∈ Σ + , we need a classifying space for the diagram group D(P, w). We already know that D(P, w) is the fundamental group of the Squier square complex S(P, w), but this complex is not contractible in general. However, by adding natural higher-dimensional cubes to it, it turns out to be contractible.
Definition 3.8. The Squier cube complex S + (P) is the cube complex whose vertices are the words in Σ + ; whose (oriented) edges can be written as (a, u → v, b), where u = v or v = u belongs to R, connecting the vertices aub and avb; and whose n-cubes similarly can be written as (a 1 , u 1 → v 1 , . . . , a n , u n → v n , a n+1 ), spanned by the set of vertices {a 1 w 1 · · · a n w n a n+1 | w i = v i or u i }. Given a word w ∈ Σ + , we denote by S + (P, w) the connected component of S + (P) containing the vertex w.
Observe that S(P) coincides with the two-skeleton of S + (P), so our diagram group D(P, w) remains isomorphic to the fundamental group of S + (P, w). Each connected component of the Squier cube complex is contractible. This can be proved directly [Far03, Theorem 3.10] or can be deduced from its nonpositive curvature described in Section 4.2. Anyway, the key point is that S + (P, w) yields a classifying space for the corresponding diagram group D(P, w).
Next, observe that, given a group G, if H ≤ G is a retract then the homology groups of H are retracts of the homology groups of G, so it follows from Lemma 3.6 that we can focus on diagram groups over complete semigroup presentations. So let P = Σ | R be a complete semigroup presentation and fix a baseword w ∈ Σ + . Similarly to what we did for S(P, w) above, we can use the completeness of P in order to extract from S + (P, w) the essential part that encodes the homology. Formally, [GS06a] defines a collapsible scheme on S + (P, w); see [GS06a, Section 9] for a precise statement. Roughly speaking, this is a partition of the cubes of S + (P, w) into three categories: contractible, redundant, and essential cubes. Under reasonable assumptions, it is possible to successively collapse contractible cubes by pushing inside a codimension-one face that is redundant. At the end of the process, one gets a homotopy equivalent cube complex E(P, w) containing only the initial essential cubes.
Thanks a well-chose collapsible scheme, it is proved in [GS06a] that E(P, w) is as small as possible. More precisely, in each dimension n, the nth homology group of E(P, w) (which is also the nth homology group of D(P, w) since E(P, w) and S + (P, w) are homotopy equivalent) is freely generated by the n-cubes.

Word and conjugacy problems
As already mentioned, every diagram over a semigroup presentation admits a unique reduction (i.e. a diagram with no dipole). Therefore, in order to determine whether a given diagram represents the neutral element in the corresponding diagram group, it suffices to reduce its dipoles, in whatever order, and to look at if 2-cells survive at the end of the process. If so, the diagram represents a non-trivial element; otherwise, it represents the neutral element. Moreover, this word problem can be solved very efficiently.

Theorem 3.9 ([GS97]
). Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. Fix finitely many (w, w)-diagrams ∆ 1 , . . . , ∆ r over P. There exists an algorithm that decides, given a product of n diagrams ∆ i , whether it represents the trivial element in D(P, w) with time complexity O(n 2 log 2 n).
In order to solve the conjugacy problem, we need to introduce some terminology. Definition 3.10. Let P be a semigroup presentation and ∆ a diagram. If ∆ decomposes as the concatenation ∆ 1 • ∆ 2 , then the diagram ∆ 2 • ∆ 1 , when well-defined, is a cyclic shift of ∆.
We emphasize that ∆ 1 • ∆ 2 is a decomposition of ∆ on the nose, not up to dipole reduction. As an illustration, given the two diagrams ∆, Ω below, Ω is a cyclic shift of ∆.

Indeed, ∆ decomposes as (
Definition 3.11. Let P be a semigroup diagram. The sum ∆ 1 + ∆ 2 of two diagrams ∆ 1 , ∆ 2 over P is the diagram obtained by identifying the sink-vertex of ∆ 1 with the source-vertex of ∆ 2 . A diagram is simple if it does not decompose as the sum of two diagrams. Clearly, every diagram admits a unique decomposition as a sum of simple diagrams. A spherical diagram is normal if all the diagrams in its decomposition as a sum of simple diagrams are spherical.
For instance, the diagram ∆ above is neither simple nor normal. However, its cyclic conjugate Ω is simple.

Theorem 3.12 ([GS97]
). Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. If the semigroup P has a solvable word problem, then the conjugacy problem in the diagram group D(P, w) is solvable.
It is worth noticing that a diagram group given by a semigroup presentation with unsolvable word problem may have an unsolvable conjugacy problem; see [GS97,Example 15.22]. Let us describe the main ingredients needed in order to solve the conjugacy problem in pratice. The first step is to reduce the problem to simple absolutely reduced diagrams. We emphasize that Ω must be a spherical diagrams but its top and bottom paths may have distinct labels than the top and bottom paths of ∆. Recall from Section 2.5 that a spherical diagram ∆ is absolutely reduced if ∆ n is reduced for every n ≥ 1. Lemma 3.14. ([GS97, Lemma 15.15]) Let P be a semigroup presentation and ∆, Γ two normal and absolutely reduced diagrams over P. Decompose ∆ (resp. Γ) as a sum

be the words labelling the top and bottom paths of
i , up to dipole reduction. Next, we can solve the conjugacy problem for simple absolutely reduced diagrams thanks the next lemma. In its statement, we denote by Shift(∆) the set of all the diagrams that can be obtained from ∆ by a sequence of cyclic shifts. (It is worth mentioning that a cyclic shift of a cyclic shift may not be a cyclic shift of the initial diagram.) Putting everything together, the conjugacy problem is solved as follows. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. We fix two (w, w)-diagrams ∆ 1 , ∆ 2 over P and we would like to determine whether or not ∆ 1 and ∆ 2 are conjugate in D(P, w).
where Ω i is normal and absolutely reduced. (Which is possible according to Lemma 3.13, and can be done algorithmically.) 2. Decompose Ω i as a sum Ω 1 i + · · · + Ω n i i of simple diagrams. 3. If n 1 = n 2 , it follows from Lemma 3.14 that ∆ 1 and ∆ 2 are not conjugate. As a simple illustration, we can show that the two smallest reduced (x, x)-diagrams over P = x | x = x 2 are not conjugate in D(P, x). See Figure 6.
It is worth mentioning that the tools developped in order to solve the conjugacy problem turn out to be also useful to help proving some of the statements mentioned in Section 2.5. For instance: Proof of Proposition 2.27. Let ∆, Γ be two spherical reduced diagrams satisfying ∆ = Γ k for some k ≥ 1. We assume that ∆ and Γ contain at least one 2-cell. According to Lemma 3.13, we can write ∆ as Φ∆ 0 Φ −1 and Γ as ΨΓ 0 Ψ −1 for some normal absolutely reduced diagrams ∆ 0 and Γ 0 . Moreover, we can choose ∆ with a number of 2-cells bounded above by the number of 2-cells of ∆. Let be the decompositions of ∆ 0 and Γ 0 as sums of simple diagrams. We have As a consequence of Lemma 3.14, n = m and Φ −1 Φ decomposes as a sum Ω 1 + · · · + Ω n such that contains at least one 2-cell. We deduce from Lemma 3.15 that Shift(∆ i 0 ) = Shift((Γ i 0 ) k ), which implies that ∆ i 0 and (Γ i 0 ) k have the same number of 2-cells. Because the number of 2-cells of (Γ i 0 ) k coincides with k times the number of 2-cells of Γ i 0 , it follows that k is at most half the number of 2-cells of ∆ i 0 , and a fortiori of ∆ 0 and finally of ∆.

Commutation problem
Centralisers in diagram groups are rather well understood. More precisely: ). Let P = Σ | R be a semigroup presentation, w ∈ Σ + a baseword, and g ∈ D(P, w) an element. One can represent g as where Γ is some (w, u 1 · · · u r )-diagram and where each ∆ i is a simple absolutely reduced (u i , u i )-diagram with ∆ i either trivial or a maximal cyclic subgroup in D(P, u i ). Then, the centraliser of g coincides with As a consequence, the centraliser of an element in a diagram group is always isomorphic to the the product of a free abelian group of finite rank with finitely many diagram groups given by the same semigroup presentation but possibly different basewords.
Example 3.17. Let P be the semigroup presentation x | x = x 2 and g ∈ D(P, x) the element represented by the following diagram.
By applying Theorem 3.16, we deduce that the centraliser of g in D(P, x) is In particular, the centraliser is isomorphic to Z × F × F . Notice that, in D(P, x) and a fortiori in F , all the centralisers are isomorphic to Z m × F n for some m, n ≥ 0.
Theorem 3.16 has a lot of interesting applications. The rest of the section is essentially dedicated to them.
Proof. Let H be an abelian subgroup in a diagram group G. Our goal is to show that H is residually infinite cyclic, i.e. for every non-trivial h ∈ H there exists a morphism ϕ : H → Z satisfying ϕ(h) = 0. This implies that H embeds into a direct product of (infinitely many) cyclic groups. Such a product being free abelian, the desired conclusion follows.
So let h ∈ H be a non-trivial element. Decompose h as Γ · (∆ n 1 1 + · · · + ∆ nr r ) · Γ −1 , where Γ is some (w, u 1 · · · u r )-diagram and where each ∆ i is a simple absolutely reduced (u i , u i )-diagram with ∆ i either trivial or a maximal cyclic subgroup in D(P, u i ). Because h is non-trivial, at least one of the ∆ i is non-trivial, say ∆ k . According to Theorem 3.16, the centraliser This concludes the proof of our corollary.
We saw with Propositions 2.20 and 2.21 that many right-angled Artin groups are diagram groups. As another application of Theorem 3.16, we can show that there are also many right-angled Artin groups that are not diagram groups. Sketch of proof. Given a triangle-free graph Γ with an induced cycle of odd length ≥ 5, assume for contradiction that A(Γ) is a diagram group, say D(P, w) for some semigroup presentation P = Σ | R and some baseword w ∈ Σ + .
Any spherical diagram over P can be conjugate to a sum of spherical diagrams, and the number of non-trivial components depends only on the element of D(P, w) we are looking at. Say that an element of D(P, w) is monocomponent if it has only one such component. Given two monocomponent elements g 1 , g 2 ∈ D(P, w), we write g 1 ≺ g 2 whenever there exist a (w, xuyvz)-diagram Γ and simple absolutely reduced (u, u)-and (v, v)-diagrams Ψ 1 and Ψ 2 such that It can be verified that ≺ is transitive and antisymmetric, and that any two commuting monocomponent elements that do not belong to the same cyclic subgroup are ≺comparable. See [GS99] for details. Now, let s 0 , . . . , s 2n ∈ D(P, w) denote the generators of A(Γ) given by an induced cycle of odd length ≥ 5. It follows from the description of centralisers in right-angled Artin groups [Ser89] that the centraliser of each s i is s i−1 , s i , s i+1 Z × F 2 ; in particular, its centre is infinite cyclic. We deduce from Theorem 3.16 that the s i are monocomponent.
Assume without loss of generality that s 0 ≺ s 1 . We cannot have s 1 ≺ s 2 since otherwise this would imply that s 0 ≺ s 2 , which is impossible since s 0 and s 2 do not commute. Therefore, we have s 2 ≺ s 1 . Similarly, we cannot have s 3 ≺ s 2 since otherwise we would have s 3 ≺ s 1 and s 3 would commute with s 1 . Hence s 2 ≺ s 3 . Iterating the argument, we find that: It follows that s 2n commutes with s 1 since s 2n ≺ s 1 , a contradiction.
An interesting consequence of Theorem 3.16 is that nilpotent subgroups in diagram groups must be abelian (and a fortiori free abelian according to Corollary 3.18). This assertion will follow from the next statement: Proof. Let P = Σ | R , be a semigroup presentation, w ∈ Σ + a baseword, and H a subgroup of D(P, w). Assume that the centre of H contains a non-trivial element h ∈ H, otherwise there is nothing to prove. Decompose h as Γ · (∆ n 1 1 + · · · + ∆ nr r ) · Γ −1 , where Γ is some (w, u 1 · · · u r )-diagram and where each ∆ i is a simple absolutely reduced (u i , u i )-diagram with ∆ i either trivial or a maximal cyclic subgroup in D(P, u i ). For any two a, b ∈ H, it follows from Theorem 3.16 that we can write Consequently, a product of commutators of elements in H decomposes as This implies that h cannot be written as a product of commutators in H.

Corollary 3.21 ([GS99]). Nilpotent subgroups in diagram groups are abelian.
Proof. For every k ≥ 2, a k-step nilpotent group always contains a 2-step nilpotent group. But being a 2-step nilpotent group precisely means that its commutator subgroup is non-trivial and contains in its centre. Thus, it follows from Theorem 3.20 that nilpotent subgroups in diagram groups are 1-step nilpotent, i.e. abelian.
It is worth noticing that, even though diagram groups do not contain interesting nilpotent groups, they may contain interesting solvable groups. For instance, we saw in Section 2.4 that the lamplighter group Z Z, which is metabelian, is a diagram group; as well as the iterated wreath product ((Z Z) · · · ) Z. In fact, it is contained in many diagram groups. It is proved in [GS99] that a diagram group D(P, w) contains a subgroup isomorphic to Z Z if and only if there exist words x, y, z such that D(P, z) = {1} and the equalities w = xy, x = xz, and y = zy hold modulo P. This includes for instance Thompson's group F .
We saw with Corollary 3.18 that abelian subgroups in diagram groups are necessarily free. In fact, we can be more precise and describe the structures of abelian subgroups in terms of diagrams.
As a consequence, one can show that abelian subgroups in diagram groups are undistorted.
Proof. Given a diagram group, let A be a finitely generated abelian subgroup. Fix a finite generating set {g 1 , . . . , g m } in A. According to Theorem 3.22, there exist an (w, v 1 · · · v n )-diagram Γ and (v j , v j )-diagrams ∆ j such that for every 1 ≤ i ≤ m. Moreover, we can choose the diagrams ∆ 1 , . . . , ∆ n either trivial or simple and absolutely reduced. Let A + denote the abelian subgroup freely generated by It suffices to show that A + is undistorted in our diagram group in order to conclude. So let H be a finitely generated subgroup containing A + . On the one hand, if | · | denotes the word length of A + given by our free basis, then it is clear that for every a ∈ A + . And, on the other hand, if we fix a generating set {s 1 , . . . , s r } of H and a shortest representative m = m(s 1 , . . . , s r ) of a given element a ∈ A + , then Thus, the length in H of an element in A + is bounded below by its length in A + . This concludes the proof of our corollary.

Membership problem for the commutator subgroup
Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. Our goal in this section is to describe a natural morphism α : D(P, w) → A (P) from our diagram group D(P, w) to some free abelian group A (P) whose kernel coincides with commutator subgroup of D(P, w). The motivation being to solve efficiently the membership problem for the commutator subgroup of D(P, w) in terms of diagrams, as soon as the word problem is solvable in P.
So let A (P) denote the free abelian group generated by S × R × S, where S denotes the semigroup given by P. Given a diagram ∆ over P, we associate to each cell π of ∆ an element η(π) of S × R × S as follows. The top and bottom paths of π meet at two points: a source ι(π) and a sink τ (π). All the oriented paths in ∆ from the source of ∆ to ι(π) are labelled by positive words representing the same element in the semigroup S; let (π) denote this element. Similarly, all the oriented paths in ∆ from τ (π) to the sink of ∆ are labelled by positive words representing the same element in the semigroup S; let r(π) denote this element. If π is labelled by the relation u = v with (u = v) ∈ R (resp. (v = u) ∈ R), then we set η(π) := ( (π), u = v, r(π)) (resp. −( (π), v = u, r(π))). Finally, we define α(∆) := π cell of ∆ η(π) ∈ A (P).
Let us consider an explicit example in order to illustrate our definition. Take the presentation from Proposition 2.19 and the following diagram ∆: First of all, observe that a i x n = a 1 and x n b i = b 1 mod P for all i, n ≥ 1. Indeed, we have for all i, n ≥ 1, and We argue similarly for the equality mod P with b 1 . This allows us to deduce that Therefore, α(∆) = η(π 1 ) + · · · + η(π 6 ) = 0.
Coming back to the general case, the main result of interest for us is: We emphasize that α is not surjective in general, so we cannot identify A (P) with the abelianisation of D(P, w). In fact, A (P) is usually much bigger than the abelianisation.
An idea to prove Proposition 3.24 is the following. If P is a complete semigroup presentation, then Theorem 3.2 provides a presentation of D(P, w). Given an element ∆ in the kernel of α, we write it as a product of generators from our presentation, say ∆ = Φ 1 · · · Φ n . Using the fact that 0 = α(∆) = α(Φ 1 ) + · · · + α(Φ n ), we deduce that ∆ can be written as a product of commutators. This argument shows that Proposition 3.24 holds for complete semigroup presentation.  (1, 1). We refer to a cell sent to ±(1, x) as left, to a cell sent to ±(x, 1) as right, and to a cell sent to ±(x, x) as internal. Remember that the cells of ∆ labelled by x = x 2 (resp.

Foldings and closed subgroups
The method of folding graphs [Sta83] has been quite influential in the study of free groups and has been generalised in various directions. Interestingly, thinking of a diagram groups as second fundamental groups of directed 2-complexes, foldings appear naturally in a similar way. This allows us, in particular, to solve the membership problem for some subgroups.
First of all, let us recall how to solve the membership problem in free groups thanks to folding. In other words, given a free group F and elements g, h 1 , . . . , h n ∈ F , we want to determine whether or not g belongs to the subgroup H := h 1 , . . . , h n . We fix a free basis s 1 , . . . , s r of F and we think of F as the fundamental group of a bouquet Ω of r circles, each oriented and labelled by a generator s i . To H, we associate a bouquet Γ 0 This method for finite graphs can be naturally adapted to finite directed 2-complexes. This has been done by V. Guba and M. Sapir in the late 1990s (unpublished), but it first appeared in print in [GS17].
Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. We think of the diagram group D(P, w) as the second fundamental group of the directed 2-complex X (P) based at the 1-path labelled by w. See Section 2.3 for the relevant definitions. We fix some spherical diagrams ∆, ∆ 1 , . . . , ∆ n ∈ D(P, w) and we would like know whether ∆ belongs to the subgroup H := ∆ 1 , . . . , ∆ n .
To H we associate the directed 2-complex X 0 obtained by identifying all the top and bottom paths of the ∆ i to a single segment. Topologically, X 0 can be thought of as a bouquet of 2-spheres pairwise intersecting along a fixed segment. Observe that there is a natural morphism of directed 2-complexes X 0 → X (P) and that both X (P) and X 0 have a distinguished 1-path. A folding refers to the following operation: if one sees two cells in X 0 sharing their top or bottom paths and having the same image in X (P), then we identify them. After finitely many folds X 0 → · · · → X k , one gets a directed 2-complex X k with a locally injective morphism X k → X (P).
Define the closure Cl(H) of H as the subgroup of D(P, w) given by the diagrams accepted by X k , i.e. the image of the second fundamental group of X k based at its distinguished 1-path under the morphism X k → X (P). (It can be shown that the closure of a subgroup does not depend on a particular choice of generators.) By construction, the closure of H contains H, but, contrary to the case of free groups, it can be bigger. One can say that the closure of a subgroup is itself a diagram group, but subgroups of diagram groups may not be diagram groups themselves, so there must exist subgroups properly contained in their closure. In fact, it is easy to construct subgroups distinct from their closures. Indeed, if ∆ is a diagram decomposing as a sum of two spherical diagrams ∆ 1 + ∆ 2 , then the closure of ∆ contains ∆ 1 + (u 2 ) and (u 1 ) + ∆ 2 , where each (u i ) denotes the trivial diagram having the same label as the top and bottom paths of ∆ i . Indeed, when identifying the top and bottom paths of ∆, we do not get a topological sphere, but a pointed sum of two spheres due to the cut-point separating ∆ 1 and ∆ 2 in ∆. It is conjectured that this phenomenon is essentially the only obstruction for a subgroup to coincide with its closure. See [Gol16,Conjecture 3.11] for a precise statement.
In conclusion, for every diagram group, there exists an algorithm that decides, given spherical diagrams ∆, ∆ 1 , . . . , ∆ n , whether or not ∆ belongs to the closure of the subgroup ∆ 1 , . . . , ∆ n . In particular, the membership problem is solvable for closed subgroups (i.e. subgroups that coincide with their closures).

Crash course on median geometry
In this preliminary section, we record some basic definitions and results related to median graphs that will be used in the next sections.
We refer to this vertex m as the median point of x 1 , x 2 , x 3 . Examples include of course simplicial trees, the median point of a triple of vertices corresponding to the centre of the tripod they delimit. A product of median graphs is still median, so product of trees are also median graphs. This includes in particular (one-skeleta of) cubes of arbitrary dimensions.
A fundamental idea is that the geometry of a median graph is essentially encoded in the combinatorics of its hyperplanes.
Definition 4.2. Let X be a median graph. A(n oriented) hyperplane J is an equivalence class of (oriented) edges with respect to the transitive closure of the relation that identifies two (oriented) edges when they are opposite sides of a 4-cycle.
• If X\\J denotes the graph obtained from X by removing all the edges of J, then a connected component of X\\J is a halfspace. Two subsets A, B ⊂ X are separated by J if they lie in distinct halfspaces delimited by J.
• Two hyperplanes J 1 and J 2 are transverse if there exist two intersecting edges e 1 ⊂ J 1 and e 2 ⊂ J 2 that span a 4-cycle.
• They are tangent if exist two intersecting edges e 1 ⊂ J 1 and e 2 ⊂ J 2 that do not span a 4-cycle.
See Figure 9 for a few examples. The previous claim is mainly motivated by the following statement: . Let X be a median graph. The following assertions hold.
• Every hyperplane J separates. More precisely, X\\J has exactly two connected components, which turn out to be convex.
• A path in X is a geodesic if and only if it crosses each hyperplane at most once.
• The distance between two vertices x, y ∈ X coincides with the number of hyperplanes separating x, y.
In geometric group theory, median graphs are better known as CAT(0) cube complexes. Recall that the link of a vertex x is the complex whose vertices are the (half)edges starting from x and whose simplices are given by edges than span a cell. Typically, the link of a vertex should be thought of as a small ball around the vertex, endowed with the cellular structure induced by the whole complex. A complex is flag if, for all n ≥ 1, any n + 1 vertices span an n-simplex if and only if they are pairwise adjacent.
The terminology is justified by the fact that a cube complex, when endowed by the length metric extending the Euclidean metrics of its cubes, is locally CAT(0) exactly when it is nonpositively curved [Gro87,Lea13]. As a consequence, a cube complex endowed with the same metric is CAT(0) if and only if it is simply connected and nonpositively curved. We refer to [BH99] for more information on CAT(0) geometry. It turns out that CAT(0) cube complexes and median graphs define essentially the same objects. More precisely:

Theorem 4.5 ([Ger98, Che00, Rol98]). A graph is median if and only if its cubecompletion is simply connected and nonpositively curved.
Here, given a graph X, its cube-completion refers to the cube complex X obtained by filling with cubes all the subgraphs isomorphic to one-skeleta of cubes.
Usually, hyperplanes are thought of slightly differently in cube-completions of median graphs: they are thought of as unions of midcubes. See Figure 9. The terminology related to hyperplanes in median graphs can be easily adapted for this alternative point of view.
The following observation can be thought of as a consequence of the CAT(0)ness of the cube complexes under consideration, but it can also be proved directly thanks to the combinatorics of hyperplanes.

Proposition 4.6. Cube-completions of median graphs are contractible.
For more information on median graphs, or equivalently CAT(0) cube complexes, we refer to [Sag14,Gen].

Median geometry of diagram groups
In this section, we show that diagram groups act on median graphs. These median graphs can be described in several equivalent ways. For now, we give a direct and explicit definition and postpone more conceptual characterisations.
Definition 4.7. Let P be a semigroup presentation. Let M (P) denote the graph whose vertices are the diagrams over P modulo dipole reduction and whose edges connect two diagrams whenever one can be obtained from another by right-concatenation by an atomic diagram (i.e. a diagram with a single 2-cell).
In other words, the vertices are given by reduced diagrams and one passes from a vertex to a neighbour by gluing below a 2-cell. In the sequel, vertices of M (P) will be often thought of as reduced diagrams. Notice that the diagram group D(P, w) naturally acts on M (P, w) by left multiplication.
It is worth noticing that, since edges of M (P) are labelled by atomic diagrams, the paths in M (P) are naturally labelled by the diagrams obtained by concatenating the atomic diagrams given by the edges along the path. Whether such a diagram is reduced characterises the geodesics in M (P). More precisely: Lemma 4.8. Let P be a semigroup presentation, w ∈ Σ + a baseword, and Φ, Ψ ∈ M (P, w) two vertices. A path is a geodesic if and only if the diagram ∆ 1 • · · · • ∆ n is reduced. As a consequence, the distance between Φ and Ψ in M (P, w) coincides with the number #(Φ −1 Ψ) of 2-cells in the reduction of Φ −1 Ψ.
Proof. It is clear that any path from Φ to Ψ must have length at least #(Φ −1 Ψ), and that there exists at least one such path of this length. So the distance between Φ and Ψ in M (P, w) coincides with #(Φ −1 Ψ). Therefore, our path is a geodesic if and only if ∆ 1 • · · · • ∆ n = Φ −1 Ψ with n = #(Φ −1 Ψ). The only possibility is that there is no dipole in ∆ 1 • · • ∆ n , which amounts to saying that ∆ 1 • · · · • ∆ n is reduced.
The following theorem is the main result of this section.

Theorem 4.9 ([Far03]). Let P be a semigroup presentation and w ∈ Σ + a baseword. Then M (P, w) is a median graph, locally of finite cubical dimension, on which D(P, w) acts freely. The action is cocompact if and only if [w] P is finite.
Here, we use the notation [w] P := {m ∈ Σ + | m = w mod P}. We are going to give two proofs of Theorem 4.9. The first one verify that every triple of vertices admits a unique median point thanks to the description of the geodesics provided by Lemma 4.8; and the second proof applies the characterisation of median graphs provided by Theorem 4.5.
First proof of Theorem 4.9. Let ∆ 0 , ∆ 1 , ∆ 2 be three reduced diagrams representing three vertices of M (P, w). Up to conjugating by ∆ 0 , we can assume without loss of generality that ∆ 0 has no cell. (Notice that this operation may modify the baseword w.) Let ∆ be the biggest common prefix of ∆ 1 and ∆ 2 . (Given two diagrams Φ, Ψ, one says that Φ is a prefix of Ψ if Ψ decomposes as a concatenation Φ • Γ for some diagram Γ.) The fact that ∆ is a common prefix of ∆ 1 and ∆ 2 implies that ∆ belongs to geodesics from ∆ 0 to ∆ 1 and from ∆ 0 to ∆ 2 . And the maximality of this prefix assures that, if we decompose ∆ 1 (resp. ∆ 2 ) as ∆ • Γ 1 (resp. ∆ • Γ 2 ), then Γ 1 • Γ −1 2 is reduced. This implies that ∆ also belongs to a geodesic between ∆ 1 and ∆ 2 . Thus, ∆ provides a median point for If Ξ is a median point of ∆ 0 , ∆ 1 , ∆ 2 , then Ξ must be a common prefix of ∆ 1 and ∆ 2 , and consequently a prefix of ∆. Decompose ∆ as Ξ • Ω. Because Ξ belongs to a geodesic between ∆ 1 and ∆ 2 , the concatenation (Ω • Γ 1 ) −1 (Ω • Γ 2 ) must be reduced. In other words, Ω cannot have any cell, hence Ξ = ∆.
Second proof of Theorem 4.9. According to Theorem 4.5, it suffices to show that the cube-completion M (P, w) is simply connected and nonpositively curved.
We begin by describing the cubes in M (P, w). A thin diagram is a sum of atomic diagrams (see Definition 3.11). Given a diagram ∆ ∈ M (P, w) and thin diagram Ψ with top label equal to the bottom label of ∆, the vertices {∆ • Ψ 0 | Ψ 0 prefix of Ψ} span an n-cube if Ψ has n cells. One can show that all the cubes in M (P, w) are of this form.
As a consequence, given a vertex ∆ ∈ M (P, w), if w denotes the bottom label of ∆ then the link of ∆ is isomorphic to the simplicial complex whose vertices are the subwords of w which are part of a relation from R and whose simplices are given by pairwise disjoint subwords. Clearly, such a complex is flag, so M (P, w) is nonpositively curved. Now, let us show that every compact subcomplex in M (P, w) is contractible. More precisely, given a finite set of vertices S, we claim that the subcomplex spanned bȳ S := {∆ | ∃Ω ∈ S, ∆ prefix of Ω} is contractible. According to Lemma 4.8,S coincides with the union of all the geodesics from the trivial diagram to the vertices in S. Fix a reduced diagram ∆ ∈S with a maximal number of cells (which amounts to saying that the distance from the trivial diagram to ∆ is maximal). Decompose ∆ as the concatenation ∆ 0 • Γ where Γ is a thin diagram containing all the cells of ∆ whose bottom paths lie in the bottom path of ∆. (In other words, Γ is the maximal thin suffix of ∆.) If Γ has n cells, let ∆ 1 , . . . , ∆ n denote the diagrams obtained from ∆ by removing a single cell from Γ. Then Thus,S deformation retracts ontoR. During the replacement, observe that the quantity maximal number of cells of a diagram in S , number of vertices with a maximal number of cells , ordered with respect to the lexicographic order, decreases. Therefore, the process has to stop after finitely many steps. Necessarily, the final step corresponds to the situation where our set of vertices is reduced to the trivial diagram.
Interestingly, the median geometry of diagram groups can replace the combinatorics of diagrams in some arguments. We record some of examples below.
Second proof of Theorem 2.22. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. A finite-order isometry of a median graph has to stabilise (the oneskeleton of) a cube (for instance, combine [Tar96, Lemma 2.1.3] with [BvdV87]). Because cube-stabilisers are vertex-stabilisers for the action of D(P, w) on M (P, w), the fact that D(P, w) acts freely on M (P, w) immediately implies that D(P, w) is torsion free.
Proof of a weak version of Theorem 2.23. If a group acts properly on a median graph, then its finitely generated abelian subgroups are automatically undistorted [Cor13, Corollary 6.B.5] and its polycyclic subgroups are automatically virtually abelian [Cor13, Corollary 6.C.8].
Second proof of Prosition 2.27. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. Given an isometry of a median graph, if no power inverts a hyperplane (i.e. stabilises the hyperplane but swaps the two halfspaces it delimits), then it acts as a translation on a bi-infinite geodesic lines [Hag07]. Because D(P, w) acts on M (P, w) with no inversion, it follows that a non-trivial element g ∈ D(P, w) does act as a translation on some bi-infinite geodesic. This amounts to saying that there exists a diagram ∆ and a geodesic [∆, g∆] from ∆ to g∆ such that the concatenation n∈Z b n · [∆, g∆] is a geodesic. Observe that the translation length τ (g) of g is d(∆, g∆) = #(g). Now, if a, b ∈ D(P, w)\{1} and k = 0 are such that a = b k , then #(a) = τ (a) = |k| · τ (b) = |k| · #(b), which implies that |k| ≤ #(a)/2.
As already mentioned, there are several equivalent but more conceptual view on the median graph given by Definition 4.7. Below, we record three of them.
Cayley graph of the diagram groupoid. Let P = Σ | R be a semigroup presentation. Recall from Section 2.2 that the diagram groupoid D(P) is defined as the set of diagrams over P up to dipole reduction endowed with the concatenation of diagrams. Because every diagram can be constructed by adding one 2-cell at a time, the atomic diagrams generate the groupoid D(P). It follows directly from Definition 4.7 that M (P) coincides with the Cayley graph of D(P) with respect to the generating set given by the atomic diagrams, i.e. the graph whose vertices are the elements of D(P) and whose edges connect one element to another if one can be obtained from the other by right-multiplying by a generator.
This observation is compatible with our analogy between diagram groups and free groups. Universal cover of the Squier cube complex. It turns out that (cube-completions of) our median graphs can be constructed directly from the Squier cube complexes. More precisely:

Free groups Diagram groups
Proposition 4.11. Let P = Σ | R be a semigroup presentation. The map that sends a semigroup diagram over P to the labels of its bottom path induces a universal cover M (P) → S + (P).
The proposition is essentially immediate from the definitions of the spaces involved: it is clear that the map M (P) → S + (P) induces isomorphisms between links of vertices, so it is a covering map, and we already saw that each connected component of M (P) is simply connected.
From directed 2-complexes to cube complexes. One can naturally associate to every directed 2-complex X a cube complex Sq(X ), namely the cube-completion of the graph whose vertices are the 1-paths in X and whose edges connect two 1-paths whenever one can be obtained from the other by an elementary transformation. Observe that, if P is a semigroup presentation and if X (P) is the associated directed 2-complex, then Sq(X (P)) coincides with the Squier cube complex S + (P). It turns out that the cubecompletion M (P) can also be constructed from a directed 2-complex.

Definition 4.12.
A rooted 2-tree is a directed 2-complex with a distinguished 1-path α which can be described as a union of directed 2-complexes X 0 ⊂ X 1 ⊂ · · · such that: • X 0 coincides with the 1-path α; • for every n ≥ 0, X n+1 is obtained from X n by adding new 2-cells whose bottom paths are pairwise disjoint, except possibly at their endpoints; and such that, for each new cell, its top path lies in X n but its bottom path must be a simple arc meeting X n only at its endpoints.
Among directed 2-complexes, there is a natural notion of covers and every directed 2complexes (with a distinguished 1-path) admits a (unique) universal cover. This cover is a rooted 2-tree and it is constructed as follows. Let X be a directed 2-complex with a distinguished 1-path α.
• Let X 0 denote the directed 2-complex reduced to a single 1-path, which we endow with a map φ 0 : X 0 → X that sends isomorphically X 0 to α.
• Assume that X n and φ n : X n → X are constructed for some n ≥ 0. If there exists a 1-path ξ ⊂ X n and a 2-cell π ⊂ X such that the top path of π is φ n (ξ) and such that no 2-cell of X n is sent to π under φ n , then we constructed X n+1 by gluing a new 2-cell along ξ and extend φ n by sending this new cell to π.
Possibly after infinitely many steps, one gets a rooted 2-tree X and a (covering) map φ : X → X . We refer to [GS06a] for more details.
Proposition 4.13. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. Let X(P) denote the directed 2-complexes associated to P with w as its distinguished 1-path. The cube complex M (P, w) is naturally isomorphic to Sq X (P) .
A possible description of the universal cover X (P) is the following. Take all the reduced diagrams over P with top labels w and glue them along their top paths τ . Each time two diagrams ∆ 1 and ∆ 2 have a common prefix ∆ (i.e. each time ∆ 1 and ∆ 2 decompose as concatenations ∆ 1 = ∆ • Γ 1 and ∆ 2 = ∆ • Γ 2 ), identify the two copies of ∆. The directed 2-complex one gets is precisely X (P), with τ as its root. Observe that τ and any 1-path α in X (P) delimits a unique diagram Ω(α) ⊂ X (P). The map α → Ω(α) yields the isomorphism Sq X (P) → M (P, w) from the proposition.

Morse theory and finiteness properties
Recall that, given an n ≥ 0, a group is of type F n if it admits a classifying space with only finitely many k-cells for k ≤ n. It is of type F ∞ if is of type F n for every n ≥ 0; or equivalently if it admits a classifying space with only finitely many cells in each dimension. A group is of type F if it admits a classifying space with only finitely many cells. It is worth noticing that a group is of type F 1 (resp. of type F 2 ) if and only if it is finitely generated (resp. finitely presented).
Since universal covers of Squier cube complexes are contractible, as cube-completions of median graphs, one gets explicit classifying spaces for diagram groups, which allows us to deduce various finiteness properties. As an immediate application: Proposition 4.14. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. If only finitely many words in Σ + equal w modulo P, then the diagram group D(P, w) is of type F .
Proof. The Squier cube complex S(P, w) defines a classifying space of D(P, w) with only finitely many cells.
For instance, the proposition applies to all the diagram groups associated to the semigroup presentations including to the pure planar braid groups given by Proposition 2.17. It is worth noticing that not every diagram group satisfies good finiteness properties. For instance, the groups Z Z and Z•Z given in Section 2.4 are finitely generated by not finitely presented. As a more elementary example, it is not difficult to see that the diagram group D (P, x), is a free abelian group of infinite rank. Of course, this group is not finitely generated.
Even though the Squier cube complex contains infinitely many cells in each dimension, it is possible to deduce good finiteness properties of the corresponding diagram groups by extracting from the cube complex a compact core. A general result illustrating this assertion is the following: • f is never constant on a cell of positive dimension; • and f (X (0) ) is discrete in R.
Typically, one should think of a Morse function as a height function.
In our cube complex M (P, x), we have a natural Morse function at our disposal: it suffices to extend the map M (P, x) → N that sends a vertex represented by an (x, x n )diagram to n. This Morse function h : M (P, x) → R + is D(P, x)-equivariant, so D(P, x) preserves the sublevels h −1 ([0, k]), k ≥ 0. Moreover, because P is a finite presentation, all these actions are cocompact. Thus, we would like to replace the Squier cube complex with the quotient under D(P, x) of a well-chosen sublevel. Unfortunately, there is not guarantee that such a sublevel is contractible, contrary to the Squier complex, so it is not clear in general that our new complex will be a classifying space. This is where Morse theory enters the game, whose philosophy claims that understanding the topology of a polyhedron complex is equivalent to understanding the topology of the (sub)levels of a Morse function. • and whose simplices are collections of pairwise disjoint subintervals.
One can naturally reconstruct I k+3 from a cone over I k+1 (whose apex corresponds to the vertex [k+2, k+3] of I k+3 ) by gluing a cone over I k ⊂ I k+1 (whose apex corresponds to the vertex [k + 1, k + 2] of I k+3 ). This observation allows us to prove by induction that I k is n-connected for every k ≥ 3(n + 2).
Thus, given an n ≥ 0, we know that D(P, x) acts freely, properly, and cocompactly on the sublevel h −1 ([1, 3(n + 2)]) in M (P, x), which is n-connected. We conclude that D(P, x) is of type F n , as desired. The argument easily generalises to the semigroup presentation x | x = x r , r ≥ 2. We leave the details as an exercise for the interested reader.
We conclude this section by mentioning the following consequence of Theorem 4.15: Corollary 4.17. Every diagram group over a finite semigroup presentation embeds into a diagram group of type F ∞ .
Proof. Let P = Σ | R be a finite semigroup presentation and w ∈ Σ + a baseword. Set Every (reduced) diagram over P also defines a (reduced) diagram over Q, so there is an obvious injective morphism D(P, w) → D (Q, w). Clearly, the semigroup defined by Q is finite, so Theorem 4.15 implies that D(Q, w) is of type F ∞ .

Hilbert space compression
Roughly speaking, the Hilbert space compression of a metric space is a number between zero and one which quantifies the compatibility between the geometry of the space with the geometric of Hilbert spaces. The smallest the compression is, the highest the distortion of an embedding into a Hilbert space must be.
Definition 4.18. Let f : X → Y be a Lipschitz map between two metric spaces. The compression of f is the least α > 0 for which there exists a constant C > 0 such that The Hilbert space compression of X is the least compression of a Lipschitz map from X to a Hilbert space. By extension, the Hilbert space compression of a finitely generated group is the Hilbert space compression of its Cayley graphs (constructed from finite generating sets).
Interestingly, median graphs always admit good Lipschitz embeddings into Hilbert spaces with compression bounded below.  d(x, y). This concludes the proof of our claim.
As an immediate consequence of Theorem 4.19, it follows that the Hilbert space compression of a finitely generated diagram group D(P, w) is ≥ 1/2 if its orbits in the median graph M (P, w) are quasi-isometrically embedded; and is even equal to 1 if in addition the cubical dimension of M (P, w) is finite. For instance: Proposition 4.20. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. If only finitely many words in Σ + are equal to w modulo P, then the Hilbert space compression of D(P, w) is equal to 1.
Proof. Our assumptions imply that D(P, w) acts on M (P, w) properly and cocompactly. Therefore, the Hilbert space compression of D(P, w) coincides with the Hilbert space compression of M (P, w), which is equal to 1 according to Theorem 4.19.
As a consequence of the description of the graph metric of M (P, w) given in Section 4.2, it is clear that the orbits of a finitely generated diagram group D(P, w) are quasiisometrically embedded if and only if the following property is satisfied: Definition 4.21. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. The diagram group D(P, w) satisfies the Burillo property if it is finitely generated and if every word-metric given by a finite generating set is biLipischtz equivalent to the diagram metric #(·), i.e. the map that sends each element of D(P, w) to the number of 2-cell in a reduced diagram representing it.
Thus, we deduce the following statement: Computing the exact value of the Hilbert space compression may be subtle and goes beyond the scope of this survey. Nevertheless, let us mention that Thompson's group F has Hilbert space compression 1/2 [AGS06] and that the lamplighter group Z Z has Hilbert space compression 2/3 [ANP09].
The proof of Proposition 4.22 given in [AGS06] does not use median geometry, but it turns out to be the exact translation of the argument presented above through the correspondance between median graphs and rooted 2-trees described in Section 4.2. Let us describe the argument as presented in [AGS06].
Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. We glue together all the reduced diagrams over P with top label w along their top paths τ ; and, for any two diagrams ∆ 1 , ∆ 2 , if ∆ is a common prefix of ∆ 1 , ∆ 2 , then we identify the two copies of ∆ in ∆ 1 and ∆ 2 . Let T (P, w) denote the resulting object. Let H denote the Hilbert space given by the formal sums of 2-cells in T (P, w) endowed with the 2 -norm. For every g ∈ D(P, w), there is a unique copy of a reduced diagram representing g having τ as its top path. Let Ξ(g) denote the formal sum of the 2-cells contained in this copy. w). Thus, if D(P, w) satisfies the Burillo property, then g → Ξ(g) defines a Lipschitz map D(P, w) → H with compression 1/2. An explicit bijection between the 2-cells in T (P, w) and the hyperplanes in M (P, w) can be described as follows. A diagram ∆ over P is minimal if it contains a single 2-cell having its bottom path in the bottom path of ∆. If ∆ − denotes the diagram obtained from ∆ by removing this 2-cell, then [∆, ∆ − ] defines an edge in M (P), and we denote by J(∆) the hyperplane containing this edge. It turns out that the map ∆ → J(∆) induces a bijection from the reduced minimal diagrams over P to the hyperplanes in M (P) [Gen17b, Proposition 2]. For every 2-cell π in T (P, w), let ∆(π) denote the smallest diagram in T (P, w) containing π and having τ as its top path. The minimality assures that ∆(π) is minimal, and the map π → J(∆(π)) yields the desired bijection from the 2-cells of T (P, w) to the hyperplanes of M (P, w).
Remark 4.23. In this section, we have focused on Hilbert space compressions of groups, but one can define the equivariant Hilbert space compression of a finitely generated group G as the least compression of a Lipschitz map from G (endowed with the word-length given by a finite generating set) to a Hilbert space on which G acts by affine isometries. Everything that has been said about Hilbert space compressions in this section also holds for equivariant compressions.

Hyperplanes in Squier's cube complex
In this section, we focus on the combinatorics of hyperplanes in Squier cube complexes. In particular, this will allow us to prove that some diagram groups are linear over Z, have finite asymptotic dimension, or satisfy some Tits alternative depending on their underlying semigroup presentations. We begin by recalling some terminology and results from [HW08].
Definition 4.24. Let X be a nonpositively curved cube complex.
• A hyperplane is one-sided if its two orientations coincide. Otherwise, it is twosided. • Two hyperplanes inter-osculates if they are both transverse and tangent.
The cube complex X is conspicial 2 if all its hyperplanes are two-sided and if it does not contain self-intersections, self-osculations, nor inter-osculations.
Let us motivate this definition. Given a nonpositively curved cube complex X, let ∆X denote its crossing graph, i.e. the graph whose vertices are the hyperplanes of X and whose edges connect two hyperplanes whenever they are transverse. Fix a basepoint o ∈ X. Also, we assume that the hyperplanes of X are two-sided and fix an orientation on the hyperplanes of X. A loop in X (1) based at o can be thought of as a sequence of oriented edges, to which we can associate a formal word written over {hyperplanes of X} ±1 (an oriented edge e being sent to the hyperplane it crosses or its inverse depending on whether the orientations of e and the hyperplane agree). This correspondence induces a well-defined morphism to the right-angled Artin group A(∆X). (See Section 2.4 for a definition a right-angled Artin groups.) In full generality, we do not know anything about the morphism A X . It may be even trivial. However, it turns out to be injective as soon as X is conspicial [HW08, Theorem 4.2]. Thus, fundamental groups of conspicial cube complexes inherit all the properties satisfied by right-angled Artin groups and stable under taking subgroups. This includes for instance: • being linear over Z (and, as a consequence, being residually finite); • satisfying a strong Tits alternative, namely every subgroup either is free abelian or contains a non-abelian free subgroup.
If moreover the conspicial cube complex is compact, then its fundamental group is nicely embedded into the corresponding right-angled Artin groups: it defines a convexcocompact subgroup. This allows us to strengthen the residual finiteness previously mentioned and to deduce that convex-cocompact subgroups in our fundamental group are separable [HW08, Corollary 7.9].
A natural question to ask now is: when are Squier cube complexes conspicial?
Proposition 4.25 ([Gen18]). Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. The Squier cube complex S + (P, w) is conspicial if and only if the following conditions are satisfied: • there are no words a, b, p ∈ Σ + such that w = ab, a = ap, and b = pb modulo P with [p] P = {p}; • there are no words a, u, v, w, b, p, q, ξ ∈ Σ + such that w = auvwb, au = au(vξ), and wb = (ξv)wb modulo P with uv = p, vw = q in R.
Here, [p] P denotes the set of all the words in Σ + equal to p modulo P. It is worth noticing that, if the condition from the first item fails, then {ap n b | n ≥ 0} ⊂ [w] P ; and, if the condition from the second item fails, then Consequently, if we know that [w] P is finite, then it follows immediately from the proposition that our Squier cube complex is conspicial.
Corollary 4.26 applies to the right-angled Artin groups and pure planar braid groups from Section 2.4. It does not apply to the group Z•Z, but Proposition 4.25 holds anyway. It is worth mentioning that not all diagram groups can be described as fundamental groups of conspicial cube complexes. Thompson's group F is such an example since it is not even residually finite.
In Corollary 4.26, the Squier cube complex is conspicial but also compact. Therefore, this allows us to deduce that convex-cocompact subgroups in the corresponding diagram group are separable. One instance of this assertion is given by: Gen18]). Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword with [w] P finite. Fix a (w, x 1 u 1 · · · x n u n x n+1 )-diagram ∆. The morphism

is injective and its image is a separable subgroup of D(P, w).
Let us describe explicitly the morphism A X above in the specific case of our Squier cube complexes. So we fix a semigroup presentation P = Σ | R and a baseword w ∈ Σ + . The oriented edges of S + (P, w) can be written as (a, u → v, b)  • are transverse if and only if there exists some y ∈ Σ + such that either c = auy and b = ypd modulo P or d = yub and a = cpy modulo P [Gen18, Lemma 3.2].
Let A(P, w) be the right-angled Artin groups given by the crossing graph of S + (P, w). The generators of A(P, w) are the oriented hyperplanes [a, u → v, b] where u = v belongs to R. The map that sends each oriented edge (a, It is injective as soon as the conditions of Proposition 4.25 are satisfied. This happens for instance when [w] P is finite.
Example 4.28. Let us consider the following semigroup presentation: The diagram group D(P, a 1 b 1 ) is the group Z • Z described in Section 2.4. According to Proposition 4.25, the Squier cube complex S + (P, a 1 b 1 ) is conspicial, so our morphism A(P, w 1 b 1 ) → A(P, a 1 b 1 ) is injective.
Using our previous description of hyperplanes, we find that S + (P, a 1 b 1 ) has eight hyperplanes: a 1 → a 1 p, b 1 ], and D := [a 1 , b 1 → pb 1 , 1]. Moreover, we find that the crossing graph of S + (P, a 1 b 1 ) is a complete bipartite graph K 4,4 , where each vertex of {A 1 , A 2 , A 3 , C} is connected by an edge to each vertex of {B 1 , B 2 , B 3 , D}. In particular, A(P, Then, by using Theorem 3.2 or Proposition 4.30 below, we find that Z • Z is generated by the three diagrams given by Figure 11. For instance, the first diagram corresponds to the loop of edges: (1, a 1 → a 2 , b 1 ), (1, a 2 → a 3 , b 1 ), (1, a 3 → a 1 , b 1 ), We conclude that the subgroup is isomorphic to Z • Z. The embedding can be simplified to an embedding into F 2 × F 2 ; we refer to [Gen18, Example 3.17] for more details.
From a more geometric perspective, it is possible to use the structure of hyperplanes in the Squier cube complexes in order to construct quasi-isometric embeddings from diagram groups into product of trees. More precisely: Proposition 4.29. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. If D(P, w) satisfies the Burillo property and if S + (P, w) has finite dimension d, then D(P, w) quasi-isometrically embeds into a product of d trees. As a consequence, D(P, w) has finite asymptotic dimension ≤ d and its Hilbert space compression is 1.
The last assertion of the proposition follows from the first part but also from [Wri12] and [GK04]. One easily observes that S + (P, w) has dimension ≤ d if and only if d is the smallest integer k for which there exist u 1 , . . . , u k ∈ Σ + such that w = u 1 · · · u k modulo P and such that [u i ] P = {u i } for every 1 ≤ i ≤ k. For instance, S + (P, w) is automatically finite-dimensional when [w] P is finite.
Proof of Proposition 4.29. First of all, we need to introduce some notation and vocabulary.
Let J 1 and J 2 be two hyperplanes in S + (P, w). If they meet inside a square (a, u → v, b, p → q, c) with [a, u → v, bpc] = J 1 and [aub, p → q, c] = J 2 , then we write J 1 ≺ J 2 . This relation allows us to define the rank of a hyperplane J in S + (P, w) as rank(J) := max{n ≥ 0 | there exist J 1 , . . . , J n with J 1 ≺ · · · ≺ J n ≺ J}.
Because any two ≺-related hyperplanes must be transverse, the rank of a hyperplane lies between 0 and d − 1. By extension, we define the rank of a hyperplane in the median graph M (P, w) as the rank of its image by the covering map M (P, w) → S + (P, w).
Thus, we get a colouring of the hyperplanes of M (P, w) with d colours given by the rank such that any two hyperplanes of the same colour cannot be transverse. This implies that M (P, w) embeds isometrically into a product of d trees (endowed with the 1metric), which allows us to conclude since D(P, w) embeds isometrically into M (P, w) as a consequence of the Burillo property.
Let us describe how M (P, w) can be embedded into a product of d trees. For every 0 ≤ i ≤ d − 1, let T i denote the graph whose vertices are the connected components of the graph obtained by cutting M (P, w) along all the hyperplanes of rank i and whose edges connect two components whenever they are separated by a single hyperplane of rank i; because no two hyperplanes of rank i are transverse, T i is a tree; moreover, there is a natural projection M (P, w) → T i sending a vertex to the connected component it belongs to, and the distance in T i between the projections of two vertices x, y ∈ M (P, w) coincides with the number of hyperplanes of rank i separating x and y. Thus, the product of these projections yields a map M (P, w) → T 0 × · · · × T d−1 such that the distance between the images of two vertices x, y ∈ M (P, w) coincides with the sum over i of the number of hyperplanes of rank i separating x and y, i.e. the total number of hyperplanes separating x and y, which is exactly the distance between x and y in M (P, w).
We conclude this section by explaining how one can use hyperplanes in order to decompose Squier cube complexes as graphs of spaces and to compute presentations of diagram groups. Before stating our decomposition theorem, we need to introduce some vocabulary.
So let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. A hyperplane Proposition 4.30. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. Let J denote the set of left hyperplanes of S + (P, w) and let G(P, w) be the graph of spaces defined by: • the set of vertex-spaces is • the edge-maps are the canonical maps and S + (P, a) × S + (P, b) → S + (P, a)vS + (P, b).
Then G(P, w) defines a decomposition of S + (P, w) as a graph of spaces.
As an illustration of the proposition, let us compute a presentation of some diagram group.
Then S + (P, a 1 b 1 ) contains four left hyperplanes: [1, a 1 → a 2 , b 1 ], [1, a 2 → a 3 , b 1 ],  [1, a 3 → a 1 , b 1 ], and [1, a 1 → a 1 p, b 1 ]. Thus, the vertex-spaces of our graph of spaces will be a 1 S(P, b 1 ), a 2 S(P, b 1 ), and a 3 S (P, b 1 ). The graph of spaces given by Proposition 4.30 is then: The maps associated to the loop are induced by w 0 → a 1 w 0 and w 0 → a 1 pw 0 . On the other hand, the Squier complex S(P, b 1 ) is easy to draw: In particular, its fundamental group is isomorphic to F ∞ = x 1 , x 2 , . . . | .
Thus, D(P, a 1 b 1 ) may be decomposed as the graph of groups illustrated on the left, where the maps associated to the three edges on the left are identities, and where the two maps associated to the loop are the identity and the morphism induced by Finally, this graph of groups may be simplified into the graph of groups illustrated on the right, where the maps associated to the left loop are identities and where the two maps associated to the right loop are the identity and the morphism induced by Thus, we deduce the following presentation of our diagram group D (P, a 1 b 1 ): Noticing that x i+1 = h i x 1 h −i for every i ≥ 1, we can simplify the presentation as which is the presentation given in Section 2.4.

Acylindrical hyperbolicity
A powerful method to study groups, coming from geometric group theory, is to look for behaviours of negative curvature. We saw with Theorem 2.24 that there is essentially no hyperbolicity in diagram groups, and it can be expected that a similar phenomenon occurs for relative hyperbolicity (see Conjecture 6.15). Nevertheless, acylindrical hyperbolicity is sufficiently weak to encompass interesting examples of diagram groups and sufficiently restrictive to provide valuable information.
Formally, a group G is acylindrically hyperbolic if it admits an action on some (Gromov-)hyperbolic space X which is both non-elementary (i.e. with an infinite limit set) and acylindrical (i.e. for every d ≥ 0, there exist L, N ≥ 0 such that #{g ∈ G | d(x, gx), d(y, gy) ≤ d} ≤ N for all x, y ∈ X satisfying d(x, y) ≥ L). Acylindrical hyperbolicity can be thought of as a weak phenomenon of negative curvature, but which nevertheless provides strong restrictions on the structure of the group under consideration. For instance: • Acylindrically hyperbolic groups admit many quotients. This is a consequence of small cancellation [DGO17] and Dehn fillings [Hul16]. For instance, every acylindrically hyperbolic group G is SQ-universal (i.e. every countable group embeds into a quotient of G); • Acylindrically hyperbolic groups contain many free subgroups. This can also be seen as a consequence of small cancellation [DGO17] since the normal subgroups produced are free. But we can also justify this assertion by using the Property P naive [AD19] or the fact that random random subgroups are free [MS19].
• Acylindrically hyperbolic groups admit many quasimorphisms [BF02]. In particular, this implies that the second bounded cohomology group has uncountable dimension.
• An acylindrically hyperbolic group G does not contain an infinite abelian subgroup H that is s-normal (i.e. H ∩ gHg −1 is infinite for every g ∈ G) [Osi16]. In particular, centres of acylindrically hyperbolic groups are finite.
• An acylindrically hyperbolic group does not decompose as the direct sum of two infinite groups [Osi16].
Diagram groups may or may not be acylindrically hyperbolic. Obvious examples of acylindrically hyperbolic diagram groups are non-abelian free groups.
More interesting examples will be given in this section. On the other hand, free abelian groups, Thompson's group F , and the lamplighter group Z Z are not acylindrically hyperbolic (since they do not contain any non-abelian free subgroup). Is it possible to recognise whether or not a given diagram group is acylindrically hyperbolic?
Even though the median graphs constructed in Section 4.2 are usually not hyperbolic, it turns out that there exist efficient methods that allow us to deduce that a group is acylindrically hyperbolic thanks to an action on a median graph; see [Gen19b] and references therein. One of these methods is to look for specific isometries that behave like isometries in hyperbolic spaces. More precisely: Definition 4.32. Let X be a metric space. An isometry g ∈ Isom(X) is contracting if there exists a basepoint o ∈ X such that the map n → g n · o induces a quasi-isometric embedding Z → X; and if there exists some D ≥ 0 such that the nearest-point projection on g · o of every ball disjoint from g · o has diamter at most D.
It turns out that a group acting properly on a metric space with at least one contracting isometry must be either virtually infinite cyclic or acylindrically hyperbolic. Therefore, a natural problem is to determine when an element of a diagram group induces a contracting isometry on the corresponding median graph.
Theorem 4.33 ([Gen20]). Let P = Σ | R be a semigroup presentation, w ∈ Σ + a baseword, and g ∈ D(P, w) a non-trivial absolutely reduced element. Then g is a contracting isometry of M (P, w) if and only if the following conditions are satisfied: • g ∞ does not contain any infinite proper prefix (i.e. g ∞ does not decompose as a concatenation Φ • Ψ with Φ infinite and Ψ non-trivial); • if ∆ is are reduced diagram with g ∞ as a prefix, then ∆ differs from g ∞ by only finitely many 2-cells.
Roughly speaking, an infinite diagram refers to the object ∆ 1 • ∆ 2 • · · · obtained by concatenating infinitely many finite diagrams ∆ 1 , ∆ 2 , . . . over a given semigroup presentation. In particular, g ∞ denotes the infinite diagram obtained by concatenating infinitely many copies of the diagram g. We refer to [Gen20] for a more formal description.  Then g ∞ clearly contains a proper infinite prefix. Therefore, g is not a contracting isometry of M (P, ab). Then g ∞ is a prefix of the diagram ∆ given by Figure 13, but ∆ contains infinitely many 2-cells not in g ∞ . Therefore, g is not a contracting isometry of M (P, a 2 ).
Example 4.36. Let P = a, b, c, d | ab = ac, cd = bd and let g ∈ D(P, ab) be the spherical diagram illustrated by Figure 14. Then the infinite diagram g ∞ is given by Figure 14. We can notice that g ∞ does not contain a proper infinite prefix and that any diagram containing g ∞ as a prefix is necessarily equal to g ∞ . Therefore, g yields a contracting isometry of M (P, ab). One easily verifies that D(P, ab) is not infinite cyclic, so D(P, ab) is acylindrically hyperbolic.  a 1 , a 2 , a 3 , b 1 , b 2 corresponding to the diagram group Z•Z, and let g be the element given by the following spherical diagram: Then it can be verified that g is a contracting isometry of M (P, a 1 b 1 ), proving that Z • Z is acylindrically hyperbolic. (In fact, it can be proved that A • B is always acylindrically hyperbolic when the groups A and B are both non-trivial; see [Gen20, Example 5.44] for more details.) However, applying Theorem 4.33 becomes painful. We refer to [Gen20, Proposition 5.39] for an efficient method that allows us verify the conditions given by Theorem 4.33 more easily.
Theorem 4.33 only provides a sufficient condition to be acylindrically hyperbolic. In fact, the diagram group may be acylindrically hyperbolic but with no contracting isometries in the associated median graph. However, when the action on the median graph is cocompact, the criterion turns out to provide a necessary and sufficient condition.
We already mentioned that acylindrically hyperbolic groups do not split as product of infinite groups. Theorem 4.37 shows that this is essentially the only obstruction for a cocompact diagram group to be acylindrically hyperbolic.

Diagram products and quasi-median geometry
Diagram products, first introduced in [GS99], can be thought of as diagram groups with coefficients, where the coefficients come from some collection of groups (the factors of the product). Below, we follow the definition given in [Gen17a].
Definition 4.38. Let P = Σ | R be a semigroup presentation, G = {G s | s ∈ Σ} a collection of groups, and w ∈ Σ + a baseword. The diagram product D(P, G, w) is the group whose elements are the diagrams over (P, G) modulo dipole reductions and whose product is given by the concatenation.
As an illustration, consider the semigroup presentation P = a, b, c | ab = ba, ac = ca, bc = cb and the factors Here is a product of two diagrams over (P, G): We emphasize that the rightmost diagram is reduced (even though there is a dipole when we remove the labels coming from the factors).
In the same way that diagram groups can be described both in terms of diagrams and as fundamental groups of Squier complexes, it is also possible to describe diagram products as fundamental groups of specific complexes, which we describe now.
Definition 4.39. Let P = Σ | R be a semigroup presentation and G = {G s | s ∈ Σ} a collection of groups indexed by Σ. The Squier complex S(P, G) is the square complex whose vertex-set is Σ + with • an edge (a, u → v, b) between the words aub and avb whenever (u = v) ∈ R; • a loop b(g) based at w = 1 · · · n ∈ Σ + for every g ∈ G(w) := G 1 × · · · × G n ; • a square delimited by the four vertices aubpc, avbpc, aubqc, and avbqc whenever (u = v), (p = q) ∈ R; • a triangle delimited by the three loops based at w labelled by g, h, gh ∈ G(w); • a cylinder between the loops labelled by The reader familiar with complexes of groups should recognise the topological realisation of a simple complex of groups with the Squier square complex S(P) as the underlying complex; we refer to [BH99, Chapter II.12] for more information on simple complexes of groups. In [GS99], diagram products are defined as fundamental groups of such complexes. This point of view is equivalent to the definition presented here. The proof of Proposition 4.40 is basically the same as the proof of Corollary 2.5. It can be shown that a diagram product of diagram groups yields a diagram group. More precisely: Theorem 4.41 ([GS99]). Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. For every s ∈ Σ, fix a semigroup presentation P s = Σ s | R s and a baseword w s ∈ Σ + . Assume that the alphabets Σ, Σ s (s ∈ Σ) are pairwise disjoint. The diagram product D(P, G, w), where G := {D(P s , w s ) | s ∈ Σ}, is isomorphic to the diagram group given by the semigroup presentation and the baseword w.
It is worth noticing that some of the examples given in Section 2.4 arise in this way.
Because diagram groups admit a natural median geometry, it is reasonable to expect diagram products to admit a median geometry relative to their factors. This idea is formalised in [Gen17a] through quasi-median geometry. (Compare with Remark 4.48 below.) Definition 4.42. Let X be a connected graph. Given three vertices x 1 , x 2 , x 3 ∈ X, a median triangle is the data of three vertices y 1 , y 2 , y 3 ∈ X such that Its size if d(y 1 , y 2 ) + d(y 2 , y 3 ) + d(y 3 , y 1 ). The graph X is quasi-median if any three vertices admit a unique median triangle of minimal size and if the gated hull of any such median triangle is a product of complete graphs.
Recall that, given a graph X, a subgraph Y ⊂ X is gated if, for every x ∈ X, there exists some z ∈ Y (referred to as the gate or projection) that belongs to at least one geodesic from x to y for every y ∈ Y . Notice that, when it exists, the gate is unique and it minimises the distance to x from Y . Gatedness should be thought of as a strong convexity.
In the same way that median graphs can be described as one-skeleta of nonpositively curved cellular complexes, namely CAT(0) cube complexes, quasi-median graphs can be described as one-skeleta of CAT(0) prism complexes (where a prism refers to a product of simplices) [Gen17a].
Definition 4.43. Let P = Σ | R be a semigroup presentation and G = {G s | s ∈ Σ} a collection of groups. Let QM(P, G) denote the graph whose vertices are the diagrams over (P, G) modulo dipole reductions and whose edges connect two diagrams if one can be obtained from the other by right-multiplying by a unitary diagram (i.e. a diagram that either contains a single cell and all of whose edges have trivial second coordinates in their labels, or has no cell and a single edge with a non-trivial second coordinate in its label).
One easily sees that two diagrams belong to the same connected component of QM(P, G) if and only if the labels in Σ + (i.e. when the second coordinates are forgotten) of their top paths are identical. Given a baseword w ∈ Σ + , we denote by QM(P, G, w) the connected component containing the diagrams whose top paths are labelled by w in Σ + . The diagram product D(P, G, w) naturally acts on QM(P, G, w) by left-multiplication.  The combination of the combinatorics of diagrams and the quasi-median geometry allows us to deduce a lot of information about diagram products. For instance: • A finitely generated diagram product has a solvable word problem if so do its factor.
• A diagram product is torsion-free if and only if so are its factors.
• Distorted elements in a diagram product belong to products of factors.
• A diagram product of groups acting nicely on median graphs acts nicely on median graphs [Gen17a, Theorems 10.36-10.38].
• The Hilbert space compression of a diagram product is bounded below by the compressions of its factors [Gen17a, Theorem 10.39].
It is worth noticing that every diagram product D(P, G, w) surjects onto its underlying diagram group D(P, w) via the map that "forgets" the labels coming from the factors. Conversely, it is clear that D(P, w) embeds into D(P, G, w): it corresponds to the diagrams all of whose edges have labels with trivial second coordinates (referred to as diagrams over P for simplicity). Therefore, diagram products split as semidirect products. More precisely: where A(P, G, w) is a graph product whose vertex-groups are isomorphic to group in G.
We refer to [Gen17a,Theorem 10.58] for an even more precise statement. Recall that, given a graph Γ and a collection of groups G = {G u | u ∈ V (Γ)} indexed by the vertices of Γ, the graph product ΓG is where [G u , G v ] = 1 is a shorthand for: [a, b] = 1 for all a ∈ G u and b ∈ G b . Usually, graph products are described as an interpolation between free products (when Γ has no edge) and direct sums (when Γ is a complete graph).
The strategy to prove the theorem is the following. Let Y denote the subgraph of M (P, G, w) given by the diagrams over P. Its stabiliser under the action of D(P, G, w) coincides with D(P, w). Also, let J denote the collection of all the hyperplanes in M (P, G, w) tangent to Y . In a quasi-median graph, a hyperplane is a class of parallel cliques (i.e. maximal complete subgraphs) instead of parallel edges in the case of median graphs. To each hyperplane corresponds a rotative-stabiliser, i.e. the subgroup of its stabiliser that stabilises each of the cliques it contains. Thanks to a Ping-Pong Lemma, it can be shown that the subgroup generated by the rotative-stabilisers of all the hyperplanes in J decomposes as the graph product of the rotative-stabilisers over the crossing graph of J (i.e. the graph whose vertex-set is J and whose edges connect two hyperplanes whenever they are transverse). This is our graph product A(P, G, w). One easily verifies that D(P, w) normalises and intersects trivially A(P, G, w). The proof is complete once it is shown that A(P, G, w) and D(P, w) generate the diagram product.
As an application of Theorem 4.45, it is possible to prove the following theorem, initially obtained in [GS06b] by using different methods.
Theorem 4.46. Every diagram group G satisfies a short exact sequence where R is a subgroup of a right-angled Artin group and where S is a subgroup of Thompson's group F .
The strategy is the following. Let P = Σ | R be an arbitrary semigroup presentation and w ∈ Σ + a baseword. The goal is to prove that that D(P, w) embeds into the diagram product D(Q, G, x) where Q = x | x = x 2 and where G x is the free group F formally generated by the relations in R. The desired conclusion will follow since D(Q, G, x) splits as a semidirect product of a right-angled Artin group with Thompson group's F as a consequence of Theorem 4.45.
In order construct such an embedding, we fix, for every n ≥ 1, a well-chosen (x n , x)diagram Γ n over Q. Then, we transform a diagram ∆ over P into a diagram over (Q, G) by replacing each cell of ∆ labelled by a relation u = v with the diagram Γ n • (f ) • Γ −1 m , where n is the length of u, m the length of v, and (f ) the diagram reduced to a single edge labelled by (x, f ) with f the (inverse of the) generator of F corresponding to u = v.
Because right-angled Artin groups and Thompson's group F are locally indicable, and since locally indicable groups are automatically orderable, Theorem 4.46 immediately implies: Corollary 4.47. Diagram groups are locally indicable, hence orderable.
Remark 4.48. It is worth noticing that one can make a diagram product D(P, G, w) act on a median graph instead of a quasi-median graph. Given a diagram ∆ and a (possibly empty) collection of edges in the bottom path of ∆, let ∆( ) denote the set of the diagrams obtained from ∆ by modifying the second coordinates in the labels of the edges in . Observe that ∆( ) defines a coset in the groupoid of the diagrams over (P, G). Let M (P, G) denote the graph whose vertices are the cosets ∆( ) and whose edges connect two cosets Φ(ζ) and Ψ(ξ) either if Ψ = Φ and the symmetric difference between ζ, ξ has cardinality one or if Ψ is obtained from Φ by gluing a 2-cell below Φ along a path disjoint from ζ and ξ is the image of ζ after the process. Then the diagram product D(P, G, w) acts on a connected component M (P, G, w) of M (P, G) with stabilisers isomorphic to products of factors. In fact, M (P, G) and QM(P, G) are basically subdivisions of a common space, but in practice it turns out to be easier and more natural to work with the quasi-median graph.

Planar, annular, and symmetric diagram groups
Let P = Σ | R be a semigroup presentation. Given a diagram over P, one can construct a dual picture made of transistors which are connected by wires labelled by Σ. See Figure 16. Roughly speaking, a transistor is a black box with top and bottom wires such that, if u ∈ Σ + (resp. v ∈ Σ + ) is the word obtained by reading from left to right the labels of its top (resp. bottom) wires, then u = v or v = u belongs to R. All the terminology introduced in Section 2 for diagrams can be easily adapted to pictures. For instance, a dipole in a picture refers to two transistors τ 1 , τ 2 labelled by u = v and v = u for some relation in R such that bottom wires of τ 1 and the top wires of τ 2 coincide. One reduces the dipole by removing the two transistors and connecting the top wires of τ 1 with the bottom wires of τ 2 .
This alternative point of view allows us to generalise diagram groups in several natural directions. Our initial diagram groups, now referred to as planar diagram groups, have their elements represented by pictures whose wires do not cross and are monotonic in the vertical direction. A similar definition on annuli yields annular diagram groups. And allowing wires to cross in an arbitrary way yields symmetric 3 diagram groups. We do not give precise definitions and refer to [Far05a] for more details. See Figures 17 and 18 for examples of products of annular and symmetric pictures.
Thus, given a semigroup presentation P = Σ | R and a baseword w ∈ Σ + , we have three nested groups D p (P, w) ⊂ D a (P, w) ⊂ D s (P, w)  given by the corresponding planar, annular, and symmetric diagram groups. As shown below, for P = x | x = x 2 and w = x, one recovers the three classical Thompson groups F ⊂ T ⊂ V .
Annular and symmetric diagram groups are sketched in [GS97] and further investigated in [Far05a]. Compared to (planar) diagram groups, much less is known about these groups. Nevertheless, let us record what can be extracted from the existing literature.
Word problem. Similarly to diagrams, every planar, annular, or symmetric picture admits a unique reduced representative, i.e. reducing the dipoles, whatever the order we follow, always yields the same picture. See [Far05a]. As a consequence: Proposition 5.1. Planar, annular, and symmetric diagram groups have solvable word problems.
Indeed, given a picture representing an element of the group, it suffices to reduce its dipoles. Once we get a reduced picture, we know that our element is trivial if and only if the picture is reduced to a collection of vertical wires.
Median geometry. The construction described in Section 4.2 generalises to annular and symmetric diagram groups [Far05a]. Given a semigroup presentation P, we can construct a median graph M s (P) as follows. The vertices are the symmetric pictures over P modulo dipole reduction and right-multiplication by a symmetric picture (i.e. a picture with no transistor). And the edges connect the classes of two pictures when one can be obtained from the other by adding a transistor at its bottom. The graph M s (P) turns out to be median, and the symmetric diagram group D s (P, w), given a baseword w, naturally acts by left-multiplication on the connected component M s (P, w) containing the picture with only vertical wires labelled by the word w. Restricting to annular pictures, one gets similarly a median graph M a (P, w) on which the annular diagram group D a (P, w) acts. Consequently, Theorem 4.9 generalises as: Far05a]). Annular and symmetric diagram groups act properly on median graphs locally of finite cubical dimension.
Contrary to planar diagram groups, annular and symmetric diagram groups are usually not torsion-free, since it is possible to permute the wires. More precisely, given an annular (resp. a symmetric) diagram group D a (P, w) (resp. D s (P, w)) and a picture ∆ with top label w, the subgroup given by the pictures ∆ · permutation of the bottom wires of ∆ · ∆ −1 is always finite (but possibly trivial). We refer to such a subgroup as a permutation subgroup. In annular diagram groups, permutation subgroups are always cyclic. It turns out that permutation subgroups are sufficient to understand finite subgroups, and more generally finitely generated torsion subgroups: Corollary 5.3. In an annular or symmetric diagram group, every finitely generated torsion subgroup is contained in a permutation subgroup.
Proof. Because the median graph on which our diagram group acts is locally of finite cubical dimension, every finitely generated torsion subgroup must fix a vertex [GLU21b, Theorem 4.23]. But it follows from the construction of the median graph that vertexstabilisers are permutation subgroups.
It is worth noticing, in view of Corollary 5.3, that annular and symmetric diagram groups may contain infinite torsion subgroups. For instance, the Houghton groups described below contain the group of finitely supported permutations of an infinite set.
We can also deduce from Theorem 5.2 analogues of Theorem 2.23 and Proposition 2.27 Corollary 5.4. In annular and symmetric diagram groups, polycyclic subgroups are virtually abelian and undistorted.
Proof. If a group acts properly on a median graph, then its finitely generated abelian subgroups are automatically undistorted [Cor13, Corollary 6.B.5] and its polycyclic subgroups are automatically virtually abelian [Cor13, Corollary 6.C.8].
Corollary 5.5. In annular and symmetric diagram groups, an infinite-order element cannot be an arbitrarily large power.
Proof. If g is an infinite-order element in our annular or symmetric diagram group, it follows from [Hag07] that it acts as a translation on some bi-infinite geodesic line. Let g denote the length of this translation. If the equality a = b k holds in our group, where a, b are elements of infinite order, then since translation length are integers. Thus, |k| cannot be arbitrarily large.
As a consequence, annular and symmetric diagram groups cannot contain Q. This contrasts with, for instance, the liftT of Thompson's group T in Homeo(R) [BHM22].

Finiteness properties.
Even though annular and symmetric diagram groups do not act freely on their median graphs, the properness of the actions is still allows us to deduce that some diagram groups satisfy good finiteness properties. The easiest case is when the actions are cocompact, providing an analogue of Proposition 4.14.
Proposition 5.6. Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. If [w] P is finite, then the annular and symmetric diagram groups D a (P, w) and D s (P, w) are of type F ∞ .
A more interesting result, an analogue of Theorem 4.15 which is proved using the same strategy based on Morse theory, is: Far05b]). Let P = Σ | R be a semigroup presentation and w ∈ Σ + a baseword. If the oriented graph Γ a (P) (resp. Γ s (P)) does not contain an infinite oriented ray and contains only finitely many sink vertices, then D a (P, w) (resp. D s (P, w)) is of type F ∞ .
Here, Γ a (P) (resp. Γ s (P)) is the oriented graph whose vertices are the words in Σ + modulo cyclic permutation (resp. modulo permutation) and whose oriented edges connect a given word aub to a word avb whenever u = v belongs R.
Diagram products. Let P = Σ | R be a semigroup presentation, G = {G s | s ∈ Σ} a collection of groups indexed by Σ, and w ∈ Σ + a baseword. By labelling the wires of annular and symmetric pictures with elements from groups in G, one can naturally extend the definitions from Section 4.7 in order to define annular and symmetric diagram products. This is done in [Gen19a], where the quasi-median geometry is also extended. This allows us to prove an analogue of Theorem 4.45 and to prove a statement similar to Theorem 4.46, namely: Theorem 5.8 ( [Gen19a]). Every annular (resp. symmetric) diagram group satisfies a short exact sequence where R is a subgroup of a right-angled Artin group and S is a subgroup of Thompson's group T (resp. V ).
For instance, this implies that every simple annular (resp. symmetric) diagram group embeds into Thompson's group T (resp. V ). This excludes in particular the higher dimensional Thompson groups nV for n ≥ 2 [Bri04].
Examples. Let P = x | x = x 2 . A reduced annular (resp. symmetric) (x, x)-picture over P can always be written as the concatenation of a positive picture (i.e. all of whose transistors are labelled by x = x 2 ), followed by a cyclic permutation (resp. a permutation) of the wires, and finally by a negative picture (i.e. all of whose transistors are labelled by x 2 = x). Such a structure immediately yields a triple (T 1 , σ, T 2 ) where T 1 , T 2 are two finite rooted 2-regular trees with the same number of leaves, say n, and where σ is a cyclic permutation (resp. a permutation) of n elements. This correspondence induces an isomorphism from the annular diagram group D a (P, x) to Thompson's group T (resp. from the symmetric diagram group D s (P, x) to Thompson's group V ). We refer to [CFP96] for more information about the representations of elements of T and V as pairs of trees.
These examples can be found in [GS97].
Other interesting examples can be found in [FH18], namely the Houghton groups H n and the symmetrisation QV of Thompson's group V .
Given an n ≥ 1, let R n denote the union of n disjoint infinite rays. The Houghton group H n is the group of the bijections R n that preserve the ends of the graph R n and that preserve adjacency and non-adjacency for all but finitely many pairs of vertices. In other words, an element of H n acts by translations outside a finite set of R n and it permutes the vertices of this set in an arbitrary way. Since, on each infinite ray, an element of H n acts as a translation, we have n morphisms H n → Z giving the corresponding translation lengths (positive if the vertices are translated towards infinity, negative otherwise). In order to get a bijection R n , the sum of these translation lengths must be zero. Thus, one deduces a short exact sequence The definition of QV has a similar flavor. Let T denote the rooted 2-regular tree with a fixed embedding in the plane (so each vertex has two children: a left and a right). Then QV is the group of the bijections T (0) → T (0) that preserves adjacency, non-adjacency, and left-right order on the children with only finitely many exceptions. Notice that QV has a well-defined action on the boundary of T , which is a Cantor set. This action turns out to coincide with the usual definition of Thompson's group V as a group of homeomorphisms of the Cantor set. Hence a short exact sequence where S ∞ is identified with the finitely supported permutations of T (0) . Proposition 5.9 ( [FH18]). For every n ≥ 2, the Houghton group H n is isomorphic to the symmetric diagram group D s (P n , r) where P n := a, x 1 , . . . , x n | x 1 = x 1 a, . . . , x n = x n a .
The group QV is isomorphic to the symmetric diagram group D s (Q, x) where Q := a, x | x = xax . Figure 19 illustrates how to describe the second Houghton group as a symmetric diagram group. The philosophy is the same for the other Houghton groups and for QV . See [FH18,Examples 4.3 and 4.4] for more details. Notice that, by the same argument, one can show that the groups QV n,r , which are defined by replacing our previous rooted tree T with a forest of r rooted n-regular trees, are also symmetric diagram groups. Figure 19: D s ( a, x 1 , x 2 | x 1 = x 1 a, x 2 = ax 2 , x 1 x 2 ) isomorphic to H 2 .

Braided-like diagram groups
In addition to planar, annular, and symmetric diagram groups, it would be natural to define braided diagram groups, where wires in pictures are thought of as strands in braids. This variation has not been defined properly in the literature yet. Nevertheless, the following results can be reasonably expected: • The braided diagram group D b (P, x), where P = x | x = x 2 , coincides with the braided Thompson group brV [Deh06,Bri07].
• A braided diagram group acts on a median graph with vertex-stabilisers isomorphic to finitely generated braid groups. As a consequence, it is torsion-free.
• Polycyclic subgroups in braided diagram groups are virtually abelian and undistorted.
• Every braided diagram group G satisfies a short exacst sequence where R is a subgroup of a right-angled Artin group and where S is a subgroup of brV .
It would interesting to know whether braided diagram groups are bi-orderable. In other words, is it possible to combine the bi-orderability of braid groups and (planar) diagram groups in order to deduce the bi-orderability of braided diagram groups?
In this direction, we can imagine as many diagram-like groups as there are braided-like groups. This could include virtual diagram groups, in reference to virtual braid groups; loop diagram groups, in reference with loop braid groups; cactus diagram groups, in reference to the cactus groups; etc. The variations are virtually endless.
In another direction, it is possible to treat wires differently according to the letters labelling it. There are at least two such examples available in the literature.
The first example is [AAF18], dedicated to the symmetrisation QF (resp. QT ) of Thompson's group F (resp. T ). The group QF (resp. QT ) is naturally a subgroup of QV , which is isomorphic to the symmetric diagram group D s (P, x) where P = a, x | x = axa , and its elements can be described as the pictures where the wires labelled a behave like in a planar (resp. annular) picture. This point of view allows the authors to show that the groups QF , QT , QV are of type F ∞ .
As another example, we can mention the Chambord groups introduced in [GLU21a]. Formally, they are defined thanks to specific diagrams with both strands (which are braided) and wires (which are cyclically permuted). This formalism allows the authors to describe combinatorially the asymptotically rigid mapping class groups studied in [GLU22], including the braided Ptolemy-Thompson from [FK08] and the braided Houghton groups from [Deh00,Fun07].

Monoid presentations
So far, we have only considered diagram groups defined from semigroup presentations, but it is also possible to start from monoid presentations, i.e. allowing relations of the form u = 1 where 1 corresponds to the empty word. Given a monoid presentation P = Σ | R , one can define a Squier square complex S(P) by repeating word for word Definition 2.1; and, fixing a baseword w ∈ Σ + , the diagram group D(P, w) is defined as the fundamental group of the connected component S(P, w) of S(P). Following Section 2.2, a diagrammatic description od D(P, w) can be obtained, but it is more convenient to use pictures instead of diagrams. The main difference with semigroup presentations is that, in a picture over our monoid presentation, a transistor labelled by a relation u = 1 (resp. 1 = u) has not bottom (resp. top) wires.
Two examples of dipole reduction. A reduced picture.
We refer to [GS97] for more details. Even though many techniques can be transfered from diagram groups over semigroup presentation to diagram groups over monoid presentations, a major difference is that a picture over monoid presentation may admit several reduced forms, i.e. reducing the dipoles in one order or another may lead to distinct pictures. Even worse, the problem of determining whether or not two given pictures are equivalent modulo dipole reduction may be undecidable [GS97,Theorem 13.3]. This explains why it is usually much more difficult to work with diagram groups over monoid presentations than diagram groups over semigroup presentations. As an illustration of this phenomenon, let us mention the following open question: Question 5.10 ( [GS97]). Are diagram groups over monoid presentations torsion-free?
This question illustrate how little is known about diagram groups over monoid presentations.
It is worth noticing that Question 5.10 cannot be answered with the help of median geometry as mentioned in Section 4.2. Indeed, a (connected component of the) Squier cube complex over a monoid presentation may not be nonpositively curved. For instance, if P = x | x = 1 , then the 4-cycle shows that the link of the vertex 1 is not simplicial since there is a loop based at the vertex given by the edge (1, 1 = x, 1).

Open questions
In this final section, we record various open questions related to diagram groups.
Classification of diagram groups. In view of the known examples of diagram groups, there seem to be three main families of diagram groups: those which contain a copy of Thompson's group F , those which contain a copy of the lamplighter group Z Z but not of F , and those which embed into a right-angled Artin group. Are there other big families of diagram groups? Let us ask a few precise question in this direction. It is worth noticing that, given a semigroup presentation P = Σ | R and a baseword w ∈ Σ + , we know exactly when the diagram group D(P, w) contains F or Z Z. Notice that Theorem 4.46 implies that a diagram with no free subgroup maps to F with an abelian kernel.
Isomorphism problem. Given any reasonable family of groups, a basic, but usually difficult, problem is to find how to determine whether two members of the family yield isomorphic groups.
As an easy sufficient condition, notice that, given a semigroup presentation P = Σ | R and two words u, v ∈ Σ + , the diagram groups D(P, u) and D(P, v) are isomorphic if u and v represent the same element in the semigroup defined by P. This is a immediate consequence of the fact that u and v are two vertices in the same connected component of the Squier square complex S(P), which implies that the fundamental groups are conjugate in the fundamental groupoid. The triviality problem is probably a more reasonable question before attacking Question 6.4. Question 6.5. Given a semigroup presentation P = Σ | R and a baseword w ∈ Σ + , how to determine whether the diagram group D(P, w) is non-trivial?
Algorithmic aspects. In addition to the isomorphism and triviality problems previously mentioned, there are other interesting problem that remained to be solved algorithmically. For instance: Question 6.6 ([GS97]). Given a finite semigroup presentation P = Σ | R and a baseword w ∈ Σ + , is there an algorithm computing the rank of the abelianisation of the diagram group D(P, w)?
In free groups, many problems are solved algorithmically thanks to Stallings' foldings. As mentioned in Section 3.5, a similar theory exists for directed 2-complexes and their diagram groups. However, the theory remains to be developed. Nevertheless, it is worth mentioning that Stallings' foldings have been applied with success to Thompson's group F , see for instance [GS17,Gol16,GS21]. Right-angled Artin groups. As mentioned in Section 2.4, right-angled Artin groups given by finite trees and finite interval graphs are diagram groups. On the other hand, we saw with Corollary 3.19 that right-angled Artin groups defined by triangle-free graphs with induced cycles of odd length ≥ 5 are not diagram groups. This naturally raises the following question: Question 6.11. Which (finitely generated) right-angled Artin groups can be described as diagram groups?
So far, no expected nor reasonable answer is known. A related question is: Question 6.12 ([Gen18]). Are all right-angled Artin groups subgroups of diagram groups?
For instance, even though right-angled Artin groups defined by cycles of odd lengths ≥ 5 are not diagram groups, they do embed into diagram groups 4 [Gen18].

Miscellaneous.
Recall that, given two groups G, H, the group G is residually H if, for every non-trivial g ∈ G, there exists a morphism ϕ : G → H satisfying ϕ(g) = 1. Question 6.13 ( [GS97,GS06b]). Are all diagram groups residually PL + ([0, 1])? or even residually F ? A possible strategy is the following. Let P = Σ | R be a semigroup presentation and let w ∈ Σ + a baseword. Every atomic (aub, avb)-diagram ∆ over P can be written as ( by taking a diagram Φ, decomposing it as a concatenation of atomic diagrams Φ 1 • · · · • Φ n , and sending it to H(Φ 1 ) • · · · • H(Φ n ). Is it is possible to obtain a non-trivial homeomorphism ρ(Φ) by choosing the homeomorphisms H(·) carefully?
We saw a particular instance of this construction in Section 2.4, where we described how to embed D( x | x = x 2 , x) into PL + ([0, 1]) and recognise that it coincides with Thompson's group F .
As mentioned in Section 2.5, it is proved in [Gen17b] that diagram groups with Z 2 are locally free, which implies in particular that there are no interesting hyperbolic diagram groups. First, this raises the following question: Question 6.14 ( [Gen17b]). Is a locally free diagram group necessarily free?
Next, since we saw in Section 4.6 that there are many interesting examples of acylindrically hyperbolic diagram groups, it is natural to look for relatively hyperbolic diagram groups. We conjecture that there are no interesting examples there either.
Conjecture 6.15. Relatively hyperbolic diagram groups are free products.
Question 6.16 ([GS06a]). Do the cohomological and algebraic dimensions of diagram groups always coincide?
Recall that the algebraic dimension of a group is the maximal rank of a free abelian subgroup. According to [GS06b], the answer is positive for diagram groups over complete presentations. Recall from Section 4.4 that a finitely generated diagram group satisfies the Burillo property if every word length is biLipschitz equivalent the diagram length #(·), i.e. the number of 2-cells in a reduced representative. There are examples of infinitely presented diagram groups (such as abelian and nonabelian free groups of infinite rank), examples of finitely generated diagram groups that are not finitely presented (such as Z Z and Z • Z), examples of diagram groups of type F ∞ but not of type F (such as Thompson's group F ), and examples of diagram groups of type F (such as abelian and non-abelian free groups). But there is a gap in the progression, hence: Question 6.20. Given an n ≥ 2, does there exist a diagram group of type F n+1 but not F n ?
It is worth noticing that such examples exist for symmetric diagram groups: the Houghton group H n is of type F n−1 but not of type F n [Bro87].