Next Article in Journal
Robust Positively Invariant Conditions for Perturbed Linear Discrete-Time Systems Using Dual Optimization
Next Article in Special Issue
Odd Cycles in Conditionally Faulty Enhanced Hypercube Networks
Previous Article in Journal
On Coefficient Inequalities for Functions of Symmetric Starlike Related to a Petal-Shaped Domain
Previous Article in Special Issue
Optimization of General Power-Sum Connectivity Index in Uni-Cyclic Graphs, Bi-Cyclic Graphs and Trees by Means of Operations
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An O(kn)-Time Algorithm to Solve Steiner (k, k′)-Eccentricity on Trees

College of Big Data Statistics, Guizhou University of Finance and Economics, Guiyang 550025, China
Axioms 2025, 14(3), 166; https://doi.org/10.3390/axioms14030166
Submission received: 10 December 2024 / Revised: 17 February 2025 / Accepted: 22 February 2025 / Published: 24 February 2025
(This article belongs to the Special Issue Graph Theory and Combinatorics: Theory and Applications)

Abstract

:
Steiner ( k , k ) -eccentricity on a given fixed k -subset in a graph G is the maximum Steiner distance over all k-subsets of V ( G ) which contain the fixed k -set, where the Steiner distance of a set is the size of a minimum Steiner tree on this set in a graph. Let R V ( T ) be the given fixed k -subset in a tree T. Let k 1 and k 2 be two integers such that k 1 k 2 k . We prove that, in a tree, every optimal solution of Steiner ( k 1 , k ) -eccentricity on R takes some optimal solution of Steiner ( k 2 , k ) -eccentricity on R as a partial solution. On the other hand, every optimal solution of Steiner ( k 2 , k ) -eccentricity on R is part of some optimal solution of Steiner ( k 1 , k ) -eccentricity on the set R in a tree. Finally, we present an O ( k n ) -time algorithm to solve Steiner ( k , k ) -eccentricity on a given fixed k -set in trees.
MSC:
05-08; 05C12; 05C85; 68Q25; 68R10

1. Introduction

The Steiner ( k , k ) -eccentricity on a given fixed k -subset of vertices measures the maximum distance from the subset to all k-sets, each of which contains the subset. This metric reflects a kind of optimal connectivity challenge. This concept can engage in metaphorically multi-attribute decision-making (MADM) [1], where each attribute could represent a “vertex” and the optimization of the overall system’s performance corresponds to finding the “Steiner point” that maximizes “distance” to all objectives. The Steiner distance is the minimum number of edges in a connected subgraph that contains a given subset of vertices. This distance between two subsets is the distance for their union.
Particularly, if k = 1 , the Steiner ( k , k ) -eccentricity turns to be Steiner k-eccentricity on a specific vertex. The research of Steiner k-eccentricity can be traced back to the 1990s [2]. Researchers have studied extensively mathematical properties of Steiner k-eccentricity [3,4,5,6,7]. Steiner k-eccentricity has indeed found practical applications. Huilgol et al. [4], in their 2024 study, applied Steiner k-eccentricity in predicting the boiling points of primary and secondary amines, demonstrating its effectiveness in chemical property prediction. In addition, it has been used to calculate network similarity measures [8]. Additionally, it is leveraged for predicting the molecular activity of substances [9]. Collectively, these advancements highlight the adaptability and significance of Steiner k-eccentricity as a tool in the fields of network analysis and chemical predictive modeling. For a given fixed k -set of vertices R, the Steiner ( k , k ) -eccentricity on R is the maximum number of edges in a minimum distance Steiner tree with k k vertices and containing R. An optimal solution of this is a corresponding Steiner tree. When, as for us, the underlying graph is a tree, every Steiner tree is uniquely determined by, and is easily computed from by, any set of its vertices that includes all its leaves.
In decision making contexts, seeking a solution that optimizes across various attributes is to find a Steiner tree in a network of objectives, where the goal is to minimize the cumulative or maximum ’cost’ associated with achieving all objectives simultaneously. Since the well-known minimum Steiner tree problem has been proven to be NP-hard [10], it is not easy to compute Steiner ( k , k ) -eccentricity. In recent years, algorithms for computing Steiner k-eccentricity have been developed [11]. Li et al. studied average Steiner 3-eccentricity on trees [12] and devised a polynomial algorithm [11] for finding the Steiner k-eccentricity of a given vertex in a tree. Later, Li et al. [13] tried to compute Steiner k-eccentricity on general graphs by using the algorithm on trees. But, the time-complexity is really unbearable.
In 2024, Gengji Li et al. delved into the realm of graph theory, specifically focusing on the Steiner ( 3 , 2 ) -eccentricity of a 2-set within trees in their research work [14]. This study not only explores this particular aspect of Steiner distances but also contributes by establishing several bounds—both lower and upper—for the average Steiner ( 3 , 2 ) -eccentricity on trees. Despite these advancements, computational studies and algorithmic developments for the broader concept of Steiner ( k , k ) -eccentricity remain limited, indicating an area of future research where the practical computation and efficiency of such measures could be further investigated.
In this study, the structure of an optimal solution of Steiner ( k , k ) -eccentricity on a fixed k -set in a tree is studied. For a given k -set R V ( T ) in a tree T and an integer i : k i < k , we prove that an optimal solution of Steiner ( k , k ) -eccentricity on R takes some optimal solution of Steiner ( i , k ) -eccentricity on R as a partial solution of it. In addition, given a subtree T 1 which is an optimal solution of Steiner ( k , k ) -eccentricity on a fixed k -set R in a tree T, there is an optimal solution T of Steiner ( ( k + 1 ) , k ) -eccentricity on R such that T contains the given T 1 .
Finally, an O ( k n ) -time algorithm is devised to solve Steiner ( k , k ) -eccentricity in a tree. The time complexity meets with the result in [11] for computing Steiner k-eccentricity.
The rest of this paper is organized as follows. Section 2 proposes basic terminologies and properties. We define and explore the concepts of quasi-pendent paths and the eccentricity of a subgraph in this section, which serve as foundational elements for the entire paper. The structural properties of optimal solutions are examined in Section 3. Particularly, Section 3 focuses on the relationship between Steiner ( k , k ) -eccentricity and Steiner ( ( k 1 ) , k ) -eccentricity on a given fixed k -set. Section 4 shows that Steiner ( k , k ) -eccentricity can be solved in O ( k n ) -time. We conclude the paper in Section 5 and propose several directions for future work.

2. Preliminary

In the remainder of this paper, we focus on trees and the underlying graph is always a tree. A tree is a connected graph which has no cycles. The vertex set and edge set of a tree T are, respectively, denoted as V ( T ) and E ( T ) . If a tree is composed of a single vertex, then the tree is said to be trivial. If a tree contains more than one vertex, it is said to be non-trivial. The unique path between v V ( T ) and u V ( T ) in a tree T is denoted by P T ( v , u ) . A vertex is a neighbor of another vertex if they are adjacent in a tree. The set of neighbors of a vertex v in a tree T is denoted as N e i g h b o r T ( v ) . The degree of a vertex v in a tree T is denoted as d e g t ( v ) which is the number of neighbors of v, i.e., d e g T ( v ) = | N e i g h b o r T ( v ) | . If d e g T ( v ) = 1 , then v is said to be a leaf of T. The set of leaves in a tree T is denoted as ( T ) . If d e g T ( v ) = 2 , then v is said to be an internal vertex of T. If d e g T ( v ) > 2 , then v is said to be a branching vertex or a branch of G. If G itself is a path, then a leaf of the path is also said to be an endpoint.
Let V 1 V ( T ) and E 1 E ( T ) , respectively, be a subset of vertices and edges in a tree T. The induced subgraph of V 1 in T is denoted by T [ V 1 ] = ( V 1 , E ) which is a subgraph of T such that an edge of T is in E if and only if its two endpoints are both in V 1 . The induced subgraph of E 1 in T is denoted as T [ E 1 ] = ( V , E 1 ) which is a subgraph of T such that V = V ( E 1 ) .
Lemma 1.
Let T 1 and T 2 be two sub-trees of a tree T such that | V ( T 1 ) V ( T 2 ) | 2 . Let u , v V ( T 1 ) V ( T 2 ) be two distinct vertices. We have V ( P T ( u , v ) ) V ( T 1 ) V ( T 2 ) .
Proof. 
Recall that the path P is unique, since T is a tree. Since u , v V ( T 1 ) and T 1 is connected, P must be a sub-tree of the tree T 1 . In addition, u , v V ( T 2 ) and T 2 is connected, P must be a sub-tree of the tree T 2 . So, P is a path both in T 1 and in T 2 . Therefore, all vertices belonging to P are also in V ( T 1 ) V ( T 2 ) .    □
Lemma 2.
Let P 1 and P 2 be two distinct paths in a tree T. If E ( P 1 ) E ( P 2 ) then the subgraph induced by E ( P 1 ) E ( P 2 ) is a single path in T.
Proof. 
Suppose on the contrary that the subgraph induced by common edges has more than one component. Obviously, each component is a sub-path of P 1 , as well as P 2 . Let p and p be two different components. For the reason that T is connected, there exists two distinct sub-paths connecting p and p , respectively, in P 1 and P 2 . This implies a cycle in the tree T.    □
The minimum Steiner tree on a set S V ( T ) in a tree T is denoted by S t e i ( S ) . For us, the size of a tree is the number of edges in it. Each vertex in S is said to be a terminal vertex, while each vertex in V ( S t e i ( S ) ) S is said to be a Steiner vertex. The Steiner distance on a set S is the size of a S t e i ( S ) , and is denoted as d T ( S ) . A vertex set S V ( T ) is a k-set if | S | = k .
Lemma 3.
Let T be a tree and S V ( T ) . The set of leaves in a minimum Steiner tree on S is a subset of S, i.e., ( S t e i ( S ) ) S .
Proof. 
Any leaf not in S of a tree that connects S can be removed without disconnecting S. So, the leaves in a minimum Steiner tree of S should all belong to S.    □
Lemma 4.
Let S V ( T ) be a vertex set of a tree T. For every two vertices u , v S , the path P T ( u , v ) is contained by the minimum Steiner tree S t e i ( S ) .
Proof. 
The path P T ( u , v ) is unique in the tree T. In addition, the vertex u and v should be connected in S t e i ( S ) . So, the path P T ( u , v ) is contained in the minimum Steiner tree S t e i ( S ) .    □
Given a fixed k -set R V ( T ) of a tree T, Steiner ( k , k ) -eccentricity of R in T is defined as: e c c k ( R , T ) = max { d T ( S ) : R S V ( G ) , | R | = k 0 , | S | = k k } . If | R | = 0 , then e c c k ( R , G ) is defined to be zero. In this paper, we consider the case that R . If | R | = 1 , then Steiner ( k , 1 ) -eccentricity of R turns to be Steiner k-eccentricity of a given vertex. The computation of Steiner k-eccentricity on trees has been studied in paper [11,12].
Given a fixed k -set R, if S is a k-set such that R S and | E ( S t e i ( S ) ) | = e c c k ( R , T ) , then S is said to be a Steiner ( k , k ) -ecc R-set corresponding to S t e i ( S ) . The minimum Steiner tree S t e i ( S ) is an optimal solution corresponding to e c c k ( R , T ) and said to be a Steiner ( k , k ) -ecc R-tree corresponding to S. In this paper, T R k stands for a Steiner ( k , k ) -ecc R-tree, and S R k stands for a Steiner ( k , k ) -ecc R-set.
Lemma 5.
Let R V ( T ) be a fixed k -set in a tree T. The Steiner tree S t e i ( R ) on R in T is a subgraph of T R k for every k k .
Proof. 
If | R | = 1 , then S t e i ( R ) is the single vertex in R. Obviously, S t e i ( R ) is a subgraph of a Steiner ( k , k ) -ecc R-tree, for every k k . The following proof considers the case that | R | 2 .
In order to prove that S t e i ( R ) is a subgraph of T R k , we need to prove V ( S t e i ( R ) ) V ( T R k ) . Because both S t e i ( R ) and T R k are trees, by Lemma 1, V ( S t e i ( R ) ) V ( T R k ) implies that E ( S t e i ( R ) ) E ( T R k ) . Since R V ( S t e i ( R ) ) and R V ( T R k ) , we are going to prove that V ( S t e i ( R ) ) R V ( T R k ) .
Suppose on the contrary that there is a vertex v V ( S t e i ( R ) ) R such that v V ( T R k ) . Since v S t e i ( R ) R , then there are two vertices u , w R such that the path P S t e i ( R ) ( u , w ) contains the vertex v. Because v V ( T R k ) , u V ( T R k ) and w V ( T R k ) , the path P T R k ( u , w ) does not go through v any more. Then, there are at least two different paths between u and w in the tree T, which is a contradiction. Therefore, S t e i ( R ) is a subgraph of T R k , for every k k .    □
Lemma 6.
Let R V ( T ) be a fixed k -set in a tree T. If | ( T ) R | k k , then T R k = T . Otherwise, S R k R ( T ) .
Proof. 
Suppose on the contrary that ( T ) S R k in the case that | ( T ) R | k k . Since R S R k , there is at least one vertex v 1 ( T ) R such that v 1 S R k . Because S R k contains exactly k vertices and R must be contained by S R k , there must be a vertex u 1 V ( T ) ( T ) such that u 1 S R k R .
On the other hand, suppose on the contrary that S R k R ( T ) in the case that | ( T ) R | > k k . Let u 2 S R k R be a vertex such that the degree of u 2 is at least two in T. In other words, u 2 ( T ) . Since | ( T ) R | > k k , there must be a leaf v 2 ( T ) R such that v 2 S R k .
So neither u 1 nor u 2 is a leaf in the tree T. However, they are both in the set S R k R . In addition, v 1 and v 2 are both leaves in the set ( T ) R , but not in the set S R k . In the following proof, we will prove that neither the scene ( u 1 , v 1 ) nor the scene ( u 2 , v 2 ) could occur, which implies that the lemma holds true.
Let us prove that the scene of u 1 and v 1 could not occur. The proof is performed through the two following cases.
  • There are two vertices w 1 , w 2 S R k such that u 1 is an internal vertex of the path P T ( w 1 , w 2 ) . Since the path between w 1 and w 2 in T is unique, the unique path must be owned by a Steiner ( k , k ) -ecc R-tree. Let T be the Steiner ( k , k ) -ecc R-tree which contains P T ( w 1 , w 2 ) . In other words, T contains u 1 naturally whenever w 1 and w 2 is in the S R k . Now, let us consider ( S R k { u 1 } ) { v 1 } which is another k-set. This minimum Steiner tree of this k-set has at least one more edge than that of the set S R k , because v 1 S R k and the minimum Steiner tree on the k-set ( S R k { u 1 } ) { v 1 } must contain P T ( w 1 , w 2 ) . This means that T is not the maximum, which is a contradiction.
  • For any two vertices w 1 , w 2 S R k , u 1 is not an internal vertex of the path P T ( w 1 , w 2 ) . Since d e g T ( u 1 ) 2 , there exists a neighbor u N e i g h b o r T ( u 1 ) such that u V ( T R k ) . Now we consider the new k-set ( S R k { u 1 } ) { u } . The minimum Steiner tree on the new k-set ( S R k { u 1 } ) { u } is strictly larger than that on the set S R k . This is also a contradiction.
Therefore, if | ( T ) R | k k , then T R k = T .
The scene of u 2 and v 2 also could not occur. The proof is the same as the above. Replacing u 1 with u 2 and then replacing v 1 with v 2 in the above, one will complete the proof. Therefore, if | ( T ) R | > k k , S R k R ( T ) .    □
Let R V ( T ) be a k -set in a tree T. By Lemma 6, if | ( T ) R | k k , then the Steiner ( k , k ) -ecc R-tree is the entire tree T, because ( T ) S R k . This is trivial for computation. In this article, we examine | ( T ) R | > k k in the absence of any specific instructions.
Corollary 1.
Let R V ( T ) be a fixed k -set in a tree T. If | ( T ) R | > k k , then every vertex in the set S R k R is a leaf of T R k . Moreover, for every two integers k 1 and k 2 satisfying that k 1 > k 2 k , if | ( T ) R | k 1 k , then we have | ( T R k 1 ) | > | ( T R k 2 ) | .
Proof. 
By Lemma 6, if | ( T ) R | > k k , then every vertex in the set S R k R is a leaf of T. So, for every vertex u in the set S R k R , d e g T R k ( u ) could not be larger than one, since T R k is a sub-tree of T. For every integer k k , if | ( T ) R | > k k , by Lemmas 3 and 6, we have ( T R k ) = ( S R k R ) ( ( T ) R ) . Since | S R k 1 | > | S R k 2 | , | S R k 1 R | > | S R k 2 R | holds true. Therefore, | ( T R k 1 ) > | ( T R k 2 ) .    □

2.1. Quasi-Pendent Path

Given a fixed k -set R V ( T ) in a tree T, according to Lemma 5, a Steiner ( k , k ) -ecc R-tree always contains S t e i ( R ) . In this paper, T 0 always stands for the minimum Steiner tree of the given k -set R. In other words, T 0 = S t e i ( R ) .
Recall that a path P is said to be a pendent path in a graph G if each internal vertices of P is also an internal vertex of G, while one endpoint of P is a leaf of G [15]. Here, we extends the concept of pendent path and named it as quasi-pendent path, which is defined as follows. Let T be a sub-tree of T such that V ( T 0 ) V ( T ) and ( T ) V ( T 0 ) . The quasi-pendent path  P ( T 0 , u , T ) of the leaf u ( T ) V ( T 0 ) in T is a non-trivial path such that: (1) u is one endpoint of P ( T 0 , u , T ) ; (2) If P ( T 0 , u , T ) contains internal vertices, then each internal vertex of P ( T 0 , u , T ) is also an internal vertex of T (with degree 2 in T ) but does not belong to V ( T 0 ) ; (3) The other endpoint of P ( T 0 , u , T ) is either in V ( T 0 ) or a branching vertex of T . Please see Figure 1 for an example of quasi-pendent paths.
Lemma 7.
For every fixed k -set R of a tree T and every sub-tree T satisfying that V ( T 0 ) V ( T ) and ( T ) V ( T 0 ) , the quasi-pendent path P ( T 0 , u , T ) of a leaf u ( T ) V ( T 0 ) always exists and is unique.
Proof. 
Let v V ( T 0 ) and u ( T ) V ( T 0 ) . Since T is a tree, P T ( u , v ) is the unique path between u and v in T . Note that the path P T ( u , v ) always exists since T is a tree which is connected. Let v be the nearest vertex to u among all vertices on P T ( v , u ) satisfying: (1) if V ( P T ( v , u ) ) { v , u } , then d e g T ( w ) = 2 and w V ( T 0 ) for each vertex w V ( P T ( v , u ) ) { v , u } ; (2) either d e g T ( v ) 3 or v V ( T 0 ) .
Since N e i g h b o r T ( u ) , the vertex v could not be u. In addition, there could not be two distinct vertices on P T ( u , v ) such that both of them satisfies the above conditions. Otherwise, either one of them would not be the nearest one to u, or there would be a cycle in T. So the quasi-pendent path of a leaf in a tree is unique and always exists.    □
Lemma 8.
Let R V ( T ) be a fixed k -set in a tree T. Let v be the endpoint of P ( T 0 , u , T R k ) such that v u . Let ( v , w ) E ( P ( T 0 , u , T R k ) ) . Let F be the forest obtained by deleting the edge ( v , w ) from T. Let T v and T w be the sub-trees in F, respectively, containing v and w. We have R V ( T w ) = .
Proof. 
If R ( V ( T w ) ) , then let x R V ( T w ) . According to the definition of the quasi-pendent path, R ( V ( P ( T 0 , u , T R k ) { v } ) ) = . So x ( R V ( T w ) ) ( V ( P ( T 0 , u , T R k ) ) { v } ) . Then, P T R k ( v , x ) must have common vertex with the path P ( T 0 , u , T R k ) . So, a vertex in V ( P ( T 0 , u , T R k ) ) { v } must be a degree larger than two. This contradicts the fact that P ( T 0 , u , T R k ) is a quasi-pendent path.    □

2.2. Eccentricity of a Steiner ( k , k ) -ecc R-Tree

Let H be a subgraph of a tree T, and v V ( T ) . The shortest path between v and H in T is denoted by P T ( v , H ) . In P T ( v , H ) , v is marked as s o u r c e ( P T ( v , H ) ) while the other endpoint of P T ( v , H ) is marked as d e s t ( P T ( v , H ) ) . The distance between v and H in T which is denoted by d i s T ( v , H ) is the size of P T ( v , H ) . The eccentricity of H in T is e c c ( H , T ) = max v V ( T ) ( d i s T ( v , H ) ) .
Lemma 9.
Let H be a subgraph of a tree T, and v V ( T ) . Let v = d e s t ( P T ( v , H ) ) . Then, v V ( H ) and ( V ( P T ( v , H ) ) { v } ) V ( H ) = .
Proof. 
If v V ( H ) , then according to the definition, v = v . So, obviously, v V ( H ) and V ( P G ( v , H ) ) { v } V ( H ) = .
If v V ( H ) , then v v . Suppose on the contrary that ( V ( P T ( v , H ) ) { v } ) V ( H ) . There is a vertex u V ( P T ( v , H ) ) such that u v and u V ( H ) . Let P be the sub-path between v and u. Due to the reason that P T ( v , H ) is the shortest path between v and v , its sub-path P is a shortest path between v and u. In addition, the length of P is strictly smaller than that of P T ( v , H ) since v u . This contradicts the fact that P T ( v , H ) is a shortest path between v and H, because u is a vertex in V ( H ) and P 1 is smaller than P T ( v , H ) .    □
Lemma 10.
Let T 1 and T 2 be two distinct sub-trees of a tree T such that V ( T 1 ) V ( T 2 ) . If d e s t ( P T ( v , T 2 ) ) V ( T 1 ) , then V ( P T ( v , T 2 ) ) V ( T 1 ) = .
Proof. 
Let P = P T ( v , T 2 ) . Suppose on the contrary that V ( P ) V ( T 1 ) . Let u V ( P ) V ( T 1 ) . Let w be the nearest vertex to d e s t ( P ) among all vertices in V ( T 1 ) V ( T 2 ) , i.e., w = d e s t ( P T ( d e s t ( P ) , V ( T 1 ) V ( T 2 ) ) ) .
If w = u , then the path P would be the form v w d e s t ( P ) because the path from s o u r c e ( P ) to d e s t ( P ) in tree T is unique. Thus, V ( P ) { d e s t ( P ) } V ( T 2 ) . By Lemma 9, this contradicts the fact that P is the shortest between v and T 2 .
Now, let us consider the case that w u . Then, then the path between u and d e s t ( P ) does go through w. Since T 1 is a tree u and w are connected in T 1 . To ensure the connectivity in T 1 , the path between u and w is the form u d e s t ( P ) w , and must be in the tree T 1 . Then, the path between w and d e s t ( P ) is in T 1 . This contradicts the fact that d e s t ( P ) does not belong to V ( T 1 ) .    □
Let H be a subtree in a tree T. If v V ( T ) satisfies d i s T ( v , H ) = e c c ( H , T ) , then the path P T ( v , H ) is said to be an H-ecc path. In addition, v is said to be the head of the H-ecc path and is marked as H e a d ( P T ( v , H ) ) , while the other endpoint d e s t ( P T ( v , H ) ) is said to be the tail of the H-ecc path and marked as T a i l ( P T ( v , H ) ) . Let F a r ( H , T ) V ( T ) be the set of heads of all H-ecc paths. Every vertex in F a r ( H , T ) is said to be a farthest vertex away from H in T.
Lemma 11.
Let T be a sub-tree of a tree T such that ( T ) V ( T ) . Every vertex in F a r ( T , T ) is a leaf of T.
Proof. 
Let V 1 = V ( T ) V ( T ) . Then, V 1 because of ( T ) V ( T ) . Let w F a r ( T , T ) be the head of a T -ecc path, and w be the tail of the T -ecc path. By Lemma 9, w V 1 . If d e g T ( w ) 2 , then there must be a leaf w such that the path P T ( w , w ) has no common edges with the T -ecc path. Then, the path P T ( w , w ) is the shortest path between w and T , since in a tree, there is a unique path P T ( w , w ) . Moreover, P T ( w , w ) is strictly longer than the path P T ( w , w ) , which contradicts the fact that P T ( w , w ) is a T -ecc path.    □
Lemma 12.
Let R V ( T ) be a fixed k -set in a tree T. Let T 1 and T 2 , respectively, be two distinct Steiner ( k , k ) -ecc R-trees. Let P 1 be a T 1 -ecc path and P 2 be a T 2 -ecc path. If | ( T ) R | > k k , then both T a i l ( P 1 ) and T a i l ( P 2 ) belong to the set V ( T 1 ) V ( T 2 ) .
Proof. 
Since R , we have V ( T 1 ) V ( T 2 ) . In other words, there are common vertices between T 1 and T 2 . So there are three configurations for the positions of T a i l ( P 1 ) and T a i l ( P 2 ) . The first one is that T a i l ( P 1 ) and T a i l ( P 2 ) both belong to the set V ( T 1 ) V ( T 2 ) . The second configuration is that one of them is in V ( T 1 ) V ( T 2 ) and the other one is in ( V ( T 1 ) V ( T 2 ) ) ( V ( T 2 ) V ( T 1 ) ) . The last one is that T a i l ( P 1 ) V ( T 1 ) V ( T 2 ) and T a i l ( P 2 ) V ( T 2 ) V ( T 1 ) . In the following proof, we will, respectively, show that the second and third configurations could not occur.
Let us prove that the second configuration could not occur. By Lemma 9, T a i l ( P 1 ) could not in V ( T 2 ) V ( T 1 ) , and T a i l ( P 2 ) could not in V ( T 1 ) V ( T 2 ) . Without loss of generality, let T a i l ( P 1 ) V ( T 1 ) V ( T 2 ) and T a i l ( P 2 ) V ( T 2 ) V ( T 1 ) . We will derive a contradiction through the following statements.
Let v V ( T 1 ) V ( T 2 ) such that v is the nearest vertex to T a i l ( P 2 ) among all vertices in V ( T 1 ) V ( T 2 ) . See Figure 2a for this configuration. By Lemma 10, no vertex of P 2 is in T 1 . By the assumption, v T a i l ( P 2 ) . Because P 1 is a T 1 -ecc path of T 1 and the path between v and H e a d ( P 2 ) is the shortest path between H e a d ( P 2 ) and T 1 , the length of P 1 is no less than the length of the path between v and H e a d ( P 2 ) in T. Since v T a i l ( P 2 ) , P 1 is longer than P 2 .
According to the assumption, T a i l ( P 1 ) V ( T 1 ) V ( T 2 ) is also a vertex in T 2 . Therefore, the contradiction is that P 2 is not a T 2 -ecc path. So, the second configuration could not occur.
Finally, let us prove that the third configuration could also not occur. Suppose on the contrary that T a i l ( P 1 ) V ( T 1 ) V ( T 2 ) and T a i l ( P 2 ) V ( T 2 ) V ( T 1 ) . Let v V ( T 1 ) V ( T 2 ) such that v is the nearest vertex to T a i l ( P 2 ) among all vertices in V ( T 1 ) V ( T 2 ) . Let u V ( T 1 ) V ( T 2 ) such that u is the nearest vertex to T a i l ( P 1 ) among all vertices in V ( T 1 ) V ( T 2 ) . By Lemma 10, V ( P 1 ) V ( T 2 ) = and V ( P 2 ) V ( T 1 ) = both hold true. See Figure 2b, for this configuration.
Without loss of generality, let the length of P 1 be no larger than that of P 2 , i.e., | E ( P 1 ) | | E ( P 2 ) | . Since v T a i l ( P 2 ) , then the path between v and H e a d ( P 2 ) is strictly longer than the path P 1 . This contradicts the fact that the path between v and H e a d ( P 2 ) is the shortest path between H e a d ( P 2 ) and T 1 and P 1 is a T 1 -ecc path. So the third configuration also could not occur.
All in all, T a i l ( P 1 ) and T a i l ( P 2 ) both belong to the set V ( T 1 ) V ( T 2 ) .    □
Theorem 1.
Let R V ( T ) be a fixed k -set in a tree T. Let T 1 and T 2 , respectively, be two distinct Steiner ( k , k ) -ecc R-trees. We have e c c ( T 1 , T ) = e c c ( T 2 , T ) .
Proof. 
If | ( T ) R | k k , by Lemma 6, T 1 = T 2 = T . Otherwise, from Lemma 12, we know that the tail of T 1 -ecc path and the tail of T 2 -ecc path are both in the set V ( T 1 ) V ( T 2 ) . In addition, by Lemma 1, the induced subtree T 1 [ V ( T 1 ) V ( T 2 ) ] is the same as T 2 [ V ( T 1 ) V ( T 2 ) ] . Let T C = T 1 [ V ( T 1 ) V ( T 2 ) ] . Then, the T 1 -ecc path, as well as the T 2 -ecc path is just the T c -ecc path. Therefore, the length of T 1 -ecc path is equal to that of T 2 -ecc path.    □

3. The Structure of Optimal Solutions

This section studies the structure of optimal solutions on trees, which is a support for the O ( k n ) -time algorithm of Section 4. The structural properties are stated in Theorems 2 and 3. Given a vertex k -set R V ( G ) and an integer k k , Theorem 2 indicates that each Steiner ( k , k ) -ecc R-tree contains some Steiner ( k 1 , k ) -ecc R-tree. But, this does not mean that each any Steiner ( k 1 , k ) -ecc R-tree is contained by a Steiner ( k , k )-ecc R-tree. A trivial questions whether there is a Steiner ( k 1 , k )-ecc R-tree not owned by any Steiner ( k , k ) -ecc R-tree. Theorem 3 answers this question and says that each Steiner ( k 1 , k ) -ecc R-tree is contained by some Steiner ( k , k ) -ecc R-tree. It is a little stronger.
Lemma 13.
Let R V ( G ) be a fixed k -set in a tree T such that | ( T ) R | > k k > 0 . Let u be a leaf in ( T R k ) ( T R k 1 ) . If E ( P ( T 0 , u , T R k ) ) E ( T R k 1 ) , then there exists x ( T R k 1 ) and v V ( T 0 ) such that V ( P T ( v , x ) ) { v } V ( T 0 ) = and E ( P ( T 0 , u , T R k ) ) E ( P T ( v , x ) ) .
Proof. 
Since P ( T 0 , u , T R k ) has common edges with T R k 1 , then there exist x ( T R k 1 ) and v V ( T R k 1 ) { x } such that E ( P ( T 0 , u , T R k ) ) E ( P T ( v , x ) ) . Given vertex x ( T R k 1 ) , let V x V ( T R k 1 ) { x } be the vertex set such that E ( P ( T 0 , u , T R k ) ) E ( P T ( v , x ) ) holds true for every vertex v V x . Let u be the endpoint of P ( T 0 , u , T R k ) such that u u . By Lemma 2, let u 1 , u 2 V ( P ( T 0 , u , T R k ) ) V ( P T ( v , x ) ) such that the common portion of P ( T 0 , u , T R k ) and P T ( v , x ) is P T ( u 1 , u 2 ) , where v V x . Without loss of generality, let u 1 be farther to x than u 2 . See Figure 3.
We claim that V ( P T ( u 1 , x ) ) { u 1 } V ( T 0 ) = . Since P T ( u 1 , u 2 ) is a sub-path of P ( T 0 , u , T R k ) , then, by Lemma 8 and the definition of quasi-pendent path V ( P T ( u 1 , u 2 ) ) { u 1 } V ( T 0 ) = . Now we prove that V ( P T ( u 2 , x ) ) V ( T 0 ) = . Assume on the contrary that V ( P T ( u 2 , x ) ) V ( T 0 ) . Then, by Lemma 5, T R k contains a path between u 2 and a vertex in V ( T 0 ) . This implies that the degree of u 2 is at least three in T R k . Recall that u 2 is an internal vertex of P ( T 0 , u , T R k ) . By definition, this is a contradiction.
Now, we prove that V x V ( T 0 ) and there is a vertex v V x V ( T 0 ) such that V ( P T ( v , x ) ) { v } V ( T 0 ) = . Because V ( P T ( u 1 , x ) ) { u 1 } V ( T 0 ) = , we just need to prove that V x V ( T 0 ) and there is a vertex v V x V ( T 0 ) such that V ( P T ( v , u 1 ) ) { v } V ( T 0 ) = . We prove this proposition by discussing whether u is in V ( T 0 ) or not.
If u V ( T 0 ) , then the path P T ( u , x ) satisfying that E ( P ( T 0 , u , T R k ) ) E ( P T ( u , x ) ) . Thus, u V x V ( T 0 ) and V ( P T ( u , x ) ) { u } V ( T 0 ) = .
Now, let us consider the case that u V ( T 0 ) . By Lemma 5, since the path P ( T 0 , u , T R k ) and T 0 are connected, there is a vertex w V ( P ( T 0 , u , T R k ) ) and a vertex w V ( T 0 ) such that w and w is connected through a path in T R k and V ( P T R k ( w , w ) ) { w } V ( T 0 ) = , since T 0 is a sub-tree of T R k .
We claim that w = u . Otherwise, let w V ( P ( T 0 , u , T R k ) ) { u } such that there is a path between w and w in T R k . Then, the degree of w in T R k is at least three since the path P T ( w , u ) is also a part of T R k . This contradicts the fact that P T R k ( u , u ) is a quasi-pendent path.
So w must be equal to u . Then, w V x V ( T 0 ) such that V ( P T ( w , x ) ) { w } V ( T 0 ) = . Therefore, the lemma holds.    □
Lemma 14.
Given a leaf u ( T ) , if there exist two distinct leaves u 1 , u 2 ( T R k ) and a vertex v V ( T 0 ) such that V ( ( P T ( v , u ) ) { v } ) V ( T 0 ) = , E ( P T ( v , u ) ) E ( P ( T 0 , u 1 , T R k ) ) and E ( P T ( v , u ) ) E ( P ( T 0 , u 2 , T R k ) ) , then neither the other endpoint of P ( T 0 , u 1 , T R k ) nor the other endpoint of P ( T 0 , u 2 , T R k ) is in the set V ( T ) V ( P T ( v , u ) ) .
Proof. 
Let u 1 be the other endpoint of P ( T 0 , u 1 , T R k ) , and u 2 be the other endpoint of P ( T 0 , u 2 , T R k ) . By Lemma 2, the common part which is shared by P ( T 0 , u 1 , T R k ) and P T ( v , u ) is a single path. In addition, the common part which is shared by P ( T 0 , u 2 , T R k ) and P T ( v , u ) is also a single path. Suppose on the contrary that u 1 is not on the path P T ( v , u ) . Then, u 1 v . In addition, v is neither on the path P T ( u 1 , u ) nor on the path P T ( u 1 , u 1 ) because v V ( T 0 ) and every vertex in V ( P ( T 0 , u 1 , T R k ) ) { u 1 } does not belong to V ( T 0 ) . In the tree T, the two paths P ( T 0 , u 1 , T R k ) and P ( T 0 , u 2 , T R k ) are connected by some edges of P T ( v , u ) , because they both share edges with P T ( v , u ) .
Because the vertices excluding the endpoints of P ( T 0 , u 1 , T R k ) and P ( T 0 , u 2 , T R k ) are all internal vertices in T R k , there is no edge of P T ( v , u ) connecting P ( T 0 , u 1 , T R k ) and P ( T 0 , u 2 , T R k ) in T R k . So, in the tree T R k , there is a sub-tree T connecting the three vertices v, u 1 and u 2 such that E ( T ) E ( P T ( v , u ) ) , since u 1 v . This implies that there is a cycle in the tree T. It is in the same way to prove that u 2 could not be in the set V ( T ) V ( P T ( v , u ) ) . So, the lemma holds.    □
Lemma 15.
Given a leaf u ( T ) , if there exist two distinct leaves u 1 , u 2 ( T R k ) and a vertex v V ( T 0 ) such that V ( ( P T ( v , u ) ) { v } ) V ( T 0 ) = , E ( P T ( v , u ) ) E ( P ( T 0 , u 1 , T R k ) ) and E ( P T ( v , u ) ) E ( P ( T 0 , u 2 , T R k ) ) , then it is impossible that u u 1 and u u 2 occur simultaneously.
Proof. 
Let P 0 = P T ( v , u ) , u 1 be the other endpoint of P ( T 0 , u 1 , T R k ) and u 2 be the other endpoint of P ( T 0 , u 2 , T R k ) . By Lemma 2, let P 1 be the common part of P 0 and P ( T 0 , u 1 , T R k ) . Let P 2 be the common part of P 0 and P ( T 0 , u 2 , T R k ) .
By Lemma 14, u 1 V ( T ) V ( P 0 ) and u 2 V ( T ) V ( P 0 ) . It might only be possible that u 1 V ( P 0 ) and u 2 V ( P 0 ) . Since there is no cycle in tree T, as well as in T R k , P 1 and P 2 are connected in the tree T R k by only the edges of P 0 . In addition, P ( T 0 , u 1 , T R k ) and P ( T 0 , u 2 , T R k ) are connected in the tree T R k by only the edges of P 0 . Suppose on the contrary that u u 1 and u u 2 occur simultaneously. Then, one endpoint of P 1 and P 2 , excluding u 1 and u 2 , would have degree three. This is a contradiction because P ( T 0 , u 1 , T R k ) and P ( T 0 , u 2 , T R k ) are both quasi-pendent paths in T R k .    □
Lemma 16.
Let R V ( G ) be a k -set in a tree T. If | ( T ) R | > k k > 0 , then there is a leaf u ( T R k ) ( T R k 1 ) such that E ( P ( T 0 , u , T R k ) ) E ( T R k 1 ) = .
Proof. 
Suppose on the contrary that for every leaf u ( T R k ) ( T R k 1 ) the quasi-pendent path P ( T 0 , u , T R k ) has common edges with T R k 1 . Then, by Lemma 13, for every leaf u ( T R k ) ( T R k 1 ) there exist u 1 ( T R k 1 ) and v V ( T 0 ) such that V ( P T ( v , u ) ) { v } V ( T 0 ) = and E ( P ( T 0 , u , T R k ) ) E ( P T ( v , u 1 ) ) . In addition, by Lemma 15, for a leaf u ( T R k 1 ) , two distinct leaves u 1 , u 2 ( T R k ) ( T R k 1 ) and a vertex v V ( T 0 ) do not exist, such that V ( P T ( v , u ) ) { v } V ( T 0 ) = , E ( P ( T 0 , u 1 , T R k ) ) E ( P T ( v , u ) ) and E ( P ( T 0 , u 2 , T R k ) ) E ( P T ( v , u ) ) are all true. This implies that the number of leaves in T R k 1 is no less than that in T R k . This contradicts Corollary 1.    □
Lemma 17.
Let R V ( G ) be a k -set in a tree T such that | ( T ) R | > k k > 0 . Let P ( T 0 , u , T R k ) be a quasi-pendent path of a leaf u ( T R k ) such that E ( T R k 1 ) E ( P ( T 0 , u , T R k ) ) = . Let S be the ( k 1 ) -set corresponding to T R k 1 , and T = S t e i ( S { u } ) . We have E ( P ( T 0 , u , T R k ) ) E ( P ( T 0 , u , T ) ) .
Proof. 
Let P ( T 0 , u , T R k ) = v 1 , , v | V ( P ( T 0 , u , T R k ) ) | 1 , u , where v 1 is the other endpoint such that u v 1 . If all edges in P ( T 0 , u , T R k ) were deleted from T R k , we would achieve a series of sub-trees which, respectively, contain v 1 , , v | V ( P ( T 0 , u , T R k ) ) | 1 and u. Let T i : 1 i | V ( P ( T 0 , u , T R k ) ) | 1 be the sub-tree containing the vertex v i . Please see Figure 4 for this configuration.
Because P ( T 0 , u , T R k ) has no common edge with T R k 1 , we have S ( V ( T ) V ( T 1 ) ) = . Otherwise, suppose on the contrary that there is a vertex w V ( T ) V ( T 1 ) such that w is also in S. By Lemma 8, we have R ( V ( T ) V ( T 1 ) ) = . So there is a vertex w R such that w w and there is a path between w and w in T R k 1 . Moreover, the path between w and w is unique in the T. So the path between w and w in T R k 1 must contain the edge ( v 1 , v 2 ) . This leads to a contradiction that P ( T 0 , u , T R k ) has a common edge with T R k 1 .
Thus, the minimum Steiner tree T on the set S { u } contains the entire path P ( T 0 , u , T R k ) , but does not contain any edge in E ( T ) ( E ( T 1 ) E ( P ( T 0 , u , T R k ) ) ) any more. Therefore, the quasi-pendent path P ( T 0 , u , T ) of u in T must contain the entire path P ( T 0 , u , T R k ) .    □
Let T 1 and T 2 , respectively, be two trees. The union of T 1 and T 2 is a new tree T such that V ( T ) = V ( T 1 ) V ( T 2 ) and E ( T ) = E ( T 1 ) E ( T 2 ) .
Theorem 2.
Let R V ( G ) be a k -set in a tree T. If | ( T ) R | > k k > 0 , then given a Steiner ( k , k ) -ecc R-tree T R k , there is a Steiner ( ( k 1 ) , k ) -ecc R-tree which is contained by T R k .
Proof. 
Suppose on the contrary that a Steiner ( k , k ) -ecc R-tree T R k does not contain any Steiner ( ( k 1 ) , k ) -ecc R-tree. Let T R k 1 be a Steiner ( ( k 1 ) , k ) -ecc R-tree. Then, by the assumption, T R k does not contain the entire tree T R k 1 .
By Lemma 16, there is a leaf u ( T R k ) V ( T R k 1 ) such that the quasi-pendent path P ( T 0 , u , T R k ) has no common edge with T R k 1 . Let u be the other endpoint (which is different from u) of the path P ( T 0 , u , T R k ) .
Let S 1 = S R k { u } , where S R k is the Steiner ( k , k ) -ecc R-set corresponding to T R k . The tree T 1 = T R k [ V ( T R k ) ( V ( P ( T 0 , u , T R k ) ) { u } ) ] is the minimum Steiner tree on the ( k 1 ) -set S 1 . Because if T 1 is not a minimum Steiner tree on S 1 , then the union of a smaller Steiner tree on S 1 (than T 1 ) and the path P ( T 0 , u , T R k ) could span all vertices in the set S R k , which contradicts the fact that T R k is a minimum Steiner tree.
By that assumption, T 1 is strictly smaller than T R k 1 . In other words, | E ( T 1 ) | < | E ( T R k 1 ) | . Moreover, according the construction, the union of T 1 and P ( T 0 , u , T R k ) is the entire tree T R k , i.e., | E ( T 1 ) | + | E ( P ( T 0 , u , T R k ) ) | = | E ( T R k ) | .
Now, let us turn to T R k 1 . Let S R k 1 be the Steiner ( ( k 1 ) , k ) -ecc R-set corresponding to T R k 1 . Let S 2 = S R k 1 { u } . In the following proof, we are going to show that the minimum Steiner tree on the set S 2 is strictly larger than T R k . This contradicts the fact that T R k is the maximum over all minimum Steiner trees on k-sets containing R.
Let T 2 be the minimum Steiner tree on the set S 2 . By Lemma 17, the path P ( T 0 , u , T R k ) is a sub-path of P ( T 0 , u , T 2 ) . So, we have | E ( T 2 ) | | E ( T R k 1 ) | + | E ( P ( T 0 , u , T R k ) ) | > | E ( T 1 ) | + | E ( P ( T 0 , u , T R k ) ) | = | E ( T R k ) | . Therefore, T 2 is strictly larger than T R k . This brings us to the contradiction.    □
Corollary 2.
Let R V ( G ) be a k -set in a tree T such that | ( T ) R | > k k > 0 . Let T R k 1 be a Steiner ( k 1 , k ) -ecc R-tree that is contained by a known Steiner ( k , k ) -ecc R-tree T R k . There is a T R k 1 -ecc path P such that the union of T R k 1 and P is the tree T R k . In addition, | E ( T R k ) | =   | E ( P ) | + | E ( T R k 1 ) | .
Proof. 
Let T be a T R k and T 1 be a T R k 1 such that T 1 is contained by T . Let S and S 1 be the Steiner ( k , k ) -ecc R-set and Steiner ( ( k 1 ) , k ) -ecc R-set, respectively, corresponding to T and T 1 .
Since | ( T ) R | > k k > 0 , by Lemma 6, S R has exactly one more vertex than S 1 R . Again, by Lemma 6, the extra vertex in the set S R compared to the set S 1 R is a leaf of T. So the extra vertex is one of those vertices in F a r ( T R k 1 , T ) . Thus, the union of T R k 1 and one of T R k 1 -ecc paths is T . And the summation of the sizes of them is equal to the size of T .    □
Theorem 3.
Let R V ( G ) be a k -set in a tree T. If | ( T ) R | > k k > 0 , then given a T R k 1 , there is a T R k such that T R k contains this T R k 1 .
Proof. 
Let T 1 be the given T R k 1 . Suppose on the contrary that there is no T R k such that T R k contains T 1 . Let T be a T R k . By Theorem 2, let T 2 be the T R k 1 which is contained by T .
According to the assumption, T 1 and T 2 are distinct. By Theorem 1, we have e c c ( T 1 , T ) = e c c ( T 2 , T ) . By Corollary 2, the union of T 2 and one of its T 2 -ecc paths is just the tree T . So we have | E ( T ) | = | E ( T 2 ) | + e c c T ( T 2 ) .
Let us turn to the tree T 1 . Let P be an T 1 -ecc path and w be the head of P, i.e., w F a r ( T 1 , T ) . By Lemma 11, w is a leaf of T. Let S 1 be the Steiner ( k , k ) -ecc R-set corresponding to T 1 . Then, S = S 1 { w } is a k-set. The size of S t e i ( S ) is:
| E ( S t e i ( S , G ) ) | = | E ( T 1 ) | + | E ( P ) | = | E ( T 1 ) | + e c c ( T 1 , T ) = | E ( T 1 ) | + e c c ( T 2 , T ) .
According to the assumption that T 1 is not contained by any T R k , then S t e i ( S ) is not a Steiner ( k , k ) -ecc R-tree. So, | E ( T ) | > | E ( S t e i ( S ) ) | . Then, we have | E ( T 2 ) | > | E ( T 1 ) | , which contradicts the fact that they are both Steiner ( ( k 1 ) , k ) -ecc R-trees. Therefore, the theorem holds.    □
Corollary 3.
Let R V ( G ) be a k -set in a tree T. If | ( T ) R | > k k > 0 , then given a Steiner ( ( k 1 ) , k ) -ecc R-tree T 1 , the union of T 1 and P is a Steiner ( k , k ) -ecc R-tree of R, where P is one of its T 1 -ecc paths. In addition, the Steiner ( k , k ) -eccentricity of R is | E ( T 1 ) | + | E ( P ) | .
Proof. 
By Theorem 3, let T be a T R k such that T contains T 1 . By Corollary 2, there is a T 1 -ecc path P such that the union of P and T 1 is T . And, the size of T is equal to | E ( P ) | + | E ( T 1 ) | .    □

4. The Algorithm

Let R be a given fixed k -set in a tree T. Let k be an integer such that k k . If | ( T ) R | k k , by Lemma 6, the whole tree T is the optimal solution corresponding to Steiner ( k , k ) -eccentricity of a given k -set. Now, we focus on the case that | ( T ) R | > k k .
According to Lemma 5, in order to compute the Steiner ( k , k ) -eccentricity of R in a tree T, firstly we find the minimum Steiner tree on the set R, and then search for the remaining portion of a Steiner ( k , k ) -ecc R-tree. This is the logical framework of our approach. This section presents an algorithm to realize this framework, in which the algorithm can not only find a minimum Steiner tree of a given set in O ( k n ) -time, but can also find the remaining portion of an optimal solution in O ( k n ) -time.
Given a vertex set S V ( T ) of a tree T, Algorithm 1 is to find S t e i ( S ) in the tree T. S t e i ( S ) is represented by black-colored vertices in the algorithm. Initially, the vertices in S are all colored black, while the vertices out of S are all colored white, since S must be in the tree S t e i ( S ) . The next task is to find Steiner vertices so as to connect all vertices of S with a minimum number of edges. The algorithm runs a breadth-first search (BFS) procedure [16] beginning with an arbitrary source vertex in S. Whenever the search discovers an unvisited vertex v in the course of scanning an already discovered vertex u, the vertex v is marked as “visited”. We say that u is the predecessor or parent of v. The parent of vertices is stored in an array p r e ( ) in Algorithm 1. By Lemma 4, whenever it meets a black vertex, all the vertices which are on the path from the source vertex to this newly discovered black vertex are colored black. Meanwhile, the parents of all these newly colored black vertex are marked as ⌀. This procedure is realized in Steps 15–17 in the Algorithm 1. At the end of the algorithm, every vertex in S t e i ( S ) is colored black, while those vertices out of S t e i ( S ) are all colored white.
Algorithm 1: Steiner-Tree(S, T)
Input: A tree T and a vertex set S V ( T )
Output: The minimum Steiner tree of S in T.
 1foreach  u V ( T )  do  c o l o r ( u ) ← white; p r e ( u ) ← ⌀; v i s i t ( u ) ;
 2foreach  u S  do  c o l o r ( u ) ← black;
 3s ← Pick a vertex from S; // The source for BFS
 4Q ←∅; // Initialize an empty queue  Q
 5ENQUEUE(Q, s);
 6while  Q  do
 7 u D E Q U E U E ( Q ) ;
 8 v i s i t ( u ) 1 ;
 9 foreach  w N e i g h b o r T ( u )  do
10 if  c o l o r ( w ) = = white and  v i s i t ( w ) =  then
11 p r e ( w ) u;
12 E N Q U E U E ( Q , w ) ;
13 else if  c o l o r ( w ) = = black and  v i s i t ( w ) =  then
14 xu;
15 while  x  do // By Lemma 4
16 c o l o r ( x ) ← black; y p r e ( x ) ; p r e ( x ) ; x y ;
17 end
18 p r e ( w ) ← ⌀;
19 E N Q U E U E ( Q , w ) ;
20 end
21end
22return The two arrays:  c o l o r ( ) and p r e ( ) .
Now let us turn to the approach of computing Steiner ( k , k ) -eccentricity. If k = k , then the Steiner ( k , k ) -eccentricity of a fixed k -set R is the size of S t e i ( R ) in a tree T. The optimal solution can be earned directly from Algorithm 1. If k > k , by Corollary 3, our idea to find a Steiner ( k , k ) -ecc R-tree basically needs the three following stages. Firstly, obtain a Steiner ( ( k 1 ) , k ) -ecc R-tree which is noted as T 1 . Next, choose the maximum distance between T 1 and every leaf in ( T ) . Finally, merge the shortest path which is between T 1 and the leaf into T 1 . If k 1 > k , then it is in the same way to earn T 1 . Otherwise, T 1 can be earned by Algorithm 1. The whole process for computing Steiner ( k , k ) -eccentricity of a given k -set in a tree is summarized in Algorithm 2. Its details are going to be stated in the following.
Given a vertex set R V ( T ) of a tree T, by Lemma 5, the set of vertices in S t e i ( R ) is naturally included in it. Algorithm 2 starts with the S t e i ( R ) in Step 1. The tree S t e i ( R ) is marked with black-colored vertices which are stored in the array c o l o r ( ) . Subsequently, the algorithm calculates the distance between S t e i ( R ) and each leaf of T in Step 2. Finally, the Algorithm 2 goes through k k rounds of iteration in a while-loop, in which at each iteration it merges a farthest leaf with its corresponding shortest path into a partial solution.
Algorithm 3 calculate the distance between each vertex and the (already-discovered) partial solution. Note that every vertex in the partial solution has been colored black. If a vertex is in the partial solution, then the distance is zero. So the d i s ( ) for each black vertex is zero. The algorithm is a BFS procedure beginning with a black vertex. Once a white vertex u occurs in the course of scanning an already discovered vertex v, then d i s ( u ) = d i s ( v ) + 1 . Recall that by Lemma 4 those vertices with a white vertex as an ancestor is white. Therefore, at the end of Algorithm 3, the array d i s ( ) stores the distances between each vertex and the black-colored partial solution.
Algorithm 2: Steiner-ECC(R, k, T)
Input: A tree T, a vertex set R V ( T ) and an integer k | R |
Output: Steiner ( k , k ) -eccentricity of R.
 1 c o l o r , p r e ← Steiner-Tree(R, T); // Algorithm 1
 2 d i s ← Get-dis(T, c o l o r , p r e ); // Algorithm 3
 3i ← 1;
 4while  i ( k | R | )  do // By Corollary 3
 5 v ← Find the maximum d i s ( ) among all leaves in ( T ) ;
 6 P ← ∅; // An initial empty set P representing a path
 7 P P { v } ;
 8 while  p r e ( v )  do P P { p r e ( v ) } ; v p r e ( v ) ;
 9 foreach  u P  do  c o l o r ( u ) ← black; d i s ( u ) 0 ; p r e ( u ) ;
10 Update(P, d i s , T); // Algorithm 4
11end
12return The size of the subtree induced by the set of black vertices.
Algorithm 3: Get-dis(T, c o l o r , p r e )
Input: A tree T, two arrays c o l o r ( ) and p r e ( )
Output: The distance between every vertex and a subtree which is colored black
1foreach  u V ( T )  do  v i s i t ( u ) ;
2s ← Pick a black vertex; // The source for BFS.
3 d i s ( s ) ← 0;
4Q ←∅; // Initialize an empty queue  Q
5 E N Q U E U E ( Q , s ) ;
6while  Q  do
7 u D E Q U E U E ( Q ) ;
8 v i s i t ( u ) 1 ;
9 foreach  w N e i g h b o r T ( u )  do
10 if  c o l o r ( w ) = = white and  v i s i t ( w ) =  then
11 d i s ( w ) d i s ( u ) + 1
12 E N Q U E U E ( Q , w ) ;
13 else if  c o l o r ( w ) = = black and  v i s i t ( w ) =  then
14 d i s ( w ) ← 0;
15 E N Q U E U E ( Q , w ) ;
16 end
17end
18return The array  d i s ( ) .
Once a leaf and its corresponding shortest path are merged into a partial solution, the array d i s ( ) should be updated because the distances between the remaining leaves and the newly constructed partial solution would become smaller. The updating procedure is listed in Algorithm 4. Recall that only the distances of those vertices with ancestors on this merged shortest path might be decreased. So, Step 10 only considers those sub-trees hanging at the merged path. Algorithm 4 assigns 0 to d i s ( ) for each vertex on the merged path, and runs a BFS procedure starting with each internal vertex of the merged path. Black vertices and those vertices on the merged path will not be traversed in this procedure.
Theorem 4.
There is an O ( k n ) -time algorithm to compute Steiner ( k , k ) -eccentricity of a given fixed k -set R V ( T ) in a tree T, where n is the order of T.
Proof. 
By Lemma 6, if | ( T ) R | k k , the whole tree T is an optimal solution corresponding to Steiner ( k , k ) -eccentricity of R. So it takes O ( n ) -time to earn Steiner ( k , k ) -eccentricity.
If | ( T ) R | > k k , then the Algorithm 2 can be adopted to compute Steiner ( k , k ) -eccentricity. Now we analyze the time complexity of Algorithm 2.
Steps 1 and 2 in Algorithm 2 are both BFS procedures on the whole tree T. So Steps 1 and 2 take O ( n ) time. Now let us consider the time consumed by the while-loop in Algorithm 2.
If k = k , the while-loop does not work anymore. It takes O ( n ) time for Algorithm 2. If k > k , in each round of the while-loop, a path is merged into a partial solution. Meanwhile, the array d i s ( ) is updated in Step 10. Once a path is merged into a partial solution, every vertex on the path is colored black (see Steps 8–9 in Algorithm 2). Once a leaf and its corresponding path are merged into a partial solution, in the worst case, the distances of the remaining vertices (which are neither in the partial solution nor in the newly merged path) should all be updated by Algorithm 4. In addition, in the worst case, each round of the while-loop only merges one vertex into a partial solution. So, the total number of times the elements in the d i s ( ) array needs to be modified is i = 1 k k ( O ( n ) i ) = O ( k n ) . Thus, the worst case of the whole while-loop takes O ( k n ) -time. Thus, it takes O ( k n ) time for Algorithm 2.
All in all, there is an O ( k n ) -time algorithm to solve the Steiner ( k , k ) -eccentricity of a k -set R V ( T ) in a tree T.    □
Algorithm 4: Update(P, d i s , T)
Input: A tree T, a path P and an array d i s ( )
1foreach  u V ( T )  do  v i s i t ( u ) ;
2foreach  v P  do
3 d i s ( v ) 0 ;
4 v i s i t ( v ) 1 ;
5 Q ← ∅; // Initialize an empty queue  Q
6 E N Q U E U E ( Q , v ) ;
7 while  Q  do
8 w D E Q U E U E ( Q ) ;
9 foreach  u N e i g h b o r T ( w )  do
10 if  u P  and  v i s i t ( u ) 1  then
11 d i s ( u ) d i s ( w ) + 1 ;
12 v i s i t ( u ) 1 ;
13 E N Q U E U E ( Q , u ) ;
14 end
15 end
16end

5. Conclusions and Discussions

This paper studied the computation of the Steiner ( k , k ) -eccentricity of a given fixed k -set on a tree. The structure of optimal solutions was studied, and an O ( k n ) -time algorithm was given. There are many directions for future work. On the one hand, as a special case of Steiner ( k , k ) eccentricity, Steiner k-eccentricity on the general graph still has no efficient algorithm. On the other hand, there is limited work of not only mathematical results, but also computational results on general graphs. In addition, the hardness for computing Steiner ( k , k ) -eccentricity on a given k -set in general graphs, even for k = 1 , is still unknown, although we believe that it is NP-hard.
The worst case of our algorithm is the case in Algorithm 2 where each round of the while-loop only merges a single vertex into a partial solution. In other words, the size of the search space is decreased only by one in the worst case in each round of the while-loop. For example, in a star, the worst case is that in which we are asked to find the Steiner ( k , 1 ) -eccentricity of the central vertex for k > 1 , where a star is a graph in which all the other vertices are adjacent to the central vertex. To improve upon the time-complexity of our algorithm seems to be another direction of future work.

Funding

This study was supported by Guizhou Provincial Basic Research Program (Natural Science) with grant number ZK[2022]020.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Conflicts of Interest

The author declares no conflicts of interest.

References

  1. Farahani, R.Z.; SteadieSeifi, M.; Asgari, N. Multiple criteria facility location problems: A survey. Appl. Math. Model. 2010, 34, 1689–1709. [Google Scholar] [CrossRef]
  2. Oellermann, O.R.; Swart, H.C. On the Steiner Periphery and Steiner Eccentricity of a Graph. In Topics in Combinatorics and Graph Theory: Essays in Honour of Gerhard Ringel; Physica-Verlag HD: Heidelberg, Germany, 1990; pp. 541–547. [Google Scholar]
  3. Durocher, S.; Kirkpatrick, D. The Steiner centre of a set of points: Stability, eccentricity, and applications to mobile facility location. Int. J. Comput. Geom. Appl. 2006, 16, 345–371. [Google Scholar] [CrossRef]
  4. Huilgol, M.I.; Shobha, P.H. Steiner k-Eccentric Connectivity: A Novel Steiner Distance-Based Index. Iran. J. Math. Chem. 2024, 15, 175–187. [Google Scholar]
  5. Kathiresan, K.M.; Arockiaraj, S.; Gurusamy, R.; Amutha, K. On the Steiner radial number of graphs. In Proceedings of the Combinatorial Algorithms: 23rd International Workshop, IWOCA 2012, Tamil Nadu, India, 19–21 July 2012; Revised Selected Papers 23. Springer: Berlin/Heidelberg, Germany, 2012; pp. 65–72. [Google Scholar]
  6. Li, S.; Liu, X.; Sun, W.; Yan, L. Extremal trees of a given degree sequence or segment sequence with respect to average Steiner 3-eccentricity. Appl. Math. Comput. 2023, 438, 127556. [Google Scholar] [CrossRef]
  7. Oellermann, O.R. From Steiner centers to Steiner medians. J. Graph Theory 1995, 20, 113–122. [Google Scholar] [CrossRef]
  8. Yu, G.; Li, X. Connective Steiner 3-eccentricity index and network similarity measure. Appl. Math. Comput. 2020, 386, 125446. [Google Scholar] [CrossRef]
  9. Yu, G.; Li, X.; He, D. Topological indices based on 2-or 3-eccentricity to predict anti-HIV activity. Appl. Math. Comput. 2022, 416, 126748. [Google Scholar] [CrossRef]
  10. Garey, M.R.; Johnson, D.S. Computers and Intractability: A Guide to the Theory of NP-Completeness; Freeman: San Francisco, CA, USA, 1979; Volume 174. [Google Scholar]
  11. Li, X.; Yu, G.; Klavžar, S.; Hu, J.; Li, B. The Steiner k-eccentricity on trees. Theor. Comput. Sci. 2021, 889, 182–188. [Google Scholar] [CrossRef]
  12. Li, X.; Yu, G.; Klavžar, S. On the average Steiner 3-eccentricity of trees. Discret. Appl. Math. 2021, 304, 181–195. [Google Scholar] [CrossRef]
  13. Li, X.; Yu, G.; Ilić, A.; Klavžar, S. On the computational complexity of the Steiner k-eccentricity. arXiv 2021, arXiv:2112.01140. [Google Scholar]
  14. Li, G.; Zeng, C.; Pan, X.; Li, L. The average Steiner (3, 2)-eccentricity of trees. Discret. Appl. Math. 2024, 355, 74–87. [Google Scholar] [CrossRef]
  15. Noureen, S.; Bhatti, A.A.; Ali, A. Towards the solution of an extremal problem concerning the Wiener polarity index of alkanes. Chaos Solitons Fractals 2021, 144, 110633. [Google Scholar] [CrossRef]
  16. Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms; MIT Press: Cambridge, MA, USA, 2022. [Google Scholar]
Figure 1. Paradigmatic examples of three quasi-pendent paths are elucidated for the purpose of facilitating comprehension of the definition. Let T 1 stand for this tree. The path P ( T 0 , u 1 , T 1 ) = v 1 , w 1 , w 2 , u 1 is a quasi-pendent path no matter whether v 1 is a branch or not, because v 1 V ( T 0 ) . The second quasi-pendent path is P ( T 0 , u 2 , T 1 ) = v 2 , u 2 . The third quasi-pendent path is P ( T 0 , u 3 , T 1 ) = v 3 , u 3 , since v 3 is a branch vertex of T 1 .
Figure 1. Paradigmatic examples of three quasi-pendent paths are elucidated for the purpose of facilitating comprehension of the definition. Let T 1 stand for this tree. The path P ( T 0 , u 1 , T 1 ) = v 1 , w 1 , w 2 , u 1 is a quasi-pendent path no matter whether v 1 is a branch or not, because v 1 V ( T 0 ) . The second quasi-pendent path is P ( T 0 , u 2 , T 1 ) = v 2 , u 2 . The third quasi-pendent path is P ( T 0 , u 3 , T 1 ) = v 3 , u 3 , since v 3 is a branch vertex of T 1 .
Axioms 14 00166 g001
Figure 2. The two configurations could not occur.
Figure 2. The two configurations could not occur.
Axioms 14 00166 g002
Figure 3. The configuration that P ( T 0 , u , T R k ) has common edges with T R k 1 .
Figure 3. The configuration that P ( T 0 , u , T R k ) has common edges with T R k 1 .
Axioms 14 00166 g003
Figure 4. The sub-trees corresponding to each vertices on the quasi-pendent path P ( T 0 , u , T R k ) .
Figure 4. The sub-trees corresponding to each vertices on the quasi-pendent path P ( T 0 , u , T R k ) .
Axioms 14 00166 g004
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Li, X. An O(kn)-Time Algorithm to Solve Steiner (k, k′)-Eccentricity on Trees. Axioms 2025, 14, 166. https://doi.org/10.3390/axioms14030166

AMA Style

Li X. An O(kn)-Time Algorithm to Solve Steiner (k, k′)-Eccentricity on Trees. Axioms. 2025; 14(3):166. https://doi.org/10.3390/axioms14030166

Chicago/Turabian Style

Li, Xingfu. 2025. "An O(kn)-Time Algorithm to Solve Steiner (k, k′)-Eccentricity on Trees" Axioms 14, no. 3: 166. https://doi.org/10.3390/axioms14030166

APA Style

Li, X. (2025). An O(kn)-Time Algorithm to Solve Steiner (k, k′)-Eccentricity on Trees. Axioms, 14(3), 166. https://doi.org/10.3390/axioms14030166

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop