Three-Way Symbolic Tree-Maps and Ultrametrics

Three-way dissimilarities are a generalization of (two-way) dissimilarities which can be used to indicate the lack of homogeneity or resemblance between any three objects. Such maps have applications in cluster analysis and have been used in areas such as psychology and phylogenetics, where three-way data tables can arise. Special examples of such dissimilarities are three-way tree-metrics and ultrametrics, which arise from leaf-labelled trees with edges labelled by positive real numbers. Here we consider three-way maps which arise from leaf-labelled trees where instead the interior vertices are labelled by an arbitrary set of values. For unrooted trees, we call such maps three-way symbolic tree-maps; for rooted trees, we call them three-way symbolic ultrametrics since they can be considered as a generalization of the (two-way) symbolic ultrametrics of Bocker and Dress. We show that, as with two- and three-way tree-metrics and ultrametrics, three-way symbolic tree-maps and ultrametrics can be characterized via certain k-point conditions. In the unrooted case, our characterization is mathematically equivalent to one presented by Gurvich for a certain class of edge-labelled hypergraphs. We also show that it can be decided whether or not an arbitrary three-way symbolic map is a tree-map or a symbolic ultrametric using a triplet-based approach that relies on the so-called BUILD algorithm for deciding when a set of 3-leaved trees or triplets can be displayed by a single tree. We envisage that our results will be useful in developing new approaches and algorithms for understanding 3-way data, especially within the area of phylogenetics.


Introduction
Three-way dissimilarities are a generalization of (two-way) dissimilarities which can be used to indicate the lack of homogeneity or resemblance between any three objects in a given set [15].They have applications in areas such as psychology [10] and phylogenetics [17], where they have been used to cluster data presented in the form of three-way data tables.Various special classes of three-way dissimilarities have been introduced (see e.g.[4,9,10,15]).These include three-way dissimilarities that arise from leaf-labelled trees, where the edges are weighted by positive real numbers.These so-called three-way tree-metrics and three-way ultrametrics, Date: March 19, 2018.which arise from unrooted and rooted trees, respectively, generalize their much studied two-way counterparts (cf.[4] for an overview).
Intriguingly, in [3] Böcker and Dress showed that the concept of ultrametricity for dissimilarities can be naturally extended to include two-way symmetric maps whose range is an arbitrary set of symbols.In particular, they introduced the concept of a symbolic ultrametric (a two-way map arising from a rooted, vertexlabelled tree via the least common ancestor map), and characterized them in terms of a 3-and a 4-point condition (see Section 2 for full details), a result which had in fact been discovered independently in another guise by V. Gurvich [7] (see Section 2 for details).These conditions generalise the well-known 3-point condition for ultrametricity (cf.e.g.[18,Chapter 7.2]).Symbolic ultrametrics have been found to have interesting connections with cograph theory [11], game theory [7,8], as well as applications within phylogenetics [12,16].Therefore, it is of interest to understand how the theory of symbolic ultrametrics can be extended to three-way maps, as these may lead to useful new applications in these areas (e.g.see the last section for a potential application in phylogenetics).
In this paper, we shall address this question.Let X be a set (of taxa) of size at least 3 and let M be a set (of symbols) of size at least 2. A (three-way) symbolic map is a map δ : X 3 → M .For example, consider the unrooted tree in Figure 1(a) with leaf-set X = {1, 2, 3, 4, 5} whose interior vertices are labelled by elements from the set M = {A, B}.This tree gives rise naturally to a three-way symbolic map from X to the set M ; to each triple of leaves we assign the element of M which labels the vertex lying on all shortest paths between any two of these three leaves (e.g. the triple {1, 3, 5} is assigned the symbol A).We call symbolic maps that arise in this way three-way symbolic tree-maps.In Section 3 we show that a three-way symbolic tree-map uniquely determines its underlying labelled tree (Proposition 3.2), and also give a 4-and 5-point characterization for such maps (see Theorem 3.3).This result is mathematically equivalent to [7,Theorem 5], but for completeness we provide its proof.Our characterization for three-way symbolic tree-maps is analogous to the well-known 4-point condition for tree-metrics (cf.[18,Chapter 7.1]), and also generalizes the conditions presented in [13,Theorem 7] for determining when a three-way dissimilarity arises from a tree.To prove Theorem 3.3 we introduce a symbolic variant of the Farris transform [18, p.149], which allows us to apply the main result from [3].We conclude the section with a description of how our result is related to the ones presented in [7].
In Section 4, we turn our attention to obtaining three-way symbolic maps from rooted trees.Consider the rooted tree in Figure 1(b).A symbolic ultrametric can be associated to this tree by defining the value for each pair of leaves to be the symbol labelling the least common ancestor vertex of these two leaves.Therefore, a natural way to define a three-way symbolic ultrametric could be to take the value of each triple of leaves to be the set consisting of the symbols labelling the least common ancestor of all pairs of leaves in the triple (for example, we would assign the set {A, B} to the triple 1, 2, 5).However, this does not suffice to capture the tree (see Section 4).
Even so, as we shall see, if we consider the values of the triples to be multisets instead of sets (for example, we would assign the multiset {A, A, B} to the triple 1, 2, 5 in Figure 1(b)), then we can in fact recover the underlying labelled tree in case |X| ≥ 5 (Theorem 4.4).We call maps obtained in this way three-way symbolic ultrametrics.In Section 5, we give 3-, 4-and 5-point conditions which ensure that a three-way symbolic map that maps into the set of size 3 multisets of a set of symbols is a symbolic ultrametric.This is somewhat surprising since for three-way dissimilarities, a 6-point condition is required to ensure that they can be represented by a rooted tree in an analogous way (cf.[13,Theorem 7]).
We conclude the paper by considering an alternative approach for deciding whether or not a three-way symbolic map is a tree-map or symbolic ultrametric.This approach is based on the BUILD algorithm [1], which can be used to decide when a set of triplets (i.e. resolved rooted leaf-labelled trees each with three leaves) is displayed by some supertree or not.Applying this algorithm to three-way symbolic maps has the advantage that only sets of size three (as opposed to sets of size up to five) need to be considered so as to determine if a three-way symbolic map is a tree-map or a symbolic ultrametric.This could potentially lead to practical algorithms for performing this task.In Section 7, we present some future directions.
A symbolic ultrametric [3] is a 2-way symbolic map D : X 2 → M satisfying: (U1) For all three distinct elements x, y, z ∈ X, at least two of the three values D(x, y), D(y, z) and D(x, z) are the same.(U2) There exists no four pairwise distinct elements x, y, z, u ∈ X such that . Suppose that T is a tree.Then we denote by L(T ) the set of leaves of T and by V o (T ) := V (T ) − L(T ) the set of internal vertices of T .If T is rooted then we denote by ρ T the root of T .Moreover, for any two distinct leaves x and y in T , we define the least common ancestor lca T (x, y) of x and y in T to be the last vertex in T that lies on both of the paths which start at ρ T and end in x and in y.If lca T (x, y) is adjacent with both x and y then we call the set {x, y} a cherry of T .
We also say that vertex v in T lies below a vertex w = v in T if w lies on the path from the root of T to v.
A (rooted/unrooted) phylogenetic tree T on X is a (rooted/unrooted) tree with leaf-set X that does not contain vertices of degree two in case T is unrooted and no vertex with indegree and outdegree one in case T is rooted.Note that we will only use the terms rooted or unrooted in case it is not clear from the context which type of tree we are considering.Two phylogenetic trees T and T on X are isomorphic if there exists a bijection V (T ) → V (T ) that induces a graph isomorphism between T and T that is the identity on X (i.e. the map which takes every element in X to itself).In case T is a rooted phylogenetic tree on X and Y is a subset of X with size at least two, we let T Y denote the phylogenetic tree spanned by Y (obtained by suppressing vertices with indegree and outdegree one), and say that T Y is induced by Y .
A labelled (rooted/unrooted) tree T on X is a pair (T, t), where T is a (rooted/unrooted) phylogenetic tree on X, and t is a labelling map on M , that is, a map from the internal vertices of T to a set M of symbols.If t(u) = t(v) for every u = v contained in the same edge of T , we say that T is discriminating.A labelled rooted tree T = (T, t) on X is a representation of a (two-way) symbolic map D : X 2 → M (or T represents D) if for all distinct x, y ∈ X, we have D(x, y) = t(lca T (x, y)).Theorem 2.1 (Böcker and Dress, 1998).Let D : X 2 → M be a symbolic map.There exists a discriminating labelled rooted tree T that represents D if and only if D is a symbolic ultrametric.If this holds, then such a tree is necessarily unique.
Interestingly, Theorem 2.1 appeared in a different guise in [7] (see also [8] for more details) in the context of game theory.Within this context, the leaves of the tree T are seen as end of game situations, the label set M corresponds to a set of players, and a directed path from the root of T to a leaf is a sequence of plays.As we will come back to this correspondence in Section 3, we now review some relevant terminology and results presented in [7].
Suppose that H is an edge-labelled graph on X, that is a graph with vertex set V (H) = X and edge set E(H) = X 2 , equipped with a map D : E(H) → M for a given, nonempty set M .Then D is a (two-way) symbolic map on X, and any symbolic map D : X 2 → M can trivially be seen as an edge-labelled graph (H, D) on X.
An edge-labelled graph (H, D) on X is said to be linked if for all m ∈ M , the graph H m obtained from H by removing all edges e ∈ E(H) for which D(e) = m holds is connected.For example, both graphs ∆ and Π depicted in Figure 2 are linked.If (H, D) does not contain any linked subgraph, it is said to be separated.The following result from [7] links the property for an edge labelled graph to be separated with the representability of the symbolic map it induces.For this, it relies on the equivalence between the following three statements for a symbolic map D : X 2 → M (see [7,Theorem 2] for the equivalence between (ii) and (iii), and [7,Theorem 4] for the equivalence between (i) and (ii), where a discriminating labelled rooted tree is called a positional structure, or PS for short): (i) There exists a (unique) discriminating labelled rooted tree T that represents D. (ii) The edge-labelled graph (H, D) is separated.(iii) The edge-labelled graph (H, D) does not contain any subgraph isomorphic to ∆ or Π (depicted in Figure 2).As mentioned above, this result, and in particular the equivalence between conditions (i) and (iii), provides a direct equivalent to Theorem 2.1.Indeed, as is easy to see a symbolic map D : X 2 → M satisfies (U1) (resp.(U2)) if and only if the edge-labelled graph (H, D) does not contain a subgraph isomorphic to ∆ (resp.Π), implying that condition (iii) and the property of being a symbolic ultrametric are equivalent.

Three-way symbolic tree-maps
We begin by considering three-way symbolic maps that arise from labelled unrooted trees.Such a tree T = (T, t) clearly gives rise to a three-way symbolic map δ T : X 3 → M by putting, for all x, y, z ∈ X, δ T (x, y, z) = t(med T (x, y, z)), where med T (x, y, z) denotes the median vertex of x, y, z in T (that is, the unique vertex lying on the paths from x to y, from x to z and from y to z, respectively).If for a three-way symbolic map δ : X 3 → M , there exists a labelled unrooted tree T such that δ = δ T , we say that δ is a three-way symbolic tree-map (on X), and that T is a representation of δ (or T represents δ).We now characterize such maps.To do this, we define a symbolic Farris transform, the definition of which is adapted from the well-known Farris transform [18, p.149] as follows.
Suppose T = (T, t) is a labelled unrooted tree on X where |X| ≥ 4. Put δ = δ T .Pick a leaf r ∈ X, and define a rooted phylogenetic tree T r on X − {r} as follows: direct all edges of T away from r, and remove r and its outgoing edge.This induces a bijection ψ r from the set of internal vertices of T to the set of internal vertices of T r .Hence the map t r : V (T r ) → M which takes any internal vertex v of T r to M given by t r (v) = t(ψ −1 r (v)) is well-defined, and the pair T r = (T r , t r ) is a labelled rooted tree.Now, suppose that δ is the three-way symbolic tree-map that is represented by T , and that D r is the symbolic ultrametric on X that is represented by T r .Lemma 3.1.For all x, y ∈ X − {r} with |X| ≥ 4, we have D r (x, y) = δ(x, y, r).
Proof.It suffices to note that via the symbolic Farris transform, the median vertex of x, y and r in T becomes the least common ancestor of x and y in T r .Denoting the latter by v, we then have Motivated by this observation, for a three-way symbolic map δ : X 3 → M and some r ∈ X where |X| ≥ 4, we define the map for all x, y ∈ X distinct (which can be considered as a symbolic analogue of the Farris transform as defined in [18, p.149]).Using Lemma 3.1, we can now prove a uniqueness result.
Proposition 3.2.Let δ : X 3 → M be a three-way symbolic tree-map where |X| ≥ 4.There exists a unique discriminating labelled unrooted tree T that represents δ.
Proof.Let r ∈ X and consider the map δ r : X−{r} 2 → M .By Lemma 3.1, δ r is a symbolic ultrametric, and thus, admits a unique discriminating representation T r .Moreover, this representation is obtained from a representation of δ, using the symbolic Farris transform.This operation is clearly invertible, and preserves the property of being discriminating.Thus, the labelled unrooted tree T obtained from T r by inverting the symbolic Farris transform is necessarily the only discriminating representation of δ.
We now characterize three-way symbolic tree maps.As we shall explain below, an equivalent characterization appears in [7] in the guise of Theorem 5 of that paper.For the sake of completeness, we present a proof within our framework.Subsequent to this, we explain how the approach in [7] relates to ours.Theorem 3.3.Suppose that |X| ≥ 4 and that δ : X 3 → M is a three-way symbolic map.Then δ is a three-way symbolic tree-map if and only if δ satisfies the following two conditions: or two of these four are equal and so are the remaining two.
In order to prove Theorem 3.3, we start with a useful lemma.Lemma 3.4.Suppose that |X| ≥ 4 and that δ : X 3 → M is a three-way symbolic map satisfying (M1) and (M2).Then for all r ∈ X, the map δ r is a symbolic ultrametric.
Proof.Let r ∈ X.We need to show that δ r satisfies properties (U1) and (U2).
To see that (U2) holds, assume for contradiction that there exist four pairwise distinct elements x, y, z, u Note that the converse of the Lemma 3.4 is not true in general.Consider for example the sets X = {1, . . ., n}, n ≥ 4, M = {A, B}, and the map δ : X 3 → M defined for x, y, z ∈ X by putting δ(x, y, z) = A if 1 ∈ {x, y, z} and δ(x, y, z) = B otherwise.Clearly, δ does not satisfy (M1), as we have Armed with Lemma 3.4, we can now prove Theorem 3.3.
Proof.Assume first that δ is a three-way symbolic tree-map, and denote by T = (T, t) its representation.To see that δ satisfies (M1), consider four pairwise distinct elements x, y, z, u ∈ X.Two cases may occur.
Otherwise, there exists two pairs, say {x, y} and {z, u}, such that the path between x and y and the path between z and u are disjoint.In this case, we have med If |X| = 4 then it is straight forward to check that the theorem holds.So assume that |X| ≥ 5. To see that δ satisfies (M2), assume for contradiction that there exist pairwise distinct , u, y).We can apply the symbolic Farris transform to T and v, thus obtaining a labelled rooted tree Conversely, assume that δ satisfies Properties (M1) and (M2), and let r ∈ X.By Lemma 3.4, the map δ r is a symbolic ultrametric.Thus there exists a labelled rooted tree T r = (T r , t r ) on X −{r} representing δ r .Consider the labelled unrooted tree T = (T, t) on X defined as follows.First, add a new vertex r to T r and the edge {ρ Tr , r}.Then consider all edges in the resulting tree to be undirected.Let To prove this it suffices to consider two cases.Suppose {x, y, z} ∈ X 3 .Case (a): {x, y, z} ⊆ X − {r}.Without loss of generality, δ r (x, z) = δ r (y, z) = t r (u) and δ r (x, y) = t r (v), where u and v are vertices of T r , and v is below or equal to u in T r .In this case t(med T (x, y, z)) equals t r (v).By (M1) and since δ(x, z, r) = δ(y, z, r), we have δ(x, y, z) = δ(x, y, r) = t r (v) = t(med T (x, y, z)).Thus, T is a representation of δ in this case.Case (b): r ∈ {x, y, z}, say r = z.If we denote by v the least common ancestor of x and y in T r , then t(med T (x, y, z)) = t r (v).Hence δ(x, y, r) = δ r (x, y) = t r (v) = t(med T (x, y, r)).Thus, T is a representation of δ in this case, too.
We next elaborate on the relationship between Theorem 3.3 and Theorem 5 in [7].As mentioned in Section 2, a symbolic two-way map D : X 2 → M can be seen as an edge-labelled graph (H, D).Similarily, a symbolic three-way map δ : X 3 → M can be seen as an edge-labelled 3-hypergraph (H, δ), where by 3hypergraph, we mean that the edges of H are sets of three vertices (instead of two for graphs).Within this context, the vertex set of a 3-hypergraph H associated to a 3-way map δ is X, as in the case of two-way maps, and the edge set of H is X 3 .
The author of [7] uses as a starting point for his characterization the equivalence, presented in Section 2, between symbolic 2-way maps that can be represented by a rooted tree and edge-labelled graphs that do not contain any subgraph isomorphic to the graphs ∆ or Π (see Figure 2).The idea underlylng [7, Theorem 5] is the following.From an edge-labelled 3-hypergraph (H, δ) on X, we can pick an element r ∈ X and consider the edge-labelled graph (H, δ r ) on X − {r}.It is then possible to highlight three edge-labelled 3-hypergraph δ 2 , δ 3 , δ 4 with four vertices, that get transformed into edge-labelled graphs isomorphic to ∆ via that operation, and one edge-labelled 3-hypergraph π with five vertices, that gets transformed into an edgelabelled graph isomorphic to Π.The equivalence between the representability of δ by a labelled unrooted tree and the representability of δ r by a labelled rooted tree for all r ∈ X then leads to the conclusion that an edge-labelled 3-hypergraph (H, δ) is representable if and only if it does not contain a sub(hyper)graph isomorphic to any of δ 2 , δ 3 , δ 4 and π.
Finally, note that a similar result also appears in [6].However, the arguments used by the authors of [6] do not rely on the projection of a three-way map to a two-way map and of an unrooted tree to a rooted tree, as is the case both here and in [7].

Three-way symbolic ultrametrics
In the last section, we considered the problem of deciding when a three-way symbolic map arises from a labelled unrooted tree.In this section, we start to consider this problem for their rooted counterparts.In particular, after defining the concept of a three-way symbolic ultrametric, we shall show that to determine whether or not a three-way symbolic map is a symbolic ultrametric, it suffices to consider its restriction to sets of size five.
We begin by considering how to define a three-way symbolic ultrametric.If we consider 3 distinct leaves x, y, z of a rooted phylogenetic tree T on X, then we can clearly identify two internal vertices of the tree given by the set {lca T (x, y), lca T (x, z), lca T (y, z)} (in contrast to unrooted phylogenetic trees where we can identify only one, namely the median of the 3 leaves).A natural approach to obtain a three-way symbolic map δ from a labelled rooted tree T = (T, t) might therefore be to take δ(x, y, z) to be the set {t(lca T (x, y)), t(lca T (x, z)), t(lca T (y, z))}, for x, y, z ∈ X distinct.However, as can be seen in Figure 3 such a map does not necessarily uniquely capture T .For this reason, we shall consider instead maps to multisets.
To formalize this, let M = M M denote the set of multisets {a, b, c} with a, b, c ∈ M .As it will be useful later on, we shall also sometimes denote an element in M as a sum.So, for example, for the element {a, a, b} ∈ M with a, b ∈ M , we sometimes also write 2a + b. with labelling maps t and t on M = {A, B}, respectively, for which the sets {t(lca T (x, y)), t(lca T (x, z)), t(lca T (y, z))} and {t (lca T (x, y)), t (lca T (x, z)), t (lca T (y, z))} coincide, for any three elements x, y, z ∈ X distinct.Now, given a labelled rooted tree T = (T, t) on X, we define the three-way symbolic map δ T : for all distinct x, y, z ∈ X.If for a three-way symbolic map δ : X 3 → M there exists a labelled rooted tree T = (T, t) on X such that δ = δ T , then we call δ a three-way symbolic ultrametric (on X).Thus, intuitively, δ is a three-way symbolic ultrametric if it can be represented by labelling a rooted tree on X in such a way that, for every 3-subset {x, y, z} of X, δ(x, y, z) is the multiset consisting of the labels of the least common ancestors for all pairs of elements in {x, y, z}.In addition, we say that T is a representation for δ (or that T represents δ).We say that T is discriminating if t(u) = t(v), for every u = v contained in the same edge in T .Note that we can think of δ as a symbolic analogue of a three-way perimeter map which arises from a weighted tree T by taking, for any three leaves of T , the length of subtree spanned by the those leaves (see e.g.[4]).Also, note that by (U1), δ must satisfy the following property: Lemma 4.1.Let δ : X 3 → M be a three-way symbolic ultrametric.Then, for any three distinct elements x, y, z ∈ X, the number of distinct elements in the multiset δ(x, y, z) is at most two.
We now turn our attention to showing that we can determine whether or not a three-way symbolic map δ : X 3 → M is a symbolic ultrametric by restricting δ to subsets of X with size five.To do this, we first need to introduce some additional notation.For a subset Y of X of size four or more, let δ| Y denote the restriction of δ to Y 3 , that is, the map obtained by restricting the map δ to the subset Y δ| Y .Furthermore, we obtain a discriminating representation of δ| Y by collapsing all edges of T Y both of whose end vertices have the same label.
All possible discriminating labelled rooted trees T i , 1 ≤ i ≤ 7, on {1, 2, 3, 4}, up to a relabelling of the leaves.1.For 1 ≤ i ≤ 7 and M = {A, B, C}, the values of the map δi represented by the labelled rooted trees T i in Figure 4.The trees T i are given in terms of their index i in the top row.
We now consider symbolic ultrametrics on a set of size four.For M = {A, B, C}, in Figure 4, we picture all possible discriminating labelled rooted trees T i , 1 ≤ i ≤ 7, on {1, 2, 3, 4} and in Table 1, we list for all 1 ≤ i ≤ 7 the values of the map δi : X 3 → M that is represented by T i .As we can see from this table, all of the maps δi except for δ3 capture T i (in the sense that T i is the unique labelled rooted tree on {1, 2, 3, 4} that represents δi ).Now, for Y ⊆ X of size four, we say that δ| Y is of type δi , i ∈ {1, . . ., 7} if there exists a bijection between Y and {1, 2, 3, 4} that induces a bijection between the image of δ| Y and the image of δi such that δ| Y and δi coincide up to these bijections.Since Table 1 2. For M = {A, B} and X = {1, 2, 3, 4, 5}, a three-way symbolic map δ : X 3 → M which is not a three-way symbolic ultrametric on X but whose restriction to any subset Y ⊂ X of size four is a three-way symbolic ultrametric on Y .
We now turn our attention to symbolic ultrametrics on sets of size five.In the last result we have seen that a three-way symbolic ultrametric on a set of size 4 may have more than one representation by a labelled tree.However, as we shall now show this can not happen for sets of size five.
where for a multiset A with k ≥ 1 copies of some element a, we denote by A − a the multiset obtained by removing one copy of a.If there exists a unique element c ∈ M that belongs to all three of these sets, we have We then have D T (x 0 , y) = m(δ(y, z, x 0 )), and Note that, as the example in Table 2 shows, it is not true in general that a three-way symbolic map δ that restricts to a three-way symbolic ultrametric on all subsets Y of X of size four is a three-way symbolic ultrametric on X.However, as mentioned above, using the previous lemma we now show that considering sets of size five is enough to ensure that this is the case.Theorem 4.4.Suppose that |X| ≥ 5 and that δ : X 3 → M is a three-way symbolic map.Then, δ is a three-way symbolic ultrametric if and only if δ| Y is a three-way symbolic ultrametric for all Y ⊆ X of size five.
Proof.The fact that a three-way symbolic ultrametric on X restricts to such an ultrametric on all subsets of X of size five is clear.
Conversely, assume that δ| Y is a three-way symbolic ultrametric for all Y ⊆ X of size five.For such a set Y , we denote by T Y = (T Y , t Y ) the unique (by Lemma 4.3) discriminating labelled tree that represents δ| Y , and by D Y the symbolic ultrametric that is represented by T Y .
Clearly, if there exists a map D : X 2 → M such that, for all subsets Y ⊆ X of size five, the restriction of D to Y 2 coincides with D Y , then D satisfies δ(x, y, z) = {D(x, y), D(x, z), D(y, z)}, for all x, y, z ∈ X pairwise distinct.Moreover, since D Y is a symbolic ultrametric on any subset Y ⊆ X of size five, and given that the property of being a symbolic ultrametric is based on a 4-point condition, we have that such a map D, if it exists, is also a symbolic ultrametric.Thus, if D exists, then δ is a three-way symbolic ultrametric.
To show that D exists, assume for contradiction that there exist x and y in X and two distinct subsets Y 1 and Y 2 of X of size five, both containing x and y, such that D Y 1 (x, y) = D Y 2 (x, y).We may assume without loss of generality that I = Y 1 ∩ Y 2 has size four.Moreover, we claim that x, y, Y 1 and Y 2 can be chosen in such a way that δ| I is not of type δ3 , as defined in Table 1.
To prove this claim, consider the case where δ| I is of type δ3 (otherwise, the claim trivially holds).Assume Y 1 = {x, y, z, t, u 1 } and Y 2 = {x, y, z, t, u 2 }, which implies I = {x, y, z, t}.Both the subtree of T Y 1 induced by I and the subtree of T Y 2 induced by I are of the form T 3 in Figure 4, and their underlying phylogenetic trees are not isomorphic.We can assume that one has cherries {x, y} and {t, z} and the other has cherries {x, z} and {t, y}.Then, we have not only that

A five-point characterization of three-way symbolic ultrametrics
We now focus on using the results in the previous two sections to derive conditions for characterizing three-way symbolic ultrametrics that are analogous to conditions (U1) and (U2) for symbolic ultrametrics.
In the following, we shall consider expressions of the form m∈M α m m, where α m is a real number, which arise when we take linear combinations of multisets in M. We shall say that such an expression m∈M α m m is valid for M if the coefficient for each element in M is contained in N.For example, for M = {a, b}, if S 1 = 2a + b, S 2 = 2b + a and S 3 = 3a are multisets in M, then we have 1  3 Now, suppose that δ : X 3 → M is a three-way symbolic map where |X| ≥ 5. Let Y = {x, y, z, u, v} be a subset of X.Let ν Y (δ) denote the vector (δ(x, y, z), δ(x, y, u), . . ., δ(z, u, v)).By definition of D Y , it is straight-forward to check that Aµ Y (δ) = ν Y (δ), where
We now present conditions for characterizing when a three-way symbolic map is a three-way symbolic ultrametric.For Σ ∈ M, we define the elements m(Σ) and n(Σ) of M as follows: • If Σ contains a single element A ∈ M repeated three times, we put m(Σ) = n(Σ) = A. • If Σ contains two distinct elements, we define m(Σ) as the element of Σ appearing twice and n(Σ) as the element appearing only once.• If Σ contains three distinct elements, we put m(Σ) = n(Σ) = ∅.
Conversely, assume that δ satisfies Properties (P1) -(P3).Consider a subset Y ⊆ X of size five.By Proposition 5.1, there exists a map D Y : Y 2 → M such that δ(x, y, z) = {D Y (x, y), D Y (x, z), D Y (y, z)} for all x, y, z ∈ Y .We claim that D Y is a symbolic ultrametric.For this it suffices to show that D Y satisfies Property (U2) as Property (U1) is a direct consequence of Property (P1).
To see that D Y satisfies Property (U2), assume for contradiction that there ex- δ(x, y, u)) also holds this is impossible in view of Property (P3).Thus, D Y also satisfies Property (U2) and, so, is a symbolic ultrametric, as claimed.
Since D Y is a symbolic ultrametric, there exists a labelled rooted tree T that represents D Y .Combined with the definition of D Y it follows that T also represents δ| Y .Thus, δ| Y is a three-way symbolic ultrametric and, so, δ| Y is a three-way symbolic ultrametric for all subsets Y ⊆ X with |Y | = 5.By Theorem 4.4, it follows that δ is a three-way symbolic ultrametric.
Note that Properties (P1) -(P3) are independent of each other.Indeed, that Property (P2) is independent of Properties (P1) and (P3) and that Property (P3) is independent of Properties (P1) and (P2) is a direct consequence of the fact that Properties (U1) and (U2) are independent of each other.

Reconstructing three-way symbolic ultrametric representations using triplets
In this section we are interested in determining when a three-way symbolic map δ on X is a tree-map or a symbolic ultrametric.Clearly, using the conditions given in Theorem 5.2 this can be done by examining every subset of X with size five.However, we now show how to do this using a triplet-based approach, which essentially reduces the problem to considering subsets of X of size three.
Recall that a triplet is a binary phylogenetic tree on three leaves.By xy|z we denote the triplet with leaf-set {x, y, z} which has x, y adjacent to the same vertex in the tree.For T a phylogenetic tree on X and x, y, z ∈ X, we say that T displays the triplet xy|z if lca T (x, z) = lca T (y, z) = lca T (x, y).To keep notation at bay, we sometimes also say that a labelled tree T = (T, t) on X displays a triplet r if r is displayed by T .
In [18, Section 7.6] a triplet-based approach is described for deciding whether or not a two-way symbolic map δ is a symbolic ultrametric or not and, if it is, for building a labelled tree which represents δ.This approach is based on the BUILD algorithm, that was presented under that name in [1, p.407].Using the results in Section 3, the BUILD algorithm also allows us to check if a three-way symbolic map is a tree-map using triplets as follows.Suppose δ : X 3 → M is a three-way symbolic map.Pick any r ∈ X.Then, using the BUILD-based approach, we can check whether or not the map δ r defined in Section 3 is a symbolic ultrametric by taking the set of triplets xy|z with x, y, z ∈ X distinct, for which δ r (x, y) = δ r (x, z) = δ r (y, z) holds as input to BUILD.If this is not the case, then by Lemma 3.1, δ is not a three-way symbolic tree-map.Otherwise, if (T, t) is the representation of δ r returned by BUILD, then we can simply check whether or not this leads to a representation of δ by attaching the leaf r to the root of T .If this is possible then δ is a three-way symbolic tree-map, otherwise it is not.
We now turn our attention to three-way symbolic ultrametrics.We begin by presenting a key link between triplets and such maps whose proof is straight forward.Denote the underlying set of a multiset A by A. Proposition 6.1.Let T = (T, t) be a discriminating labelled tree.For x, y, z ∈ X distinct: m(δ T (x, y, z)) and t(lca T (x, y)) = n(δ T (x, y, z)) (T2) If T does not display any triplet on {x, y, z}, then |δ T (x, y, z)| = 1.Corollary 6.2.Up to isomorphism, any labelled tree T can be uniquely reconstructed from δ T and the set of triplets displayed by T .
Proof.Put T = (T, t) and δ = δ T .Let t : V o (T ) → M and let R denote the set of triplets displayed by T .Define a map D δ : X 2 → M as follows.Suppose x, y ∈ X distinct.If there exists some z ∈ X − {x, y} such that no triplet on {x, y, z} is contained in R, then define D δ (x, y) to be the element in δ T (x, y, z).If there exists some z ∈ X − {x, y} such that xy|z ∈ R then put D δ (x, y) = n(δ T (x, y, z)) and if xz|y ∈ R then put D δ (x, y) = m(δ T (x, y, z)).In view of Proposition 6.1, the map D δ is clearly well-defined.
The corollary now follows in view of Theorem 2.1 as D δ is equal to the symbolic ultrametric D T that is represented by T (as D δ (x, y) = t(lca(x, y)) = D T (x, y) clearly holds for all x, y ∈ X distinct).
In light of Corollary 6.2, it is of interest to understand when, for a labelled tree T , the set of triplets displayed by T can be obtained from δ T .The tree T 3 in Figure 4, suggests that this is not always possible.In fact, as we shall show, it suffices to exclude a special type of labelled tree which we define next.
A fixed-cherry tree on X (with cherry {x 1 , x 2 }), |X| ≥ 4, is a labelled tree T = (T, t) on X such that the root ρ T of T has two children v and w with t(v) = t(w) = t(ρ T ), v is the parent of two elements x 1 and x 2 of X, and w the parent of all elements in X −{x 1 , x 2 }.For example, the tree T 3 in Figure 4 is a fixed-cherry tree on X = {1, 2, 3, 4} with cherry {1, 2}.Note that if T = (T, t) is a fixed-cherry tree with cherry {x 1 , x 2 } and x, y, z ∈ X distinct, then δ T (x, y, z) = {t(w), t(w), t(w)} if neither x 1 nor x 2 belong to {x, y, z} and δ(x, y, z) = {t(ρ T ), t(ρ T ), t(w)} else.We call a three-way symbolic map δ : X 3 → M that satisfies these conditions for some x 1 = x 2 ∈ X a fixed cherry map (with cherry {x 1 , x 2 }).The following observation is straight-forward to check.Lemma 6.3.Suppose that |X| ≥ 5 and that δ is a three-way symbolic map on X.Then δ can be represented by a fixed-cherry tree on X with cherry {x 1 , x 2 } if and only if δ is a fixed-cherry map with cherry {x 1 , x 2 } .
Note that a triplet xy|z with x, y, z ∈ X is displayed by a fixed-cherry tree on X with cherry {x 1 , x 2 } if and only if either {x, y} = {x 1 , x 2 } or z ∈ {x 1 , x 2 }, and x, y ∈ X − {x 1 , x 2 } hold.In particular, if |X| > 4 and δ is a fixed-cherry map, then the cherry can be easily identified from δ, and therefore also all of the triplets displayed by T .
We now consider how to obtain the triplets displayed by a labelled tree T in case T is not a fixed-cherry tree.We start with a useful lemma.Suppose T = (T, t) is a labelled tree and Y ⊆ X, |Y | ≥ 4, is such that δ T | Y has a unique discriminating representation.Then we denote that representation by T Y = (T Y , t Y ).Lemma 6.4.Let T be a discriminating labelled tree on X and assume that Y ⊆ X is such that δ T | Y has a unique discriminating representation.If t is a triplet displayed by T Y , then t is displayed by T .
Proof.Put δ = δ T and T = (T, t).It suffices to note that T Y is obtained from T by first taking the subtree T of T induced by Y , and then collapsing edges of T both of whose end vertices have the same label under the restriction t of t to V (T ).Clearly, T Y is a discriminating representation of δ| Y .By assumption, it follows that T Y is the unique discriminating representation of δ| Y .
It is well-known [18,Theorem 6.4.1] that the set R of triplets displayed by T is contained in the set of triplets displayed by T .Since the process of collapsing edges of T removes triplets from R, but does not add any, it follows that a triplet displayed by T Y is also displayed by T .
We now present the main result of this section.Theorem 6.5.Suppose that |X| ≥ 4 and that T is a labelled tree on X that is not a fixed-cherry tree.Then, for all x, y, z ∈ X distinct, T displays the triplet xy|z if and only if one of the following two properties holds: (P1) There exists some u ∈ X such that δ T (x, u, z) = δ T (y, u, z) = δ T (x, y, u) and if |δ T (x, y, u)| = 1 then δ T (x, y, u) = δ T (x, y, z).(P2) There exists some u ∈ X such that |{δ T (x, u, z), δ T (y, u, z), δ T (x, y, u)}| = 3 and m(δ T (x, u, z)) = m(δ T (y, u, z)) = m(δ T (x, y, u)).
Proof.Put T = (T, t) and δ = δ T .Assume first that x, y, z ∈ X distinct are such that T displays the triplet xy|z.Put v = lca(x, z) and w = lca(x, y).We proceed using a case-analysis on the structure of T .Since T is not a fixed-cherry tree we need to consider the following (not necessarily disjoint) cases: (a): w is not a child of v, (b): v is not the root of T or has outdegree three or more, (c): w has a child that is neither x nor y, and (d): there exists a vertex v 0 on the path from v to z with t(v 0 ) = t(w).Case (a): Consider the parent v 0 of w, and an element u in X that is below v 0 but not below w (see Figure 5(a)).Since T is a discriminating representation for δ T , we have t Hence, the second condition in Property (P1) holds, too.So assume that t(w) = t(v).Then |δ(x, y, u)| = 2 and so the second condition in Property (P1) does not apply.
Conversely, let x, y, z ∈ X distinct.Assume first that there exists some u ∈ X − {x, y, z} such that Property (P1) is satisfied for the namesakes of u, x, y, and z.Consider the restriction δ of δ to {x, y, u, z}.Let T = (T , t ) denote a discriminating representation of δ .To see that xy|z is displayed by T we claim first that T is the unique discriminating representation of δ .To see the claim, we show that xy|z is displayed by T .Assume for contradiction that the triplet xy|z is not displayed by T .In view of the first condition in Property (P1), the outdegree of the root ρ T cannot be four.Hence, one of the triplets x|yz and y|xz must be displayed by T and T is either resolved or unresolved.Assume first that T is resolved.Then a straight forward case analysis concerned with adding u to the triplet x|yz implies that that triplet cannot be displayed by T .Swapping the roles of x and y in that argument also implies that the triplet y|xz cannot be displayed by T either.Thus, T must be unresolved and, so, either ρ T has outdegree three or one of the children of ρ T has outdegree three.
If T displays the triplet x|yz and the outdegree of ρ T is three then |δ(y, u, z)| = 1.Hence, δ(x, y, u) = δ(x, y, z) in view of the second condition in Property (P1) which is impossible.Thus, one of the children of ρ T has outdegree three.But this is impossible in view of the first condition in Property (P1).Similar arguments imply that the triplet displayed by T cannot be y|xz either which is impossible.Thus, T must display the triplet xy|z.Consequently, either ρ T is the parent of u and z or x, y, and u have the same parent.In either case it follows that δ cannot be of type δ3 .Thus, T is the unique discriminating representation of δ , as claimed.By Lemma 6.4, it follows that xy|z must be displayed by T .
Assume next that there exists some u ∈ X − {x, y, z} such that Property (P2) is satisfied for the namesakes of u, x, y, and z.Consider again the restriction δ of δ to {x, y, u, z}.Then δ must have a representation T = (T , t ).In view of the first condition of Property (P2), T must be discriminating.A straight forward case analysis implies that δ cannot be of type δ3 .Thus, T is the unique discriminating representation of δ .
Using similar arguments as before, we have D T (x, z) = m(δ(x, u, z)), D T (x, y) = m(δ(x, u, y)), and D T (y, z) = m(δ(y, u, z)) in this case.By Property (P2), it follows that D T (x, z) = D T (y, z) = D T (x, y).Thus, xy|z is displayed by T and, by Lemma 6.4, xy|z is also displayed by T .
We now explain how, as a direct consequence of Lemma 6.3 and Theorem 6.5, it is possible to decide whether or not a three-way symbolic map δ on a set X with |X| ≥ 5 is a three-way symbolic ultrametric by considering triplets and, if so, construct the labelled tree T which represents δ.
First, check if δ is a fixed-cherry map.If this is the case, then δ is a three-way symbolic ultrametric and T can be easily constructed.If not, then compute the set Tr(δ) of triplets of X satisfying Properties (P1) or (P2), and use it as input to the BUILD algorithm.If there is no tree that display all the triplets in Tr(δ), then δ is not a three-way symbolic ultrametric.Otherwise, using the tree T that is constructed from the BUILD algorithm and the map δ, it is straight-forward to decide if there is a labelling map t for T such that (T, t) represents δ.If this is the case, then δ is a three-way symbolic ultrametric which has the computed labelled tree (T, t) as a representation, otherwise it is not.

Conclusion
We conclude by presenting some possible future directions: • In [4] some relationships are derived between three-way and two-way dissimilarities in general.It would be interesting to see which of these relationships might be extendable to symbolic three-way maps.• We define three-way tree-maps in terms of medians in leaf-labelled trees.
Can any of our results be extended to median networks [2]?Also, can our results concerning three-way symbolic ultrametrics be extended to rooted phylogenetic networks?(cf.e.g.[14]) • We can clearly consider generalizations of three-way symbolic maps to kway symbolic maps, k ≥ 2 (see e.g [4,5,20]), and therefore generalize the notion of a three-way symbolic ultrametric in the natural way.If δ is a k-way symbolic map and its restriction to every k + 2 subset is a k-way symbolic ultrametric, then is δ a symbolic ultrametric?• In [12], an application of symbolic ultrametrics to constructing genomebased phylogenies is presented.It would be interesting to see if this application could be extended to three-way maps.Note that results presented in [17] might be relevant in this context.Also, it would be interesting to develop associated algorithms such as those in [16], for three-way symbolic maps.

Figure 1 .
Figure 1.Two trees which give rise to (a) a three-way symbolic tree-map and (b) a three-way symbolic ultrametric.

Figure 2 .
Figure 2. (i) An edge-colored graph ∆ on X = {x, y, z} adapted from [7, Figure 1].(ii) An edge-colored graph Π on X = {x, y, z, u} adapted from the same figure.Colors are represented in terms of different edge styles (plain, dashed and dotted).

Lemma 4 . 3 . 2 →
If Y is a set of size five and δ : Y 3 → M is a three-way symbolic ultrametric on Y , then δ has a unique discriminating representation.Proof.Suppose that δ is a three-way symbolic ultrametric on Y , and that T is a discriminating representation of δ.Let D = D T : Y M be the symbolic ultrametric represented by T .By Theorem 2.1, it suffices to show that if δ is also represented by a labelled tree T , then D T = D T .Since δ is a three-way symbolic ultrametric on Y , there exists a subset Y 0 of Y with |Y 0 | = 4 such that δ| Y 0 is not of type δ3 .Thus, by Proposition 4.2, D T | Y 0 = D T | Y 0 .Hence, D T (x 0 , x) = D T (x 0 , x) for all x ∈ Y 0 where x 0 is the unique element contained in Y − Y 0 , since the value of D T (x 0 , x) is given by δ and D T | Y 0 as follows.Let Y 0 = {x, y, z, u} and consider the multisets δ(x, y, x 0 Moreover, it is easy to check that there exists a subset Y * ⊂ I of size three such that neither δ|Y * ∪{u 1 } nor δ| Y * ∪{u 2 } is of type δ3 .Since Y * is a subset of I of size three and, in view of the four inequalities listed above, there exists two elementsx , y ∈ Y * such that D Y 1 (x , y ) = D Y 2 (x , y ).If we denote by Y the set Y * ∪ {u 1 } ∪ {u 2 }, we have that both Y ∩ Y 1 and Y ∩ Y2 have size four, and that at least one of D Y (x , y ) = D Y 1 (x , y ) or D Y (x , y ) = D Y 2 (x , y ) holds.If the first inequality holds, the claim is then satisfied for x , y , Y and Y 1 .Otherwise, it is satisfied for x , y , Y and Y 1 , which completes the proof of the claim.Now, in light of the claim, the representation T I of δ| I is unique, and so is the symbolic ultrametric D I that is represented by T I .Moreover, D I is precisely the restriction of D Y 1 to I, and the restriction of D Y 2 to I. In particular, we have D(x, y) = D Y 1 (x, y) and D(x, y) = D Y 2 (x, y), which contradicts D Y 1 (x, y) = D Y 2 (x, y).

Proposition 5 . 1 . 3 →
Suppose that |X| ≥ 5, that δ : X M is a three-way symbolic map, and that Y ⊆ X has size five.There exists a map D

Figure 5 .
Figure 5. Cases (a)-(d) for the case-analysis carried out in the proof of Theorem 6.5.See text for details.
is exhaustive, we have: Suppose that |X| ≥ 4, that δ : X 3 → M is a three-way symbolic map, and that Y ⊆ X is a subset of size four.Then δ| Y : Y 3 → M is a three-way symbolic ultrametric on Y if and only if there exists some i ∈ {1, . . ., 7} such that δ| Y is of type δi .Moreover, if i = 3, the representation of δ| Y is unique.