On different"middle parts"of a tree

We determine the maximum distance between any two of the center, centroid, and subtree core among trees with a given order. Corresponding results are obtained for trees with given maximum degree and also for trees with given diameter. The problem of the maximum distance between the centroid and the subtree core among trees with given order and diameter becomes difficult. It can be solved in terms of the problem of minimizing the number of root-containing subtrees in a rooted tree of given order and height. While the latter problem remains unsolved, we provide a partial characterization of the extremal structure.


Preliminaries
Many real-valued functions defined on the vertex set of a tree have been studied in the literature. Such functions are closely related to graph invariants motivated from practical applications (such as the Wiener index in biochemistry [11]) or pure mathematical study (such as the subtree density [4]). In this paper we are interested in the eccentricity and distance of a vertex, as well as the number of subtrees containing a vertex. Both eccentricity and distance of a vertex are minimized at one vertex or two adjacent vertices. These vertices define the center and centroid respectively of the tree. The number of subtrees containing a vertex is maximized by one vertex or two adjacent vertices, called the subtree core of the tree.
The study of the center and centroid (Definitions 1.1 and 1.2) can be traced back to [5]. This paper focuses on the three different middle parts of the tree: the center, the centroid, and the subtree core. We investigate the geometry of their possible locations, in particular the extremal problem of how far they can be from each other. The resulting three problems are solved in Section 2 for arbitrary trees of fixed order, and the corresponding extremal structures are also characterized. In Section 3, the same three problems are solved for degree bounded trees and conjectures are proposed for the case of binary trees of fixed order. In Section 4, we consider the same questions for trees with fixed order and bounded diameter. In this setting, the maximum distance between the center and the centroid and between the center and the subtree core are determined, but the problem of the maximum distance between the centroid and the subtree core becomes challenging. It can be solved in terms of the problem of minimizing the number of root-containing subtrees in a rooted tree of given order and height. While this latter problem remains unsolved, in Section 5 we provide a partial characterization of the extremal structure.
Let us begin with formal definitions. The distance in the tree from u to v, denoted d(u, v), is the number of edges on their unique connecting path P (u, v). The center of T , denoted C(T ), is the set of vertices which have the minimum eccentricity among all vertices in the tree.  On the other hand, when the vertices of C(T ), CT (T ), Core(T ) happen to lie on the same path, they can appear in any order. Figure 2 provides some illustrations.
Among the examples with different ordering of middle vertices, it is interesting to observe that vertices in Core(T ) often have large degree; vertices in C(T ) often have small degree; while vertices in CT (T ) behave somewhat between the previous two.
Before proceeding to examining the largest distances between different middle parts, we formalize some necessary and sufficient conditions for a vertex to be in a middle part. Although not all of them are formally stated in the literature, we leave their relatively straightforward proofs to the reader.  Next we give a characterization of the vertices in CT (T ). Note that if uv is an edge in tree T , then T − uv will denote the forest that results after the deletion of edge uv from T . where n uv (u) (n uv (v)) denotes the number of vertices in the component containing u (v) in T − uv. Furthermore, if u ∈ CT (T ) and equality holds above, then v ∈ CT (T ) as well.
Lastly, Proposition 1.7 gives a characterization of Core(T ).
Furthermore, if u ∈ Core(T ) and equality holds above, then v ∈ Core(T ) as well.
For completeness, we provide a proof for the following simple fact. Claim 1.8. Among rooted trees of order n, the number of subtrees containing the root is at most 2 n−1 , achieved only by the star rooted at the center; and at least n, achieved only by the path rooted at one end vertex.
Proof. We proceed by induction on n. Let T be a tree of order n with root r and let r be of degree k with neighbors v 1 , . . . , v k . Denote by T i the connected component containing v i in T − {r} and let n i = |V (T i )|. Then where the first inequality follows from induction hypothesis and equality holds in the second inequality if and only if n i = 1 for all i (and consequnely k = n − 1); and where the first inequality follows from induction hypothesis and equality holds in the second inequality if and only if k = 1 and T 1 is a path with v 1 as a leaf. r vertices Figure 3. An r-comet of order n.

Maximum distances between middle parts in general trees
In a tree T , the distance d(S, S ′ ) between vertex sets S and S ′ is defined as the Hausdorff distance min{d(u, v) : u ∈ S, v ∈ S ′ }. Fix an arbitrary n ∈ Z + . Among all trees with n vertices, we determine the maximum distance that can be realized between the center, centroid, and subtree core. We will also see that these maximum distances are achieved precisely when T has a "comet" structure.
Definition 2.1 (Barefoot, Entringer, Székely [2]). An r-comet of order n is formed by attaching n − r pendant vertices to one end vertex of a path on r vertices ( Figure 3).

Between center and centroid.
Theorem 2.2. Fix an arbitrary n ∈ Z + . For any tree T with n ≥ 3 vertices, Proof. Fix a tree T on n vertices. Let v ∈ C(T ) and u ∈ CT (T ) such that the graph distance between u and v is precisely d(C(T ), CT (T )). We assume d(u, v) ≥ 1, otherwise we have nothing to prove. By the choice of u and v, no vertex on the path P (u, v) other than u and v is in the center or the centroid of T . Let P (u, v) denote the path connecting u and v and let T u denote the component containing u in T − E(P (u, v)). By Proposition 1.6, Let w be a leaf such that P (v, w) and P (u, v) are disjoint, except for v, and the length of P (v, w) is maximum. Because v ∈ C(T ) and the neighbor of v on P (u, v) is not in C(T ), Proposition 1.4 tells As n ≥ 3, u is not a leaf. Hence it is easy to see that This implies In particular, if n = 4k + r with r ∈ {0, 1, 2}, then Since d(u, v) < n−2 4 , when n ≡ r mod 4 for r ∈ {0, 1, 2}, d(u, v) ≤ k − 1 where k = n 4 . When n = 4k + 3, As a result, d(u, v) ≤ k.
Proposition 2.3. Let k := n 4 . Equality holds in (1) exactly when n and T fall into one of the following categories: • n = 4k and T is the 2k-comet. • n = 4k + 1 or n = 4k + 2 and T is one of the following trees: -2k-comet -2k-comet on n − 1 vertices together with one vertex pendant to one of the degree 2 vertices on the path of the comet a tree consisting of a path on 2k + 1 vertices with an end vertex identified with the root of a height 2 tree • n = 4k + 3 and T is a (2k + 2)-comet.
Proof. As in the proof of Theorem 2.2, let v ∈ C(T ) and u ∈ CT (T ) such that the graph distance between u and v is precisely d(C(T ), CT (T )). Above, we obtained d(u, v) ≤ n−3 when all of the inequalities above are tight. Equality in (3) implies that all vertices not in T u form a path P (u, w). Equality in (4) implies that the height of T u is 1 because the neighbor of v on P (u, v) is not in C(T ). This, together with equality in (2) characterizes the n+1 2 -comet. In particular, when n = 4k, this is the 2k-comet, and when n = 4k + 3, this is the 2k + 2-comet.
On the other hand, notice that 2d(u, v) + 1 is odd. So when n−1 2 is even, all inequalities cannot be equalities. In particular, exactly one will be strict. If (2) is the one which is strict, then we have the n−1 2 comet. If (3) is the one which is strict, then we have a n+1 2 -comet on n − 1 vertices with one extra vertex pendant to one of the degree 2 vertices. If (4) is the one which is not strict, then T u has height 2 but all n−1 2 vertices not in T u still lie on the path P (u, w).

2.2.
Between centroid and subtree core. Next we turn our attention to the centroid and the subtree core. with equality precisely when T is the (n − ⌊log 2 n⌋)-comet.
Proof. Fix a tree T with n > 8 vertices. Let u ∈ CT (T ) and v ∈ Core(T ) where the graph distance between u and v is precisely d(CT (T ), Core(T )). We assume d(u, v) ≥ 1, otherwise we have nothing to prove. Let P (u, v) denote the path connecting u and v and let T u , T v denote the components containing u, v respectively in T − E(P (u, v)). Let T − T v be the component containing v when the edges of T v are deleted from T . Set Since u ∈ CT (T ) and the neighbor of u on P (u, v) is not in CT (T ), Proposition 1.6 implies x > n − x, thus x > n 2 . Since x is an integer, x ≥ n+1 2 and consequently Similarly, since v ∈ Core(T ) and the neighbor of v on P (u, v) is not in Core(T ), Proposition 1.7 gives where w is the unique neighbor of v on P (u, v). See Figure 4 for an illustration of how these pieces interact. Further note that every subtree in T v which contains v can be uniquely identified by the set of its vertices, excluding v. Thus, by Claim 1.8, Note that equality holds if and only if every subset of vertices induces a tree which is the case exactly when T v is a star centered at v. On the other hand, with equality if and only if T − T v is a path with w as an end vertex. Putting these inequalities together for our specific choice of v, Proposition 1.7 yields 2 y−1 > n − y.
As for extremal trees, equality will hold in the upper bound for d(u, v) exactly when T u has n+1 2 vertices, T v is a star, and T − T v is a path. This describes the C-comet where C = n − ⌊log 2 n⌋ or in the case where n ≥ 2 ⌊log 2 n⌋ + ⌈log 2 n⌉ + 1, C = n − ⌊log 2 n⌋ − 1.

2.3.
Between subtree core and center. The study of this case is similar to that in the previous section. We omit some details.
Theorem 2.5. For any tree T on n > 8 vertices, if n ≥ 2 ⌈log 2 n⌉−1 + ⌈log 2 n⌉ then which is tight for the K-comet with K = n − ⌊log 2 n⌋ + 1. Otherwise which is tight for the K-comet with K = n − ⌊log 2 n⌋.
Proof. Let u ∈ Core(T ) and v ∈ C(T ) in a tree T with |V (T )| = n and the graph distance between u and v is precisely d(C(T ), Core(T )). Use T u (respectively T v ) to denote the component containing u (v) in T − E(P (u, v)) and let y = |V (T u )|.
Because v ∈ C(T ) and the neighbor of v on P (u, v) is not in C(T ), there is a leaf w in T v with d(v, w) = ecc T (v). As argued in the proof of Theorem 2.2, Note that these inequalities are tight for the (n − y + 1)-comet.
Because u ∈ Core(T ), we can conclude, as in the proof of Theorem 2.4, Consequently, y ≥ ⌊log 2 n⌋ .
Combining inequalities, we obtain the bound in the theorem statement: Recall from Theorem 2.4 that if n ≥ 2 ⌈log 2 n⌉−1 + ⌈log 2 n⌉, then y ≥ ⌊log 2 n⌋ + 1 and consequently we obtain the slightly better bound

Trees with degree restrictions
In Section 2, we saw that, for each pair of middle parts, the maximum distance was achieved precisely by an appropriate comet. However, the comet has a vertex of large degree. In this section, we restrict the maximum degree of the tree and ask how the extremal structures change. We will begin with a discussion of binary trees and then broaden our scope to trees with maximum degree k > 3.
First we state some results about the maximum or minimum number of root-containing subtrees in a tree with a specified degree sequence which will be needed later. Note that among trees (with no maximum degree condition) with n vertices, the number of root-containing subtrees is minimized by the path, rooted at one end, and maximized by the star, rooted at the center vertex (Claim 1.8).

3.1.
Trees with a given degree sequence. For a rooted tree, the height of a vertex is the distance to the root. The height of the tree, h(T ), is the maximum of all vertex heights. Definition 3.1. In a rooted tree T , the list of multisets (L 0 , L 1 , . . . , L h(T ) ), where L i consists of the degrees of the vertices at height i (and L 0 consists of the degree of the root vertex), is called the level-degree sequence of the rooted tree.
Let |L i | be the number of entries in L i counted with multiplicity. It is easy to see that a list of multisets is the level degree sequence of a rooted tree if and only if (i) the multiset i L i is a degree sequence for a tree, (ii) In a rooted tree, the down-degree of the root is equal to its degree. The down degree of any other vertex is one less than its degree.
Given the level-degree sequence of a rooted tree, the level-greedy rooted tree for this level-degree sequence is built as follows: (i) For each i ∈ [n], place |L i | vertices in level i and to each vertex, from left to right, assign a degree from L i in non-increasing order. (ii) For i ∈ [n − 1], from left to right, join the next vertex in L i whose down-degree is d to the first d so far unconnected vertices on level L i+1 . Repeat for i + 1.
[10] Given a tree degree sequence (d 1 , d 2 , . . . , d n ) in non-increasing order, the greedy tree for this degree sequence is the level-greedy tree for the level-degree sequence that has with every entry in L i at most as large as every entry in L i−1 .
The greedy tree frequently occurs in the study of extremal structures. A similar structure with modified root degree is crucial to our study here. Fix a degree sequence for a tree and distinguish a single value in this sequence which will be the degree of the root. Similar to the greedy tree, we define the rooted greedy tree.
. . , d n ) be a tree degree sequence in non-increasing order with degree d i identified as the root degree. Let . . , d n ) be the sequence d with d i removed. The rooted greedy tree for the degree sequence d is the level-greedy tree for the level-degree sequence that has L 0 = {d i }, , where entries of L j are the next available elements fromd. Figure 5. A rooted greedy tree with root degree 2 and degree sequence (4, 3, 3, 3, 3, 2, 2, 1, . . . , 1).
Among trees with given degree sequence, greedy trees are extremal with respect to many graph invariants. For example, the following result is for root-containing subtrees.
Theorem 3.5 (Andriantiana, Wagner, Wang [1]). Fix a degree sequence d and a positive integer k. Among rooted trees with degree sequence d, the greedy tree maximizes the number of subtrees with exactly k vertices which contain the root. Consequently the greedy tree maximizes the total number of root-containing subtrees.
Fix a degree sequence, distinguish one value in the sequence as the root degree, and fix a positive integer k ′ . Among rooted trees with this degree sequence and the specified root degree, the corresponding rooted greedy tree maximizes the number of subtrees containing the root and which have k ′ vertices. Consequently, the rooted greedy tree maximizes the total number of root-containing subtrees.

Binary trees.
The study of binary trees is well motivated from its applications in phylogeny. A binary tree is a tree in which every vertex has degree 1 or 3. A rooted binary tree is a rooted tree in which the root has degree 2 and all other vertices have degree 1 or 3. Székely and Wang [8] studied the number of subtrees of a binary tree with labeled vertices. They found that the extremal structures are good trees, rgood trees, and caterpillars. In our terms, a good binary tree is a greedy tree with root degree 3 and degree sequence (3, . . . , 3, 1, . . . , 1) and an rgood binary tree is a rooted greedy tree with root degree 2 and degree sequence (3, . . . , 3, 2, 1, . . . , 1).
A binary caterpillar consists of a path P with pendant vertices that make the degree of each internal vertex 3.
Their results for the number of subtrees are as follows: Theorem 3.6 (Székely, Wang [9]). Among all binary trees with n leaves, the good binary tree minimizes the number of subtrees.
Theorem 3.7 (Székely, Wang [8]). Among all binary trees with n leaves, the binary caterpillar on n leaves minimizes the number of subtrees.
As an immediate consequence of Theorem 3.5, we obtain the following results for root-containing subtrees.
Corollary 3.8. Fix n ∈ Z + . Among all binary trees with n vertices and any choice of the root, the good binary tree (with the default root of the corresponding greedy structure) has the maximum number of rootcontaining subtrees.
Corollary 3.9. Fix n ∈ Z + . Among all rooted binary trees with n vertices, the rgood binary tree is the unique tree that maximizes the number of root-containing subtrees.
For binary trees, we can examine the distance between vertices of different middle parts in much the same way that we did in Section 2. While the exact calculations are quite messy, we believe the following is true.  Figure 6. An extremal binary tree structure which is conjectured to maximize the distances d(CT (T ), C(T )), d(Core(T ), CT (T )), and d(Core(T ), C(T )) for u and v as in Conjecture 3.10. The tree T u is an rgood binary tree.

3.3.
Trees with bounded maximum degree. We now turn our focus to trees on n vertices, all of which have degree at most k. We previously defined good binary trees and rgood binary trees. In general, for each positive integer k, a good tree is a greedy tree with degree sequence (k, k, . . . , k, 1, 1, . . . 1) while the rgood trees are rooted greedy trees with root degree k − 1 and degree sequence (k, k, . . . , k, k − 1, 1, 1, . . . 1).
For any fixed k, these trees only exist for certain values of n. Therefore, we extend their definitions as follows so that we can create similar trees for any n > k.
For positive integers n, k (n > k), a tree with order n and maximum degree k is called an extended good tree if it is a greedy tree with degree sequence (k, k, . . . , k, s, 1, . . . , 1) for some 1 ≤ s < k (Figure 7). Notice that the degree sequence is determined by n and k. By the division algorithm, we can uniquely write n − 2 = q ′ (k − 1) + s ′ with s ′ < k − 1. Thus q ′ will be the number of vertices of degree k, one vertex will have degree s = s ′ + 1, and the rest will be leaves. Similarly, for positive integers n, k, the extended rgood tree with order n and maximum degree k, is a rooted greedy tree with root degree k − 1 and degree sequence for some 1 ≤ s < k ( Figure 8). Among all rooted trees with n vertices, maximum degree k, and root degree ρ, 1 ≤ ρ ≤ k − 1, we seek the one with the maximum number of root-containing subtrees.
Theorem 3.11. Among all rooted trees with n vertices, maximum degree k, and root degree ρ where 1 ≤ ρ ≤ k − 1, the extended rgood tree maximizes the number of root-containing subtrees.
Theorem 3.11 follows from Lemmas 3.12 and 3.14 below.
Lemma 3.12. For any pair (n, k) of positive integers, n > k, a tree with n vertices, maximum degree k, and root degree k − 1 which maximizes the number of root-containing subtrees must have root degree k − 1.
Proof. For contradiction, suppose T is such a tree with root r having degree ρ ≤ k − 2. Since n ≥ k, there exists a child u of r that is not a leaf. Let v be a child of u. Define Every root-containing subtree in T can be uniquely identified by its list of vertices. It is easy to see that each list forms a root-containing subtree in T ′ . However, T ′ also has root-containing subtrees which contain v and not u. These do not appear in T . Therefore T ′ has more root-containing subtrees than T . This contradicts our choice of T . Definition 3.13. For positive integer sequences π = (d 0 , · · · , d n−1 ) and π ′ = (d ′ 0 , · · · , d ′ n−1 ), we say π ′ majorizes π, denoted π ⊳ π ′ , if for each k ∈ {0, · · · , n − 2}, The following is a simpler analogue of Theorem 11 of Andriantiana, Wagner, and Wang [1]. We skip the details.
Lemma 3.14. Let T and T ′ be rooted greedy trees on n vertices with root degree k − 1. If T has degree sequence π and T ′ has degree sequence π ′ where π ⊳ π ′ , then T ′ has more root-containing subtrees than T .
In the search for a tree which maximizes the number of root-containing subtrees, Lemma 3.12 implies that it is sufficient to restrict our attention to trees with root degree k − 1. Because we are considering only degree sequences on n vertices with maximum degree k, it is easy to see that the degree sequence of the extended rgood tree majorizes all other such degree sequences. Thus, Lemma 3.14 then implies that the extended rgood tree for order n and maximum degree k as stated in Theorem 3.11.
For the purpose of our study of maximum distances between different middle parts, we also note the following fact.
Remark. Among all rooted trees of given order, root degree at most k − 1, and maximum degree k: • the extended rgood tree minimizes the height; • the path (rooted at one end) minimizes the number of root-containing subtrees and maximizes the height.
3.4. Middle parts in trees with a given maximum degree. Fix n, k ∈ Z + . Similar to the binary tree case, we restrict our attention to classes of trees which have order n and maximum degree k. In this section, we detail our findings for the trees in this class which maximize the distance between different middle parts.
Theorem 3.15. For fixed n, k ∈ Z + , each tree T with order n and maximum degree k has This inequality is tight for the tree formed by identifying the root of an extended rgood tree with one end of a path of appropriate length.
Proof. For a fixed tree T , select u ∈ CT (T ) and v ∈ C(T ) such that d(u, v) = d(CT (T ), C(T )). Assume d(u, v) ≥ 1, otherwise there is nothing to prove. Let T u and T v name the components containing u and v respectively in T − E (P (u, v)).
Counting the vertices in T , we obtain the inequality Because u ∈ CT (T ), Proposition 1.6 implies |V (T u )| > n − |V (T u )| and hence Set h u and h v equal to the heights of T u and T v respectively. Because v ∈ C(T ), Proposition 1.4 implies The upper bound for d(u, v) is tight when h v = |V (T v )| − 1, which happens exactly when T v is a path, and h u is minimum. By Remark 3.3, the minimum h u is achieved when T u is the extended rgood tree. Since |V (T u )| ≥ n+1 2 and the maximum degree is k, we can determine the height of an extended rgood tree with these conditions. The extended rgood tree with maximum degree h and height h has at most h i=0 (k − 1) i vertices. For T u with n vertices, the height h will be the smallest value which satisfies As a result, Since h is the smallest value that satisfies the above inequality and |V (T u )| = n+1 2 , we can conclude Without knowing |V (T v )| exactly, we can add (5) and (6) and solve for d(u, v) to obtain the desired upper bound for d(u, v): Theorem 3.16. For fixed n, k ∈ Z + , each tree T with order n and maximum degree k has where n ′ is the minimum order of an extended rgood tree T u with maximum degree k such that F Tu (u) ≥ n − |V (T u )|. This inequality is tight for the tree formed by identifying the root of the extended rgood tree with one end of a path of appropriate length.
Proof. Let u ∈ Core(T ) and v ∈ CT (T ) such that d(u, v) = d(Core(T ), CT (T )). Assume d(u, v) ≥ 1, otherwise there is nothing to prove. Define T u and T v to be the components of T − E(P (u, v)) containing u and v respectively. Let h u and h v be the heights of T u and T v respectively. Similar to before, Proposition 1.6 implies By Proposition 1.7, u ∈ Core(T ) and its neighbor w on P (u, v) is not in the subtree core precisely when The last inequality is tight if T v is a path. Counting the vertices in T , we see where n ′ is the minimum number of vertices in a tree T u with maximum degree k such that F Tu (u) ≥ d(u, v) + |V (T v )| = n − |V (T u )| as in (7). Note that F Tu (u) is maximized by the extended rgood tree, giving the extremal tree in the theorem statement.
Theorem 3.17. For fixed n, k ∈ Z + , each tree T with order n and maximum degree k has where h ′ = ln(n ′ (k−2)+1) ln(k−1) − 1 and n ′ is the minimum number of vertices in the extended rgood tree T u with maximum degree k such that F Tu (u) ≥ n − |V (T u )|. This inequality is tight for the tree formed by identifying the root of the extended rgood tree with one end of a path of appropriate length.
Proof. Let u ∈ Core(T ) and v ∈ C(T ) such that d(u, v) = d(Core(T ), C(T )). Define T u and T v to be the components of T − E(P (u, v)) containing u and v respectively. Let h u and h v be the heights of T u and T v respectively.
Because u ∈ Core(T ) and its neighbor on P (u, v) is not in the subtree core, as in (7), Proposition 1.7 gives which is tight when T v is a path.
Because v ∈ C(T ) and its neighbor on P (u, v) is not in the center, as in the proof of Theorem 3.15, (6), this is also tight when T v is a path.
Adding these two inequalities together we obtain the following bound.
The upper bound is maximum when F Tu (u) large and h u is small which is optimized when T u is the extended rgood tree. If n ′ is the number of vertices in T u , then because v ∈ C(T ) and T v is a path, then ecc T (v) is at least half of the diameter of T which translates to Any tree on n ′ vertices with maximum degree at most k will have height at least the height of the corresponding extended rgood tree. As determined in the proof of Theorem 3.15, In conclusion, Further, this upper bound is maximized when n ′ is minimized. However, n ′ must still satisfying the condition F Tu (u) ≥ d(u, v) + |V (T v )| = n − |V (T u )| from (8).

Different middle parts in trees with a given diameter D
Recall that all extremal trees in Section 2 were comets. In the previous section, we explored the effect of limiting the maximum vertex degree in a tree. Here, we ask how the distances between middle parts and the corresponding extremal structures change when the diameter is limited. The next two propositions follow from exactly the same arguments as those for Theorem 2.2 and Theorem 2.5 in Section 2, we skip the proofs.  which is achieved by a D-comet.
Finding the maximum of d(CT (T ), Core(T )) is unexpectedly more difficult. Notwithstanding the progress in the remaining part of this paper, it remains unsolved. Fix integers D ≥ 2 and n ≥ 1. Among all trees with diameter at most D and order n, fix a tree T which realizes the maximum value for d(CT (T ), Core(T )).
Select vertices u ∈ Core(T ) and v ∈ CT (T ) such that the graph distance between u and v is precisely d(CT (T ), Core(T )). We assume d(u, v) ≥ 1, otherwise there is nothing to prove. In T − E(P (u, v)), let T u name the component containing u while T v is the component containing v. Consider u to be the root of T u and v to be the root of T v .
Let w be the neighbor of u on P (u, v). Because u ∈ Core(T ) and w ∈ Core(T ), Proposition 1.7 implies F Tu (u) < F T −Tu (w).
Because v ∈ CT (T ) and its neighbor on P (u, v) is not in CT (T ), Proposition 1.6 implies Suppose T u is not a star. Create a new tree T ′ from T by replacing T u with a star T ′ u which is rooted at u and has the same order as T u . Using the convention that T ′ u and T ′ v are the components containing u and v respectively in T ′ − E (P (u, v) ) is not in the centroid of T ′ by Proposition 1.6. Therefore By the choice of T , d(Core(T ′ ), CT (T ′ )) = d(Core(T ), CT (T )). So T ′ is also a tree with diameter at most D and order n which maximizes d(Core(T ), CT (T )).
Now consider the structure of T ′ v in T ′ . Say T ′ v has x vertices and height h. Suppose T ′ v does not minimize the number of subtrees containing v for its height and order. Let T ′′ v be a tree rooted at v with height at most h and order x which minimizes |. This implies, by Proposition 1.6, that the neighbor of v on P (u, v) in T ′′ is not in CT (T ′′ ) and By the choice of T , d(Core(T ′′ ), CT (T ′′ )) = d(Core(T ), CT (T )) which implies T ′′ is also a tree with diameter at most D and order n that maximizes the distance between the subtree core and the centroid.
Remark. Fix n, D ∈ Z + . Among all trees with diameter at most D and order n, one such tree T which maximizes d(Core(T ), CT (T )) has T u being a star rooted at u and T v a tree which minimizes the number of subtrees containing v for its height and order. This structure T is drawn in Figure 9.
In Section 5, we take a closer look at the structure of T v , a tree which minimizes the number of subtrees containing v for its height and order. While we determine many necessary properties of T v , characterizing the exact structure is still an open problem. v w u T v Figure 9. The structure of a tree T with diameter D and order n which maximize d(Core(T ), CT (T )). Here, u ∈ Core(T ), v ∈ CT (T ), and T v minimizes the number of subtrees containing v for its order and height.

Rooted trees of given order and height
For any n, h ∈ Z + , this section is devoted to characterizing the rooted trees with n vertices and height at most h which have the minimum number of root-containing subtrees. For the remainder of this section, we will call these trees optimal.
To standardize some notation, we restrict our attention to trees T which are rooted at root ρ, have order n and height at most h unless mentioned otherwise. Note that h(T ) = ecc T (ρ). The degree of a vertex v will be denoted deg(v).
For any v ∈ V (T ), let T (v) denote the subtree induced by v and all of its descendants. We will view T (v) as a tree rooted at v. For each neighbor v i of ρ, set T i := T (v i ) . For f ∈ {0, 1, . . . , h − 1}, define the f -split to be the tree rooted at w 1 with h + f vertices, constructed from paths P 1 = (w 1 , w 2 , . . . , w h ), and P 2 = (u 1 , u 2 , . . . , u f ) by adding the edge u 1 w h−f . In other words, the midpoint of path on 2f edges is joined to the root w 1 by an (h − f − 1)-edge path. Our main results from this section are summarized in the following theorem.
Theorem 5.1. For positive integers n and h, there is an optimal tree T with n vertices and height at most h such that each T i is a k i -split with k 1 ≥ k 2 ≥ . . . ≥ k r (see Figure 10). Further, the tuple (k 1 , k 2 , . . . , k r ) is described by one of the following three types: · · · · · · Figure 10. The structure of a tree T with height h and order n which minimizes the number of root-containing subtrees.
Here we present several lemmas regarding the characteristics of an optimal tree. These all work toward the proof of Theorem 5.1. Proof. Let T be an optimal tree. Suppose, for contradiction, that there is a vertex v for which T (v) does not satisfy the lemma. In other words, there is a tree T ′ (v), which is rooted at v, has the same order as T (v), and has Let T ′ be the tree obtained from T by replacing T (v) with T ′ (v). Then T and T ′ have the same number of subtrees containing ρ but not v. Define T * := T − (T (v) − {v}) and let F T * (ρ, v) be the number of subtrees of T * that contain both ρ and v. Because T and T ′ only differ in the descendants of v, we have a contradiction to the optimality of T .
Lemma 5.3. The height of any leaf in an optimal tree is h.
Proof. If n = h + 1, it is straightforward to see that the path rooted at one end is the optimal tree. In the case when n > h + 1, some vertex must have at least 2 children. Suppose, for contradiction, that there is a leaf v ∈ V (T ) whose height is less than h. Let x be the closest ancestor (possibly the root) of v that has at least two children. Let y be a child of x that is not on P (x, v) and z be the child of x on P (x, v). Figure 11. Trees T (x) and T ′ (x) from Lemma 5.3 Let T x be the component containing x in T − xy − xz and consider the tree Figure 11. Note that T ′ (x) has the same order as T (x) and has height no more than h − h T (x) because the height of v in T is less than h. Counting the number of subtrees containing x in each tree, we obtain the following equalities: Together, these imply Since T was optimal, this contradicts Lemma 5.2.
Lemma 5.4. Every optimal tree has one of the following two properties: • All non-root vertices have degree at most 3.
• All non-root vertices of height less than h − 1 have degree at most 3. For any vertex v of height h − 1, , then the parent of v must have degree 2 or be the root.
Proof. As before, this proof proceeds by contradiction. Let x be a non-root vertex in an optimal tree T with degree at least 4. Say y, z, and w are three children of x and let u be the parent of x. Denote by T u and T x the components containing u and x respectively in T − ux − xy − xz − xw. Without loss of generality, assume Now consider the tree T ′ (u) obtained from T (u) by removing the edges xz and xw, inserting a path of length 2 between u and w, while identifying the vertices y and z (Figure 12). Note that T ′ (u) has the same height and order as T (u). Counting the number of subtrees containing u in each, we find Together, these imply the following Because T is an optimal tree, T (u) is an optimal tree by Lemma 5.2. Therefore (9) must be equality. Note that for any tree H and vertex a ∈ V (H), F H (v) ≥ 1 because the subtree containing only the vertex v will be counted. Therefore, equality holds in (9) exactly when F Tx (x) = F T (y) (y) = F T (z) (z) = F T (w) (w) = 1, or equivalently, deg(x) = 4 and y, z, w are all leaves so x has height h − 1 in T . Create T ′ from T by replacing T (u) with T ′ (u). Because (9) is equality, F T (u) (u) = F T ′ (u) (u). Therefore T ′ is also an optimal tree.
In T ′ , deg T ′ (x) = 3 but deg T ′ (u) = deg T (u) + 1. Observe u has height h − 2 in T ′ . If u is not the root of T ′ and deg T ′ (u) ≥ 4, then we can repeat the argument for optimal tree T ′ and vertex u having degree at least 4. Because the height of u is h − 2, we will find a contradiction in the step which parallels (9). Therefore deg T ′ (u) ≤ 3 which implies deg T (u) ≤ 2. Since u is not the root of T , we can conclude deg T (u) = 2 as stated in the lemma.
In the proof of Lemma 5.4, in the case where deg T (x) = 4, we created another optimal tree T ′ where deg T ′ (x) = 3 and no other degree 4 vertices where created. Hence, if an optimal tree has multiple degree 4 vertices of height h − 1, we can repeat this procedure to obtain an optimal T ′ with all vertices of degree at most 3. This establishes the following observation.
Observation 5.5. There is an optimal tree in which all non-root vertices have degree at most 3.
We now shift our attention to the structures of T i for 1 ≤ i ≤ k.
Lemma 5.6. In an optimal tree T , each subtree T i ∪ {ρ} falls into one of the following three categories: • There is at most one non-root vertex with degree 3.
• All non-root vertices of height at most h − 3 have degree 2, the vertex of height h − 2 has degree 3, and exactly one of its children has degree 3. Proof. We prove this in two pieces, considering the alternatives from Lemma 5.4 separately. We start with the optimal trees in which all vertices have degree at most 3. For contradiction, suppose there exists a T i ∪ {ρ} with at least two non-root vertices of degree 3. Let v be a degree 3 vertex of greatest height in T i and let u, w be the two children of v. Let z be the closest ancestor of v such that deg Ti (z) = 3, z has parent x, and z has child y / ∈ V (P (z, v)). Let ℓ 1 denote the distance from v to a leaf in T i and ℓ 2 the length of P (v, z). Let T x denote the component containing x in T (x) − xz ( Figure 13). Create a new tree T ′ (x) from T (x) by removing the edges vw and zy, inserting a length 2 path between x and y, and identifying u and w ( Figure 13). Note that T ′ (x) has the same height and order as T (x). The number of subtrees containing x in each is When either (10) or (11) is strict inequality, we have a contradiction to the optimality of T . Equality holds exactly when ℓ 1 = ℓ 2 = 1 and |V (T (y))| = ℓ 1 + ℓ 2 . In other words, T (y) is a single path on two vertices with y having height h − 1. Since T ′ (constructed from T by replacing T (x) with T ′ (x)) is an optimal tree, if x is not the root, deg T ′ (x) ≤ 3 since x has height h − 3. Therefore deg T (x) ≤ 2 as described in the second property of the lemma. If T falls into the second category listed in Lemma 5.4, then consider a subtree T i with a vertex v of degree 4 at height h − 1. We will show that all other non-root vertices in T i ∪ {ρ} must have degree 2. Suppose to the contrary that v has an ancestor z of degree 3. (In this way, we are able to simultaneously handle the case when there are two vertices of degree 4 in T i ∪ {ρ} because they would have to share a common ancestor of degree 3.) Label the vertices as before with s being the third child of v (Figure 14).
Create T ′ (x) by altering T (x) in a manner similar to that described above. Define as shown in Figure 14. Let ℓ 2 be the distance from z to v in T (x). Because all leaves have height h, F T (y) (y) ≥ ℓ 2 + 1 which is tight when T (y) is a path. Now if we calculate F T (x) (x) and F T ′ (x) (x) exactly and take their difference, we find . . . Once again, it is useful to note that for each of the optimal trees described in the second two properties of Lemma 5.6, the proof supplies T ′ analogues which have the same number of root-containing subtrees and yet fall under the first property description in Lemma 5.6. This gives the following observation.
Observation 5.7. There is an optimal tree with each T i ∪ {ρ} having at most one non-root vertex of degree 3.
Observation 5.7 establishes that each T i is a k i -split for some integer k i with 0 ≤ k i ≤ h − 1. To minimize some notation, we state the following structural observation.
Observation 5.8. In an optimal tree T , the number of root-containing subtrees in a k i -split together with root ρ is s h (k i ) := h + k 2 i + k i + 1. This definition also makes sense for the 0-split (together with ρ), which has h + 1 root-containing subtrees. Lemma 5.9. Among the T i subtrees in an optimal tree, at most two of them can be 0-splits.
Proof. Suppose, for contradiction, that T i , T j and T k are each 0-splits in an optimal tree. Consider S := T i ∪ T j ∪ T k ∪ {ρ}. Create S ′ from S by replacing T i with a 1-split, T j with an (h − 1)-split and deleting T k (Figure 15). The difference in the number of subtrees is This contradicts the optimality of T because the tree obtained from T by replacing S with S ′ has fewer root-containing subtrees than T .
Lemma 5.10. If some T i is a 0-split, then for each j = i, T j is either a 0-split or a 1-split.
Proof. Suppose instead that T i is a 0-split and T j is a k j -split where 1 < k j ≤ h−1. Let S be the tree induced by T i , T j and r. Construct S ′ from S by replacing T i with a 1-split and replacing T j with a (k j − 1)-split (Figure 16) Figure 16. Tree S and tree S ′ , which is the result from identifying x and y, from the proof of Lemma 5.10.
Note that S ′ has the same height and order as S, and This contradicts the optimality of T because the tree obtaining from T by replacing S with S ′ has fewer root-containing subtrees than T .
Lemma 5.11. A rooted tree T is not optimal if for any T i (k i -split) and T j (k j -split), we have Proof. Define T 2 be the subtree of T which consists of the root ρ together with T i and T j . Construct T ′ 2 from T 2 by replacing T i with a (k i − 1)-split and replacing T j with a (k j + 1)-split. This construction is well-defined because 1 ≤ k i and k j ≤ h − 1.
It is easy to see that T ′ 2 has the same height and order as T 2 . We have and By reversing the roles of k i and k j in the previous lemma, we obtain the following corollary.
Corollary 5.12. A rooted tree T is not optimal if for any T i , which is a k i -split, and T j , which is a k j -split, we have k j (1 + k i ) < h + 1 and k i < k j − 1.

Corollary 5.13. Fix an optimal tree T in which each
Proof. Let T be an optimal tree, as described in the corollary, with k 1 > h + 5 4 − 1 2 . For contradiction, suppose k 2 ≥ h + 5 4 − 1 2 . Observe However, this contradicts the statement of Lemma 5.11. Therefore the corollary holds.
Corollary 5.14. Fix an optimal tree T in which each T i is a k i -split. For any pair This contradicts Corollary 5.12, finishing the proof.
Going further in this direction, we have the following even more specific statements.
In particular, Proof. Since k 1 > h + 5 4 − 1 2 , Corollary 5.13 implies k 2 < h + 5 4 − 1 2 . Since T is optimal, Lemma 5.11 Because k 1 > h + 5 4 − 1 2 , then necessarily k i ≤ k 2 < k 1 − 1. Corollary 5.12 gives This is equivalent to We have established the three cases detailed in Theorem 5.1, aside from the further information when n ≥ 5h 2 . In the rest of this section, we examine the number of T i subtrees which can be a k i -splits in an optimal tree. This will shed light on the values of k i in an optimal tree with a large number of vertices, compared to its height, and also lends insight into the degree of the root vertex. First we prove a technical lemma.
Proof. Let T be a tree with root degree r and each T i is a k i -split. Suppose for contradiction that k 1 = k 2 = . . . = k h+x−1 = x (where the k i values are not necessarily in non-increasing order). Let H be the subtree induced by T 1 , . . . , T h+x−1 and the root ρ. Here, each T i is an x-split. Thus the number of root-containing subtrees in H is F H (ρ) = (h + x 2 + x + 1) h+x−1 .
Let T ′ i be an (x − 1)-split. Define a new tree T ′ by replacing T i with T ′ i for each i ∈ [h + x − 1] and increasing the degree of the root by one so that the new branch T ′ 0 is also an (x − 1)-split. Let H ′ be the subtree induced by T ′ 0 , T ′ 1 , . . . , T ′ h+x−1 and the root of T ′ . The number of root-containing subtrees in H ′ is In order to compare the number of root-containing subtrees of T and T ′ , it suffices to compare the number of root-containing subtrees of H and H ′ . In order to compare these, consider the ratio: The last expression can be further rewritten as e h 1/(t+1) since 1 + 1 y y > 1 2 e for y ≥ 1 >1 since h 1/(t+1) > ln(6h).
Thus, T is not an optimal tree because T ′ also has n vertices and height h but has fewer subtrees which contain its root.
As a consequence we obtain the following corollary: Corollary 5.17. Fix h ≥ 550 and n ∈ Z with n ≥ 5h 2 . Let T be an optimal tree with subtrees T i which are k i -splits. Using the terminology from Theorem 5.1, if T has an "even distribution" of k i values, then k i ≤ ln(6h) for all i ∈ {1, 2, . . . , r}. If T has "one large" k i values, then k i ≤ ln(6h) for all i ∈ {2, . . . , r}.
Proof. Fix n, h with n ≥ 5h 2 . Let T be an optimal tree with height h and n vertices. Toward a contradiction, suppose there is an integer x ∈ (ln(6h), h + 5 4 − 1 2 ] such that some T i is an x-split. Consider two cases. If x ∈ ln(6h), t 1/3 , then setting t := ln h ln x − 1, we have h 1/(t+1) = x > ln(6h) and t ≥ 2. Since n ≥ 5h 2 and x < h 1/3 , then clearly n ≥ (h + x)(h + x − 1) + 1. Thus by Lemma 5.16, there are at most h + x − 1 subtrees T i of T which can be x-splits.
If instead x ∈ h 1/3 , h + 5 4 − 1 2 ⊆ h 1/3 , h 1/2 (where h ≥ 550), then set t := 2. In this case, again h 1/(t+1) > ln(6h), t ≥ 2, and x ∈ [h 1/(t+1) , h 1/t ] with n ≥ (h + x)(h + x − 1) + 1. Therefore, by Lemma 5.16, there are at most h + x − 1 subtrees T i of T which can be x-splits. Now if T has an "even distribution" of k i values, then k i ∈ {x − 1, x} for some x ≤ √ h for all i ∈ {1, 2, . . . , r}. Based on the conclusions here, the number of vertices in T can be bounded as follows, which yields a contradiction: On the other hand, if T has "one large" k i value, then k 1 ≤ h − 1 and there is an integer x < √ h such that k i = x for i ∈ {2, 3, . . . , r}. Therefore, the number of vertices in T is bounded as follows, which produces a contradiction: Thus we have established Theorem 5.1.

Concluding remarks
In this study, we considered distances between three fundamental concepts of middle parts of the tree: the center, centroid, and subtree core. The maximum distances between each pair of these is first examined for general trees. The extremal structures that achieve these maximum distances contained a vertex of large degree and a long path, motivating us to study the same question for trees with degree restrictions and for trees with bounded diameter. The latter leads us to an interesting and difficult problem of minimizing number of root-containing subtrees among trees with given order and height. While we do not yet have a complete characterization of such optimal trees, we have established many of their structural properties to guide our continued study of this topic.