# Why does a graph distance have to fulfill the four-point condition?

In Buneman's paper "A note on the metric properties of trees", he states that:

"By checking the possible configuration of paths which can connect four points $x,y,z,t$ in a tree, it can be seen that the graphical distance must satisfy the inequality $$d(x,y)+d(z,t) \leq \max\{d(x,z)+d(y,t), d(x,t)+d(y,z) \}."$$

Now, I wanted to prove this.

The graphical distance he refers to is defined as the length of the shortest path joining two points $u$, $v$, i.e. the minimal number of edges passed. In a connected graph, this distance is a metric and since we are in a tree, our distance is a metric.

However, I have some trouble with my proof. First of all, the claim is supposed to hold for any four vertices, i.e. not necessarily leaves, but I think it would be easier to show for this. So I was wondering whether we can reduce it to the case of a quartet tree (but I think we cannot...)? I've also tried using the metric properties and the triangle inequality but this hasn't worked out either as I cannot be sure how many edges are in between two of my vertices. So I'm assuming that there is a certain approach to it which I'm not getting.

I'm grateful for any hints and suggestions!

First of all, the claim is supposed to hold for any four vertices, i.e. not necessarily leaves, but I think it would be easier to show for this. So I was wondering whether we can reduce it to the case of a quartet tree (but I think we cannot...)?

I'm not sure what a "quartet tree" is, but you can do the all of the following without loss of generality:

• Start by generalizing to trees with explicitly weighted edges such that each edge is not restricted to have length $1$.

• If any of your named nodes is not a leaf, attach a new leaf to it with an edge of length $0$, and move the name to that new leaf.

• If any node has degree $>3$ replace it with a tree of maximal degree $3$ whose internal edges have length $0$.

• Remove all nodes and edges that are not on the path between two of your named nodes.

• Collapse all internal nodes of degree $2$.

You now have a tree with exactly four leaves and two internal nodes each of degree $3$. There are now only three shapes it can have:

x       z     x       y    x       y
\     /       \     /      \     /
*---*         *---*        *---*
/     \       /     \      /     \
y       t     z       t    t       z


In each case, each of the sums $$d(x,y)+d(z,t) \\ d(x,z)+d(y,t) \\ d(x,t)+d(y,z)$$ will contain all four diagonal edges once, but two of them also contains the horizontal edge twice. In other words, two of them are equal and the third is shorter (or equal). So no matter which you pick, there will be another one that is equal or longer, which is what your inequality states.

• Thank you very much. I still got two questions though. What exactly do you mean by the third step (with the nodes of degree >3)? I don't understand the part with the replacement by trees? And wouldn't there also be the possibility of a tree looking like a cross with only one internal node? Commented Aug 30, 2018 at 13:21
• @SallyOwens: The risk of ending like a cross is exactly what that step is supposed to handle. Another way to describe it would be: As long as you have any node with degree $\ge 3$, detach two of its neighbors and connect them instead to a new degree-3 node which you connect to the original with a new length-0 edge. This reduces the degree by $1$, and doesn't change any distances. Commented Aug 30, 2018 at 13:27
• You could also postpone the step though: Ignore it, and if you end up with a cross rewrite the cross to one of the above graphs with a length-0 horizontal edge. Commented Aug 30, 2018 at 13:28

View $$x$$, $$y$$, $$z$$, $$t$$ as four colors, and assume that flags of these colors have been put on four (not necessarily different) vertices of a tree $$T$$. It is claimed that the six edge distances between the four flags satisfy the inequality given in the question.

We shall prove this by induction on the number $$n$$ of vertices of $$T$$. If $$n=1$$ the claim is trivially true. Assume that it is true for all trees having $$\leq n$$ vertices, and let a flagged tree $$T$$ with $$n+1$$ vertices be given. Removing unflagged leaves does not alter the distances between the flags. Therefore we may assume that all leaves of $$T$$ carry at least one flag. Consider a leaf carrying just one flag, say $$x$$. This leaf is attached to some vertex $$v$$. Removing the leaf and putting flag $$x$$ on $$v$$ decreases the distance of this flag from all other flags by $$1$$, and at the same time both sides of the inequality decrease by $$1$$. Since for the reduced tree the inequality holds by induction hypothesis it was already holding for the given tree $$T$$. If there is a leaf carrying three flags there has to be another leaf carrying just one flag, to which the foregoing operation can be applied. If there are just two leaves carrying two flags each the claim can be verified by inspection: One of the distance sums is $$0$$, and the two other sums are equal.

I think it is easiest to do as suggested by the first sentence - check the possible configurations of where the vertices might lie with respect to each other. For example if the vertices are located like this:

   a   b     c
x ---*--- y ---- z
|
| d
|
t


(where by $a,b,c,d$ I denoted the lengths of resulting segments) then you need to check that

$$a+b+c+b+d \leq \max(a+b+c+d+b, a+d+c).$$

And so on. There just a few configurations to consider.

• I have trouble understanding your diagram. Is $t$ connected to $x$ or to $y$? And why is the link from $x$ to $y$ decorated with both $a$ and $b$? Commented Aug 30, 2018 at 10:32
• $t$ is connected to some unnamed point between $x$ and $y$. $a$ and $b$ are the lengths of the two pieces. Commented Aug 30, 2018 at 10:37
• Ah, I see. That would be easier to understand if the unnamed point was named. Commented Aug 30, 2018 at 10:38
• That may be true. See now. Commented Aug 30, 2018 at 10:41
• Much better. :-) Commented Aug 30, 2018 at 10:49

This thread is old, but let me mention this for the sake of completeness: I posed this question (in an equivalent form) as Exercise #6 on UMN Spring 2017 Math 5707 midterm #2. My own proof appears in the model solutions, and other proofs are sketched by Nicholas Rancourt and by Sasha Pevzner. My impression is that no really slick proof is known, but it's not a difficult exercise for those ready to expend the effort.