Partition and Colored Distances in Graphs Induced to Subsets of Vertices and Some of Its Applications

: If G is a graph and P is a partition of V ( G ) , then the partition distance of G is the sum of the distances between all pairs of vertices that lie in the same part of P . A colored distance is the dual concept of the partition distance. These notions are motivated by a problem in the facility location network and applied to several well-known distance-based graph invariants. In this paper, we apply an extended cut method to induce the partition and color distances to some subsets of vertices which are not necessary a partition of V ( G ) . Then, we deﬁne a two-dimensional weighted graph and an operator to prove that the induced partition and colored distances of a graph can be obtained from the weighted Wiener index of a two-dimensional weighted quotient graph induced by the transitive closure of the Djokovi´c–Winkler relation as well as by any partition that is coarser. Finally, we utilize our main results to ﬁnd some upper bounds for the modiﬁed Wiener index and the number of orbits of partial cube graphs under the action of automorphism group of graphs.


Introduction
If G is a graph and P is a partition of V(G), then the colored distance of G is the sum of the distances between all pairs of vertices that lie in the different parts of P. This concept was defined by Dankelmann, Goddard, and Slater [1] and is based on a location problem [2]. Klavžar and Nadjafi-Arani further developed this metric and introduced the dual concept of a colored distance called partition distance [3]. Dankelmann et al. tackled a few applications of colored distance toward the facility location problem, median graphs, and the average distance of graphs (see [2,4]). Klavžar et al. [3] demonstrated that the dual concept has more practical value and addressed some applications in mathematical chemistry and network analysis [5,6] to obtain general bounds as well as to classify corresponding extremal graphs. Moreover, they expressed some basic graph invariants such as the diameter and the clique number by utilizing the partition distance. They also showed that some of these applications cannot be achieved when using the colored distance.
The usefulness of the cut method and the extended cut method in metric graph theory has been proved [7]. For instance, the method has been used to define distance-based graph invariants.
, is an equivalent number to W(G) (see [16][17][18][19]). The Djoković-Winkler relation Θ [8,10] is a reflexive and symmetric relation between edges of graphs such that two edges e = xy and f = uv of a connected graph G are under the relation Θ if d G (x, u) + d G (y, v) = d G (x, v) + d G (y, u). The transitive closure Θ * of Θ is an equivalence relation on E(G). The equivalence classes of Θ * are shown by F = {F 1 , . . . , F r }, which is called the Θ * -partition. Define the quotient graph G/F i as follows: For any i ∈ [r], let the connected components of the graph G-F i exist as vertices, and two vertices P and Q are adjacent iff there is at least an edge uv ∈ F i such that u ∈ P and v ∈ Q. Consider a vertex weighted graph (G, w); then, the Wiener index W(G, w) is defined as follows [20]: If w ≡ 1, then W(G, w) = W(G). An isometric subgraph H of a graph G is a subgraph of G such that the distance between any pair of vertices in H is the same as that in G. A partial cube [21] is an isometric subgraph of a hypercube. Winkler showed that a connected graph is a partial cube if and only if it is bipartite and the relation Θ is transitive-that is, Θ = Θ * [10].
If G is a graph and {V 1 , . . . , V t } is the partition of V(G) into the orbits under the action of Aut(G), then the modified Wiener index [14] of G is defined by The modified Wiener index can also be expressed by Let G be a graph of order n and let S = (n 1 , n 2 , . . . , n k ) with n 1 + n 2 + . . . + n k = n. An S-coloring P = {S 1 , S 2 , . . . , S k } is a partition of V(G) with |S i | = n i . The colored distance of W P (G) is the sum of the distances between vertices of different colors. The sum of distances between vertices with same colors, the partition distance of G, is W P (G) = W(S 1 ) + . . . + W(S k ). Note that W P (G) = W(G) − W P (G).
Henceforth, we collect those results that we will make use of from [3,22,23].

Lemma 1.
(i) Let P be a shortest path in G. Then, no two edges of P are in the relation Θ.
(ii) Let e = uv be an edge of a graph G, and let W be a u, v-walk in G that does not contain e. Then, there exists an edge f of W such that eΘ f .
(iii) Let F be a Θ * -class of a connected graph G and let u, v ∈ V(G). If P is a shortest u, v-path and Q is an arbitrary u, v-path, then |Q ∩ F| ≥ |P ∩ F|.
There are many research studies in which the authors applied weighted quotient graphs induced by the Θ * -relation method for computing several distance-based graph invariants. For more details, see the survey [11]. The method is called the cut method. The following theorems are recent results that we extend to subsets of vertices.

Theorem 1. [3] ([Theorem 2.2]) Let G be a connected graph and let
We say that a partition E = {E 1 , . . . , E t } of E(G) is coarser than F = {F 1 , . . . , F r } if each set E j is the union of one or more Θ * -classes of G. Theorem 1 then generalizes this as follows: Theorem 2. [3] ([Theorem 2.3]) Let (G, w) be a connected weighted graph and let P = {V 1 , . . . , V k } be a partition of V(G). If {E 1 , . . . , E r } is a partition of E(G) coarser than the Θ * -partition, then Cut methods that apply to classes larger than partial cubes or a partition coarser than Θ * -partition are called extended cut methods [11]. Now, we are ready to formulate our results.

Extended Cut Methods on Some Subsets of Vertices
In this section, we extend Theorems 1 and 2 regarding some subsets of vertices that are not necessary a partition of V(G). This modification enables us to induce the partition and colored distances in a graph regarding some arbitrary subsets of vertices. Then, we prove and state the induced partition and colored distances based on the extended cut method. Moreover, we reduce the computation of the distances between unordered pairs of vertices to a corresponding appropriately weighted quotient graph of G. The quotient graphs are weighted by a two-dimensional version with an operator.
The following theorem is an extension of Theorem 2. The idea of the proof is similar with the argument presented in [3] and we omit it. We point out that in the proof of Theorem 2, Klavžar et al. considered P = {V 1 , . . . , V k } to be a partition of V(G) and for any vertices x, y ∈ V(G), x = y, that belong to some V j , j ∈ [k], selected a shortest x, y-path. Then, they utilized a double counting technique to prove the theorem. To prove Theorem 3, it is not necessary to assume that P is a partition of V(G). In fact, if P = {V 1 , . . . , V k } is the set of some distinct subsets of V(G) (not necessarily the partition of V(G)), then we select a shortest path between each pair vertices of V j , j ∈ [k], and continue the proof using the same idea as used in the proof of Theorem 2. Moreover, we extend the definition of W P (G, w) accordingly. Theorem 3. Let (G, w) be a connected weighted graph and let P = {V 1 , . . . , V k } be a set containing k distinct subsets of V(G). If {E 1 , . . . , E r } is a partition of E(G) coarser than the Θ * -partition, then Several invariants of wide interest in basic graph theory, mathematical chemistry, and computer science can be expressed as instances of Theorem 3. For example, for computing the modified Wiener index, we need to obtain the summation of distances between unordered pair vertices of an orbit under the action Aut(G) [14]. Second, in the k-generalized Wiener index [24], we need to compute the summation of distances between vertices of the same degree k. In basic graph theory, k-diameter d k (G) of a graph G was introduced as max{W(S) : |S| = k}-that is, as the maximum overall partition distances of size k. Note that d 2 (G) = diam(G) and d |V(G)| (G) = W(G) [25]. One of the main problems in computer science is the network clustering. In a clustering problem, we select some nodes as a cluster node in the network and we need to cluster nodes to transfer their data together [26]. In this case, we need to find the distance between cluster nodes-that is, a partition distance of cluster nodes.
In [3,23] and also the survey [11], Klavžar and Nadjafi-Arani introduced the extended cut method. Generally, they used a partition of vertices and introduced the partition distance of graphs. Klavžar and Nadjafi-Arani obtained a formula based on the extended cut method for the partition distance of graph. However, they expressed colored distance using the Wiener index and partition distances of a graph as follows:

Corollary 1. [3] ([Corollary 2.6]) Let G be a connected graph and let
The weakness of this corollary is twofold. First, using the definition of corresponding quotient graph based on canonical metric representation, it is not possible to state W P by cuts with the same weight function. Second, it is not possible to determine the colored distance when we are working with some subsets of vertices that are not necessarily a partition of V(G). Hence, we need to obtain W P from Θ * -partition and extend our results when we consider some subsets of vertices. In this case, we need to redefine the weighted function w as a two-dimensional function w 2 with an operation "." where w 2 : V(G) → R 2 . Let v i ∈ V(G) and define w 2 (v i ) = (x i , y i ) with an operation "." such that w 2 (v i ).w 2 (v j ) = x i y j + x j y i . Similar to the weighted Wiener index (G, w), we introduce the distance between two vertices v i and v j of a weighted graph (G, Then, the colored distance of a weighted graph (G, w 2 ) can be calculated as follows: Theorem 4. Let G be a connected graph and let P = {V 1 , . . . , V k } be a set containing k distinct subsets of V(G) and Proof. Let A be a set of shortest paths such that there exist exactly one shortest path P(u, v) for each that is a matrix that shows the relationship between two classes of objects. If the first class is A and the second is F , the matrix has one row for each element of A and one column for each element of F . We assign |E(P i (u, v)) ∩ F j | for the corresponding entry in row P i (u, v) and column F j . In a special case, if G is a partial cube, then M is a 0,1 matrix in which m ij = 1 if and only if the path P i (u, v) contains exactly one edge of F j . We apply a double counting on summation of M arrays. Indeed, the summation of arrays of ith row corresponding to P i (u, v) is equal to d(u, v). So, due to the elements of the set A, the summation of M arrays shows W P . An array of jth column is greather than or equal than 1 if and only if there is a shortest path in A that goes through an edge of F j . Hence, initially, we compute the number of shortest paths in A that have an edge in F j . For calculating this number, let C j,1 , . . . , C j,i j be the connected components of G \ F j and Thus, the number of shortest paths in A passed through F j are equal to: Alternately, using the definition of the quotient graphs G/F j , the shortest path Then, R can be naturally lifted into an u, v-path in G which contains less that t edges from F j . Since this contradicts Lemma 1(iii), we conclude that Hence, the summation of the jth column of M is equal to: Summing over all columns, we get: which completes the proof.
If (G, w) is a connected weighted graph, then we can utilize The main idea of the above argument comes from [23] ([Theorem 3.3]) where the first author with S. Klavžar extended the cut method for a partition of E(G) coarser than the Θ * -partition. The main difference between these two theorems is how to choose the set of shortest paths. In [23], the set of selected shortest paths is Y in G such that for every pair of vertices u, v ∈ V(G), u = v, there exists a unique shortest u, v-path in the list, while in Theorem 4, the set A is a special set that enables us to calculate the summation of distances between all pair of vertices selected in A. In fact, coloring helps us to see the selected vertices more clearly.
Since the proof of the extended cut method proceeds similar to how the proof Theorem 4 proceeds, we omit the details and state the generalized version of above theorem as follows: Theorem 5. Let (G, w) be a connected weighted graph and let P = {V 1 , . . . , V k } be a set containing k distinct subsets of V(G) and . . , E r } is a partition of E(G) coarser than the Θ * -partition, then Theorems 3 and 5 are quite powerful. Using a sample computer application, we calculate the summation of distances between two subsets of vertices V 1 and V 2 in a hypercube graph G. Let V 1 and V 2 be the sets of white and black vertices, respectively. Clearly, we can ascertain that the parallel edges of G are the partition F of E(G). Let F = {F 1 , F 2 , F 3 , F 4 } in which E 1 = {F 1 } shows the vertical parallel edges and E 2 = {F 2 , F 3 , F 4 } are three horizontal paralleled pair edges of G (see Figure 1a). Let E = {E 1 , E 2 } be a coarser partition of F . The quotient graphs G/E 1 and G/E 2 with the weight ω 2 (v i ) for each vertex v i are shown in Figure 1b,c respectively. Now, apply Theorem 5 to obtain the summation of distances between each pair of vertices V 1 and V 2 .
Let V p , V q ⊂ V(G) be two distinct subsets of vertices and let d(V p , V q ) denote the summation of distances for each pair of vertices (u, v) in which u ∈ V p and v ∈ V q . The following corollary is a special case of Theorem 5 when we have just two subsets of vertices. Corollary 2. Let (G, w) be a connected weighted graph and let P = {V 1 , . . . , V k } be a set containing k distinct subsets of V(G). If {E 1 , . . . , E r } is a partition of E(G) coarser than the Θ * -partition, then Corollary 2 plays the main role in our results in the next section. Alternately, the distance summations between some subsets of V(G) can be calculated by taking a summation on Equation (5). For instance, from Theorem 5 and Corollary 2, it is easy to see that In the following, it is important to mention some special features of the Theorems 3 and 5. In fact, we can omit the distinct assumption for V i s. In this case, if a node v i has several colors (v i belongs to different elements of P), we need to define the color of v i due to our desires. For example, if we consider that the vertex v i belongs to two different subsets (v i has two colors, for instance, red and blue), and we need to find the distance between blue vertices such that the distance between v i and other blue vertices is a term of our desire, we consider the color of v i to be blue. Next, set all shortest paths between v i and blue vertices in A. Alternately, if we need to consider v i as a red vertex, we have to deposit the corresponding shortest paths in A.

Some Bounds on the Modified Wiener Index and the Number of Orbits
In this section, we apply Theorem 4 and Corollary 2 to partial cubes and trees to derive some upper bounds for modified Wiener index and the number of orbits of the automorphism group. Before that, the eccentricity of a vertex v is defined to be the greatest distance from v to any other vertex. The radius r of a graph is the minimum eccentricity of any vertex; in other words, r = min v∈V (v) = min v∈V max u∈V d(v, u). A vertex with minimal eccentricity is called the center of a graph. The trees have exactly one center (centered trees) or precisely two adjacent centers (bicentered trees). In bicenterd trees, the edge between two centers is called the edge center.

Lemma 2.
Let G be a graph of order n and {V 1 , · · · , V t } be the set of orbits of Aut(G). Then, Proof. Assume that u and v belong to an arbitrary orbit V i . Due to the orbit properties of an automorphism group, it is easy to see that ∑ w∈V i d(u, w) = ∑ w∈V i d(v, w). Therefore, Then, by substituting to (1), the result follows.

Lemma 3.
If T is a centered tree, then the center of T is an orbit of T with one element. Moreover, the elements of an arbitrary orbit are an independent set of T. When T is a bicentered tree, the same results hold with a difference that the edge center maybe be an orbit.
Proof. Initially, let T be a centered tree. Since the elements of each orbit are symmetric, the center of T is a unique vertex with special properties and it is an orbit with one element. Next, we show that the elements of an orbit are an independent set. Let e = uv be an edge of T such that u and v belong to the same orbit. Let c be the center of T and α ∈ Aut(T) such that Hence, there is a closed walk P : c, . . . , u, v, . . . , c in T of odd length. It means that T has a cycle that is a contradiction. Thus, the elements of an orbit form an independent set. If T is a bicentered tree based on the structure of T, maybe both of the centers form an orbit or separately each one becomes an orbit with one element. Let c 1 , c 2 be the centers of T and let both of them belong to different orbits. Then, with the same argument, we can prove that there is no edge between vertices of an orbit. When c 1 , c 2 belong to the same orbit, then there exist two cases. α(c 1 ) = c 1 , and α(c 1 ) = c 2 . The proof of the first case is the same as before. For the second one, we have d(c 1 , u) = d(c 2 , v). In this case, the walk P : c 1 , · · · , u, v, · · · , c 2 , c 1 is a closed walk in T that is a contradiction and the proof is complete.

Corollary 3.
Let T be a tree of order n and radius r with t orbits; then, r ≤ t ≤ n.
Proof. Since the distance between the center of T and the elements of an orbit is a fixed number, r ≤ t. Alternately, the number of orbits is maximum when Aut(T) = {e} that is, each node is an orbit or t = n. So, the proof is complete.
In the next theorem, we apply Corollary 2 to find an upper bound for the modified Wiener index in partial cube graphs based on the number of orbits of the automorphism graph. Theorem 6. Let G be a partial cube of order n and {F 1 , . . . , F k } is the Θ * -partition of E(G). Let {V 1 , . . . , V t } be the set of orbits of Aut(G) then and the bound is the best possible.
Proof. Let {F 1 , . . . , F k } be the Θ * -partition of E(G) and {v 1 , · · · , v t } demonstrates the set of orbit representatives of {V 1 , · · · , V t } respectively. Apply Corollary 2 for an orbit V j and consider V p = v j and V q = V j − {v j }. Since for each 1 ≤ i ≤ r the graph G − F i parted to two connected components C and C , so its quotient graph is a weighted edge e i = α i β i . Thus, w 2 i j (α i ) = (|V q ∩ C|, 0) and w 2 i j (β i ) = (|V q ∩ C |, 1). Therefore, It concludes that, This value is attained by the modified Wiener index of a path with three vertexes or each graph whose automorphism group is identity. Therefore our bound is best possible and the proof is complete.
We know that trees are a subset of partial cube graphs and each edge of a tree is an element of Θ * -partition. The following corollary is obtained from Theorem 6 directly.

Corollary 4.
Let T be a tree of order n and Aut(T) has t orbits. Then, Moreover, the equality holds if and only if Aut(T) ∼ = {e}, T = K 2 or T = P 3 .
Proof. Since, the trees are partial cubes and each edge of a tree is an element of Θ * -partition, we can obtain the upper bound from Theorem 6. For equality, it is enough to show that equality holds in (7) for each arbitrary i, j. Consider the same notation used in Theorem 6. Clearly, when Aut(T) ∼ = {e} each orbit is formed from a vertex and |V j | − 1 = 0. Next, let Aut(T) {e}, and there is e = α ∈ Aut(T) in which, for two distinct vertices u, v ∈ V j , we have α(u) = v. If u and v are not pendant vertices, then it is enough to consider the pendant edge e i as an element of Θ * -partition. Thus, w 2 i j (α i ).w 2 i j (β i ) = 0 < |V j | − 1. Let u, v be pendant vertices and r ≥ 2. In this case, consider the edge e i as a nonpendant edge. Similar to last argument, we can prove that the Equation (7) does not hold. If r = 1, then T ∼ = S n where S n shows a star graph with n vertex. One can easily see that if n ≥ 4, then there is an edge for which the Equation (7) is not satisfied and the result follows. and the equality holds if and only if T is the star graph S n or the path P n . 2. If T is a bicentered tree, then MW(G) ≤ n(r − 1)(n − 3r 2 ) + n 2 (n − r) and the equality holds if and only if T is the path P n .
Proof. Initially, let T be a centered tree with its center named c. Assume that s = {v 0 = c, · · · , v t } demonstrates the set of orbit representatives of S = {V 0 , · · · , V t }. V 0 denotes a one-element orbit that contains the center of T. Consider the vertices of a graph with level i ≥ 1 by L i = {V i 1 · · · , V i k } where it is the set of all orbits such that d(v i j , c) = i. Since T is a tree and by Lemma 3, there are no edge between vertices of L i . Define is a partition of E(G) coarser than the Θ * -partition. Let v i ∈ V i be the orbit representative and apply Corollary 2 with considering V p = v i and V q = V i − {v i } as two separate subsets of V(T).
Consider the quotient graph T/E i,j t that is a star graph (S T/E i,j t , w 2 ). If t > , since for all connected components C except one of them C ∩ V p = C ∩ V q = ∅, then for each pair of vertices C and C from ( With similar argument, we can prove that when 1 ≤ t ≤ and the shortest paths between V i and V t j (V i = V t j ) is passing from c, t , w 2 ) = 0. Next, let 1 ≤ t ≤ and the shortest paths between V i and V t j (t = ), never pass from c. In this case, the quotient graph T/E i,j t -that is, the star graph (S T/E i,j t , w 2 )-is weighted by (0, 0) in the center and for each pendant vertex; for instance C, the weight is equal to w 2 (C) = (∑ x∈C∩V p w(x), ∑ x∈C∩V q w(x)). Hence, Since, the center C, of the quotient graph (S T/E i,j t , w 2 ) has the weight (0, 0), for each vertex C , we haved(C, C ) = w 2 (C).w 2 (C )d(C, C ) = 0. On the other hand, if C and C are two pendant vertices of (S T/E i,j t , w 2 ), thend (C, C ) = w 2 (C).w 2 (C )d(C, C ) = 2w 2 (C).w 2 (C ) Clearly, V p has one element, hence the maximum value of (9) or, generally, the maximum value of Note in Equation (10) that if C i , C j = C v p then w 2 (C i ) = (0, ∑ x∈C i ∩V q w(x)) and w 2 (C j ) = (0, ∑ x∈C j ∩V q w(x)) and w 2 (C i ).w 2 (C j ) = 0. Therefore, It should be noted that, in the last equation, the value comes from this fact that for each 1 ≤ t ≤ , the value W(T/E i,j t , w 2 ) = 0. Finally, we obtain the main result by applying the Equation (11) in the modified Wiener index as follows: The proof is complete in this case. For equality, from Inequality (12), we obtain that |V i 1 | + · · · + |V i k i | = 2 for each 1 ≤ i ≤ r − 1, and k i = 1 for each 1 ≤ i ≤ r-that is, r = 1, or if r ≥ 2, then T is a path of odd order (T is a centered tree). Alternately, the Inequality (11) is equal in the path and star graph. It means that the equality is satisfied when T ∼ = S n or T ∼ = P n . Vice versa, when T ∼ = S n , then r = 1, and if T ∼ = P n (n is odd), then r = n−1 2 , so one can easily see that the equality holds. When T is a bicentered tree, then we have the edge center e = uv. We treat e as a vertex and define the Θ * -partition E similar to the previous case. That is somewhat a tree of radius r − 1. Now, we can realize the Θ * -partition as E ∪ {e}, and Equation (11) changes to The additional term comes from the edge center e where the quotient graph T − e is an edge. To complete the proof, we need to continue as before with some changes in the summation indices.
Indeed, our approach gives a new method for computing distance-based graph invariants such as the modified Wiener index, terminal Wiener index, and so on. There are many research studies in chemistry, biology, or information theory in which the authors obtained some equalities or bounds for distance-based graph invariants on molecule graphs or networks, such as dendrimer nanostars, fullerenes, or mesh networks [27][28][29][30][31]. Almost all of the mentioned researches have been applied to a traditional summation method between vertices, whereas in this paper, we prove a method based on a two-dimensional weight and an equivalence relation.

Concluding Remarks
Studying partitions and colored distances has been crucial in metric graph theory, as the usefulness of those problems when defining/analyzing quantitative graph measures has been proved. As we have mentioned repeatedly in the paper, its motivation stems from the facility location network problem [1,2]. Those concepts are usually defined on the whole vertex set of a graph. In this manuscript, we tackled the problem of inducing these definitions locally and consider subsets of vertices. For a special case, we demonstrated that the modified Wiener index is a concept that requires finding the distances between vertices of an orbit. Previous definitions for partitions and colored distances were not able to compute the modified Wiener index. In this way, we considered the canonical metric representation method and defined a two-dimensional weight for vertices of graphs with an operator. Then, we applied quotient graphs and cuts to calculate the induced partition and colored distances for some subsets of vertices. Two-dimensional weights for quotient graphs are extensions of traditional one-dimensional weights introduced for canonical metric representation. The problem of finding a minimum-cost spanning tree is one of the classic algorithmic questions in computer science and graph theory. In many cases, distances can be used to define cost functions. For instance, the problem of finding a minimum average distance (MAD) tree is one of the well-known problems in computer science (see the survey [32]). A MAD tree of a graph is defined as a spanning tree with minimum average distance or, equivalently, with the minimum Wiener index. In addition to the modified Wiener index, e.g., the MAD tree, the relative Wiener index, and the k-diameter of a graph G are a few concepts that would be interesting to consider in terms of certain induced partitions and colored distances. We will consider these problems in future works.