Graphs with a given diameter that maximise the Wiener index

Graphs with a given diameter that maximise the Wiener index

Applied Mathematics and Computation 356 (2019) 438–448 Contents lists available at ScienceDirect Applied Mathematics and Computation journal homepag...

563KB Sizes 0 Downloads 69 Views

Applied Mathematics and Computation 356 (2019) 438–448

Contents lists available at ScienceDirect

Applied Mathematics and Computation journal homepage: www.elsevier.com/locate/amc

Graphs with a given diameter that maximise the Wiener index Qiang Sun a,1, Barbara Ikica b,c,1,∗, Riste Škrekovski b,c,d, Vida Vukašinovic´ e a

School of Mathematical Science, Yangzhou University, Yangzhou, China Faculty of Mathematics and Physics, University of Ljubljana, Ljubljana, Slovenia c Institute of Mathematics, Physics and Mechanics, Ljubljana, Slovenia d Faculty of Information Studies, Novo mesto, Slovenia e Jožef Stefan Institute, Ljubljana, Slovenia b

a r t i c l e

i n f o

Keywords: Molecular structure descriptor Molecular graph Extremal graphs Wiener index

a b s t r a c t The Wiener index of a graph is one of the most recognised and very well-researched topological indices, i.e. graph theoretic invariants of molecular graphs. Nonetheless, some interesting questions remain largely unsolved despite being easy to state and comprehend. In this paper, we investigate a long-standing question raised by Plesník in 1984, namely, which graphs with a given diameter d attain the maximum value with respect to the Wiener index. Our approach to the problem is twofold – first we investigate the graphs with diameter smaller than or equal to 4, and then restrict our attention to graphs with diameter equal to n − c for c ≥ 1. Specifically, we provide a complete characterisation of sought-after graphs for 1 ≤ c ≤ 4 and solve the general case for c small enough in comparison to n. Along the way, we state some conjectures and propose an extension to our work. © 2019 Elsevier Inc. All rights reserved.

1. Introduction and preliminaries Given a simple undirected graph G with vertex set V(G) and edge set E(G), where |V (G )| = n and |E (G )| = m, let d (u, v ) denote the distance between vertices u and v, i.e. the length of the shortest path between u and v. The Wiener index of a graph G is defined as the sum of distances between all (unordered) pairs of vertices of G, that is,

W (G ) =



d (u, v ).

(1)

{u,v}⊆V (G )

This topological index was introduced in 1947 by Wiener [22], and was initially used for modelling boiling points of alkane molecules. It remains, to this day, one of the most popular and well-studied topological indices in mathematical chemistry. Not only has it found many applications since, e.g. as a valuable tool for preliminary screening of drug molecules [1], but has also received considerable attention in mathematics and other sciences. Just to mention a few recent mathematical developments, relations between the Wiener index and various graph invariants and operations on graphs have been studied [5,7,11], there has been a plethora of papers, concerning the identification of graphs that attain the maximum and ∗

1

Corresponding author at: Faculty of Mathematics and Physics, University of Ljubljana, Ljubljana, Slovenia. E-mail address: [email protected] (B. Ikica). These authors contributed equally to this work.

https://doi.org/10.1016/j.amc.2019.03.025 0 096-30 03/© 2019 Elsevier Inc. All rights reserved.

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

a

439

b

Fig. 1. Examples of graphs Tn and Tn . (a) The rooted tree T11 (k = 3). (b) The rooted tree T9 (k = 2).

Fig. 2. An example of the double broom graph D(n, a, b) with parameters n = 12, a = 2 and b = 3.

the minimum Wiener index within classes of graphs with certain properties [2,3,6,8–10,16–19,23,24], and it has led to the introduction of new topological indices used in chemistry. Note that many papers on the Wiener index deal both with maximising and minimising its value. For further relevant papers and a thorough review of the subject, we refer to surveys [13,23], and the references therein. In this paper, we focus on characterising graphs with a given diameter that maximise the Wiener index. The diameter of a graph is the maximum distance between all pairs of vertices, i.e. max{d (u, v ) | u, v ∈ V (G )}. Plesník [15] managed to identify graphs with a given diameter that minimise the Wiener index. However, he was unable to resolve the corresponding maximisation problem. Intriguingly, in full generality, this question remains a long-standing open problem and has not been solved to this day. There have been many attempts to overcome this problem [12,14,20,21], the most famous being the following conjecture proposed by DeLaViña and Waller [4]. Conjecture 1. Let G be a graph with diameter d > 2 and order 2d + 1. Then W (G ) ≤ W (C2d+1 ), where C2d+1 denotes the cycle of length 2d + 1. We tackle the problem using a different approach – we break down the analysis by separately considering small- and large-diameter graphs, and leave for future work the study of intermediate diameters. Before we describe our contribution in detail, we summarise the definitions, establish the notation and highlight some results relevant to our work. It is well known that the path Pn attains the maximum and the star graph Sn the minimum Wiener index amongst all trees on n vertices [13]. To be more precise,

 (n − 1 ) = W (Sn ) ≤ W (T ) ≤ W (Pn ) = 2



n+1 3

for all trees T on n vertices. Moreover, the Wiener index of a cycle on n vertices is given by

W (Cn ) =

n3 −n 8 n3 8

for n odd, for n even.

The ensuing notations and definitions, crucial for our work, follow [21] and [20]. First, we define the trees Tn and Tn √ for n > 1. Let k =  n − 1 . For k2 + k ≥ n − 1 we denote by Tn the rooted tree on n vertices in which the root has degree k, n − k2 − 1 of its neighbours are of degree k + 1 and the rest of them of degree k. When k2 + k ≤ n − 1 let Tn denote the rooted tree on n vertices in which the root has degree k + 1, n − k2 − k − 1 of its neighbours are of degree k + 1 and the rest of them of degree k. An illustrative example of this is provided in Fig. 1. The definitions of Tn and Tn above will prove useful in the section on small-diameter graphs. On the other hand, the following notion of a double broom graph will be referred to throughout the whole paper. The double broom D(n, a, b) (in [21], the term dumbbell is used) consists of a path on n − a − b vertices together with a independent leaves adjacent to one of its endvertices and b independent leaves adjacent to the other endvertex, see Fig. 2. As a remark, the diameter of the double broom D(n, a, b) equals d = n − a − b + 1. The rest of the paper is organised as follows. In Section 2, we restrict our attention to small-diameter graphs, Section 3 is devoted to the analysis of large-diameter graphs and Section 4 provides a conclusion and puts forward a potential extension of the present work.

440

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

a

b

Fig. 3. The conjectured graph and the tree that respectively attain the maximal Wiener index amongst all graphs and trees of order n and diameter 3, together with the corresponding values of their Wiener indices. (a) The graph K318 on n = 18 vertices with W (K318 ) = 363. (b) The double broom D(18, 8, 8) with W (D (18, 8, 8 )) = 353.

2. Small-diameter graphs In this section we consider graphs of order n with a diameter d of 4 or less. Initially, we tackle the first non-trivial case, namely d = 2. Proposition 2. Let G be a graph on n vertices with diameter equal to 2. Then W (G ) ≤ (n − 1 )2 with equality if and only if G∼ =Sn . Proof. Obviously,

W (G ) =



1+

d (u,v )=1



  2 = |E ( G )| + 2

d (u,v )=2

n 2

 − |E ( G )| = n ( n − 1 ) − |E ( G )|,

as the distance between any two vertices u, v ∈ V (G ) is either 1 or 2. Thus, in order to maximise the expression above, one needs to minimise the number of edges |E(G)|. Clearly, this results in the star graph Sn , which concludes the proof, as W (Sn ) = (n − 1 )2 holds.  To our knowledge, the problem of determining graphs that attain the largest Wiener index amongst all graphs of diameter 3 and the same problem for graphs of diameter 4 have not yet been solved. Nevertheless, in [21] and [20] both cases were solved for trees. In [21] the authors were able to pinpoint that the tree with diameter 3 that has the maximum Wiener index is the double broom graph D(n, (n − 2 )/2 , (n − 2 )/2 ). For graphs on n vertices with diameter 3, we propose the conjecture below. Let Kcn denote the graph of order n that consists of a complete graph on c vertices and has the rest of the vertices attached to these c vertices as uniformly as possible, i.e. each of the c vertices of the complete graph has either (n − c )/c

or (n − c )/c pendant vertices attached. Conjecture 3. Let G be a graph on n vertices with diameter equal to 3. Then W (G ) ≤ W (Kcn ) where c =



n2 2(n−1 )





n2 2(n−1 )



or c =

.

We refer the reader to Fig. 3a for a sketch of the graph Kcn . The conjecture was motivated by constructing graphs of diameter 3 with as many edges as possible whilst ensuring that there is a great deal of vertices at distance three. As we managed to determine the general structure of such graphs – being a complete graph Kc with the remainder of the vertices evenly distributed amongst its vertices (provided that n = kc for some k ∈ N) – we computed the corresponding Wiener index in terms of the number of pairs of vertices at distances 1, 2 and 3:

 

W(

Kcn

)=1

c 2





+ s c + 2 s c (c − 1 ) +

 

  

s c c + 3 s2 2 2

where s = (n − c )/c. Hereon, we were only left to determine the optimal c ∈ (0, n) using standard analytical methods. Notice, however, that our result relies on the assumption that n = kc for some k ∈ N. Potential difficulties may arise if this is not the case. E.g., the optimal value of the parameter c might vary or else the groups of pendant vertices attached to the vertices of Kc might not be all of the same size. In order to demonstrate the plausibility of this conjecture, we compare the largest Wiener index amongst all trees on n = 18 vertices with diameter equal to 3 (it is attained by the double broom graph) against the Wiener index of the corresponding Kcn graph, namely against K318 . It turns out that in fact W (K318 ) = 363 > 353 = W (D(18, 8, 8 )). Turning our attention to graphs on n vertices with diameter 4, the authors in [21] spotted a minor error in the following result from [20] concerning the structure of trees of diameter 4 that maximise the Wiener index. The revised version goes as follows [21].

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

441

Fig. 4. A sketch of a bag X attached to the paths PL and PM via edges vi a and v j b, respectively.

√ Theorem 4. Let T be a tree on n vertices with diameter 4 and let k =  n − 1 . Then the following holds: • if k2 + k > n − 1, then W(T) ≤ W(Tn ), with equality holding only when T∼ =T n ; • if k2 + k < n − 1, then W (T ) ≤ W (Tn ), with equality holding only when T ∼ = Tn ; • if k2 + k = n − 1, then W (T ) ≤ W (Tn ) = W (Tn ), with equality holding only when T∼ =Tn or T ∼ = Tn . We believe that the extremal graphs that are encountered in the theorem above are also extremal for the whole family of graphs on n vertices with diameter equal to 4. Conjecture 5. The trees Tn and Tn remain the unique optima amongst all graphs of diameter 4 on n vertices as it is described in Theorem 4 with the only exception of n = 9, in which case C9 is also an optimal graph. Note that in case n = 9 of the conjecture above our tests by computer showed that there are two extremal graphs, T9 and C9 , that both attain the same value of the Wiener index. Moreover, our tests confirmed that both Conjectures 3 and 5 hold for small graphs with up to 12 vertices. As Conjectures 1 and 3 suggest, cycle C7 and K47 were indeed identified as the graphs with the maximum Wiener index amongst all graphs on 7 vertices with a given diameter 3. We noticed an interesting pattern when the diameter is greater than 3. Then the graphs with the maximum Wiener index turned out to be the trees Tn or Tn with an only exception for n = 2d + 1, when the maximum Wiener index is attained by the cycle. 3. Large-diameter graphs In this section, we shift our focus to graphs on n vertices that exhibit a large diameter. We begin with the following result that covers all graphs on n vertices of some prescribed diameter n − c for c small enough. Theorem 6. Let G be a graph of order n and let n − c be its diameter, where c ≥ 1 is a constant and n is large enough relative to c. Then W (G ) ≤ W (D(n, (c + 1 )/2 , (c + 1 )/2 )) with equality if and only if G ∼ = D(n, (c + 1 )/2 , (c + 1 )/2 ). Before we proceed to the proof, let us shortly analyse the trivial cases c = 1 and c = 2. The only graph of order n with diameter n − 1 is the path Pn . Notice that Pn indeed coincides with the double broom graph D(n, 1, 1). It takes comparatively little effort to study the case c = 2. We just need to work out to which vertex of the path of length n − 1 that realises the diameter the only pendant vertex should be attached to. As it turns out, the unique graph on n vertices with diameter n − 2 that maximises the Wiener index is the double broom graph D(n, 1, 2). As far as the general case, c ≥ 3, is concerned, it will suffice to consider n such that

n≥

1 (7c3 − 18c2 + 23c − 6 ). 6

(2)

Hence, for the purpose of the proof, we assume that this inequality holds. Proof. Let G be a graph that satisfies the assumptions stated in the theorem. In addition, suppose that c ≥ 3. Since the cases c = 1 and c = 2 have already been accounted for above, they are omitted in the proof. Denote by P any of the paths of length n − c in G and label its vertices by v1 v2 . . . vn−c+1 with d (v1 , vn−c+1 ) = n − c. The graph G − P consists of the remaining c − 1 vertices of G and any of its connected components will be said to be a bag. Furthermore, let PL and PR denote the subpath on the first and the subpath on the last c vertices of the path P, respectively, and let PM denote the middle part of P, that is, PM = P − (PL ∪ PR ). Hence, PL = v1 v2 . . . vc , PM = vc+1 vc+2 . . . vn−2c+1 and PR = vn−2c+2 vn−2c+3 . . . vn−c+1 . See Fig. 4 for an illustration. Since inequality (2) holds, no bag in G is simultaneously connected to PL as well as to PR , as this would decrease the distance between v1 and vn−c+1 . The proof falls into the following major steps, carried out in four subsequent claims, through which we will transform G to a graph that attains the maximum Wiener index over all graphs of order n and diameter n − c. In each claim, we assume that G corresponds to the graph obtained at the end of the previous claim, and transform it in such a way that either preserves or increases the Wiener index. It will be shown that the structure of the resulting graph must coincide with that of the double broom graph D(n, (c + 1 )/2 , (c + 1 )/2 ). Claim 1. Let X be a bag of G that is attached to PL (resp. PR ) and PM , and mark the set of edges from PL (resp. PR ) to X as E. Then W (G − E ) ≥ W (G ).

442

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

Fig. 5. Increasing the Wiener index of G by appending the path Pa to the path Pb . Notice that here |A| ≥ |B|.

We only need to consider the case where there exists a bag that is connected to both PL and PM . Due to symmetry, there is no need to separately analyse the case with PR in place of PL . In accordance with these observations, let X be attached to PL and PM via edges vi a and v j b, respectively, that is, vi ∈ PL for some 1 ≤ i ≤ c, v j ∈ PM for some c + 1 ≤ j ≤ n − 2c + 1, and a, b ∈ X. We refer to Fig. 4 for an illustration. It is easy to see that the removal of vi a increases the Wiener index as the distances amongst a great deal of vertices increase. On the contrary, we might not be able to remove the edge v j b as its removal could lead to an increase in the diameter. Note that there may be more edges connecting X to PL and PM – however, the same principle applies to all of them. Thus, we may eliminate them one by one until the desired structure is reached, more specifically, until X is only connected to the vertices of PM . As we may repeat the same procedure for an arbitrary bag X in G\P, the claim follows. Claim 2. Let X be a bag of G attached to the path PM . Then the Wiener index attains its maximum when X is a path and, furthermore, when this path is connected to PM only via one edge incident to an endvertex of X. First, let us prove the second part of the claim. Take X to be a bag in G that is attached to PM via several edges. As mentioned before, removing an edge increases the Wiener index. Therefore we proceed by eliminating those edges one by one until there is only one left. All that is now left to see is that each such bag X indeed is a path, as claimed. In terms of the distances amongst vertices of X, it clearly pays off to replace X with a path on the same number of vertices. In fact, this also results in greater distances between the vertices in G\X and the vertices in the resulting path. To justify this, we transform X to a path in a step-by-step manner: we take one of the longest paths in X with an endvertex attached to PM and gradually extend it to an even longer path by appending the rest of the vertices of X to the current endvertex on the other side of this path, one after another. Each such transformation clearly increases the distances between the vertices in G\X and the vertex being relocated. Hence the whole process results in a larger Wiener index, as desired. This establishes the validity of Claim 2. In the following, let |P| denote the number of vertices lying on a path P. Furthermore, let VL denote the set of vertices lying either on the path PL or in a bag attached to PL and, analogously, let VR denote the set of vertices lying either on the path PR or in a bag attached to PR . Claim 3. Let P1 , P2 , . . . , Pk be paths attached to the path PM and denote by G the graph G − ∪ki=1 Pi with a path Q on vertices attached to either vc if |VL | ≤ |VR | or to vn−2c+2 otherwise. Then W(G ) ≥ W(G).

k

i=1

|Pi |

As a side remark, notice that the path Q in the statement of the claim is obtained by combining paths P1 , P2 , . . . , Pk into a single path. The proof of the first part – that replacing paths P1 , P2 , . . . , Pk with the path Q potentially increases the Wiener index – goes as follows. Take any pair of paths, say Pa and Pb , attached to the path PM at vertices vi and v j for some i, j ∈ {c + 1, c + 2, . . . , n − 2c + 1}. Without loss of generality, assume that i < j. Let us introduce the following notation. Denote ab , i.e. P ab = v v the subpath of PM that connects Pa and Pb by PM i i+1 · · · v j . Moreover, denote the set of vertices lying either M on the subpath v1 v2 . . . vi−1 or in a bag attached to this subpath by A, and the set of vertices lying either on the subpath v j+1 v j+2 . . . vn−c+1 or in a bag attached to this subpath by B. The paths Pa and Pb are said to be neighbouring if there is no ab . Refer to Fig. 5 for an example. other path attached to PM From this point on, suppose that the paths Pa and Pb are neighbouring. Consider two cases. If |A| ≥ |B|, append the path Pa to Pb , thus obtaining a single path. We refer again to Fig. 5 for an illustration. It takes little effort to see that this transformation increases the Wiener index. Indeed, let G denote the graph obtained in this manner. Then

   |Pb | + |PMab | − 1 |A||Pa | + |Pb | − |PMab | + 1 |B||Pa | >    > |PMab | − 1 |A| − |B| |Pa | ≥ 0.

W ( G ) − W ( G ) =



Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

443

If, on the contrary, |A| < |B|, append the path Pb to Pa . Using the same argument as above, one can deduce that this increases the Wiener index as well. Repeating this technique on each pair of adjacent paths attached to PM combines all of these into a single path. Thus, from now on, we can assume that there is only one path, say Q, attached to the path PM . We are now ready to tackle the second part of the claim, i.e. that moving Q to either vertex vc or to vertex vn−2c+2 increases the Wiener index. In a similar fashion as above, if |VL | ≥ |VR |, we append the path Q to the vertex vn−2c+2 , which results in a graph G with a larger Wiener index. Indeed,

W (G ) − W (G ) = (|VL | − |VR | )l ≥ 0 where l denotes the distance between the vertex vn−2c+2 and the attachment point of the path Q to the path PM in G . Notice that the sum of the distances between all pairs of vertices in PM ∪ Q is maximal regardless of whether we reattach Q to vc or to vn−2c+2 . Otherwise, if |VL | < |VR |, we append the path Q to the vertex vc , and the consequent increase in the Wiener index is justified by analogy with the former case. As a side note, it can be easily checked that this move preserves the overall diameter of the graph under discussion. Thus, this proves Claim 3. So far, we have seen that the Wiener index is maximal if each bag is attached to precisely one part of P, either PL or PR . As a matter of fact, we have shown throughout the previous claims that any number of bags attached to the path PM can be combined into a single path and shifted to either PL or PR . Claim 4. Assume that G consists of the path P and the remaining c − 1 vertices distributed amongst bags attached to PL and PR . Then W (D(n, (c + 1 )/2 , (c + 1 )/2 )) ≥ W (G ). Now let A denote the vertices from the bags attached to PL and analogously let B denote the vertices from the bags attached to PR . We will show that no matter what form the vertices of A and B take, the Wiener index attains its maximum value if and only if these vertices are leaves attached to v2 and vn−c , distributed as equally as possible between the two, as in the double broom graph. First of all we will estimate the minimal possible increase in the Wiener index of G that occurs as a consequence of transforming the bags attached to PL to |A| independent vertices attached to v2 . In what follows, the graph resulting from this operation shall be denoted by G . Notice that proceeding analogously on the subpath PR with the vertices of B and, consequently, balancing out the leaves of the thus obtained graph results in the anticipated double broom graph. If each vertex in A is adjacent to v2 , removing all other edges amongst vertices in A trivially results in both a greater Wiener index as well as in the desired structure, namely in the graph G . Otherwise, at least one of the vertices of A, say v, is adjacent to some vertex vi where 3 ≤ i ≤ c. When transforming G into G , v loses all of its connections to vi for 3 ≤ i ≤ c and retains (or even acquires) only an edge to v2 . Thus, each of the distances between v and the vertices in PM ∪ PR ∪ B increases by at least one. In total, these distances contribute at least n − 2c + 1 to W (G ) − W (G ), since

|PM ∪ PR ∪ B| ≥ |PM ∪ PR | = |P| − |PL | = (n − c + 1 ) − c = n − 2c + 1. Let us now estimate the largest possible decrease in the Wiener index that follows the transformation from G to G . Clearly, the largest drop in the distances between the vertices in A would occur if they formed a path – the drop would be even more significant if A consisted of all c − 1 vertices lying outside of P. Furthermore, the distances between the vertices in A and the vertices in PL would be reduced the most if such a path were attached to the vertex vc . All in all, we may conclude that

 

W ( G ) − W ( G ) ≥ ( n − 2c + 1 ) −

2c 3



+



c+1 3

 

+2

c . 2

(3)

Removing the potential path of length c attached to vertex vc amounts to the second and the third term in the expression above, and the subsequent attachment of these c − 1 vertices to the vertex v2 amounts to the last of its terms. Note, however, that the estimate (3) is overly pessimistic. The actual increase in the Wiener index is considerably larger. Since we are interested in maximising the Wiener index, we need to check when the inequality W (G ) − W (G ) ≥ 0 holds, which boils down to verifying

( n − 2c + 1 ) −

2c (2c − 1 )(2c − 2 ) ( c + 1 )c ( c − 1 ) + + c ( c − 1 ) ≥ 0. 3! 3!

An easy calculation shows that this holds if and only if

n≥

1 (7c3 − 18c2 + 23c − 6 ). 6

Hence, by the assumption of the theorem, W (G ) − W (G ) ≥ 0. As the problem is symmetric, the same principle holds for the path PR with the set of vertices B. Consequently, we obtain a path of length n − c − 2 and c + 1 vertices distributed amongst both of its endvertices. All that is left to do is to show that balancing these c + 1 vertices as symmetrically as possible, i.e. by appending (c + 1 )/2 vertices to one endvertex and (c + 1 )/2 to the other (or vice versa), even further increases the Wiener index.

444

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

Evidently, if there are more than (c + 1 )/2 vertices attached to one of the endvertices, moving one of them to the other endvertex results in an increase of the Wiener index by at least

( c + 1 )/2 ( n − c − 2 ) −  ( c + 1 )/2 ( n − c − 2 ) ≥ 0. Accordingly, this step-by-step manner establishes Claim 4 and leads to the conclusion that the graph that attains the greatest Wiener index (under our assumptions) is the balanced double broom graph D(n, (c + 1 )/2 , (c + 1 )/2 ). From the arguments above, it is clear that the balanced double broom is the unique graph that attains the maximum value of the Wiener index.  As mentioned in the proof above, the inequality (2) provided beneath the statement of the theorem is far from optimal. For instance, c = 3 and c = 4 yield the inequalities n ≥ 15 and n ≥ 41, respectively. For this reason, we will consider them separately. In these two cases, we will be able to draw more general conclusions on the orders of the graphs for which the statement holds in comparison to the ones that could be derived using inequality (2). 3.1. Diameter n − 3 We now shift our focus to graphs on n vertices with diameter n − 3. We have already shown that for n ≥ 15, the graph with the largest Wiener index is the double broom graph D(n, 2, 2). We can extend this result as follows. Theorem 7. Let G be a graph on n vertices with diameter equal to n − 3. Then the following holds: • • • • •

if if if if if

n ≥ 8, then W(G) ≤ W(D(n, 2, 2)) with equality if and only if G∼ =D(n, 2, 2); n = 7, then W (G ) ≤ W (D(7, 2, 2 )) = W (T7 ) with equality if and only if G∼ =D(7, 2, 2) or G ∼ = T7 ; ∼ n = 6, then W(G) ≤ W(D(6, 2, 2)) with equality if and only if G=D(6, 2, 2); n = 5, then W(G) ≤ W(S5 ) with equality if and only if G∼ =S5 ; n = 4, then W(G) ≤ W(K4 ) with equality if and only if G∼ =K 4 .

Proof. First of all, take G to be a graph on n ≥ 8 vertices with diameter n − 3 and let P = v1 v2 . . . vn−2 with d (v1 , vn−2 ) = n − 3 denote one of its paths of length n − 3. In a similar manner as in the proof of Theorem 6, we will transform G in such a way as to obtain the graph that maximises the Wiener index. There are precisely two vertices, say v and w, lying outside of P. We need to consider four cases – the case when both v and w are pendant vertices, the case when only one of them is pendant and the other one is attached to it, the case when they form a cycle of length 5 together with three adjacent vertices of P, i.e. vvi vi+1 vi+2 wv for some 1 ≤ i ≤ n − 4, and the case when they form a cycle of length 6 together with four adjacent vertices of P, i.e. vvi vi+1 vi+2 vi+3 wv for some 1 ≤ i ≤ n − 5. Observe that these are the only cases that need to be considered. Indeed, as soon as there is an edge between vertices v and w and an edge that connects this edge to P, adding additional edges in a different manner to these cases either affects the diameter or decreases the Wiener index. The proof is therefore reduced to finding the maximum value amongst W(G1 ), W(G2 ), W(G3 ) and W(G4 ), where Gi denotes the graph that attains the maximum value of the Wiener index in the ith case.  Case 1. Both v and w are pendant vertices, that is, there is no edge connecting the two. Without loss of generality we may assume that v is either located to the left of w or attached to the same vertex as w, i.e. v is attached to vi and w to v j , where 2 ≤ i ≤ j ≤ n − 3. Let lv denote the distance between the attachment point of vertex v on P, i.e. vi , and vertex v2 . Analogously, let lw denote the distance between the attachment point of vertex w on P, i.e. v j , and vertex vn−3 . Notice that attaching vertices v and w to v2 and vn−3 , respectively, results in the double broom graph D(n, 2, 2). In addition,

W (D(n, 2, 2 )) − W (G ) = lv (n − lv − 3 ) − lv + lw (n − lw − 3 ) − lw = = lv ( n − lv − 4 ) + lw ( n − lw − 4 ), which is greater than zero whenever condition 0 < lv < n − 4 or 0 < lw < n − 4 is satisfied. This clearly holds if and only if G is not the double broom graph. Indeed, the largest distance lv between vi , the attachment point of v, and v2 , is attained if v is attached to vn−3 and amounts to n − 5, satisfying the inequality 0 < lv < n − 4. Likewise, the largest distance lw between v j , the attachment point of w, and vn−3 that can occur is n − 5, which implies the second inequality, namely 0 < lw < n − 4. Thus, in the case under consideration, it pays off to reorganise the graph G so that it coincides with the double broom graph. Therefore, G1 = D(n, 2, 2 ). For future reference we shall also calculate the corresponding Wiener indices of the resulting graphs. Here, it amounts to



W (D(n, 2, 2 )) =



n−1 3

+ 2 (1 + 2 + · · · + n − 3 ) + (n − 3 ) + 4 =

1 3 13 n − n + 6. 6 6

Case 2. Only one of the two vertices in G\P is pendant – either v or w – and there is an edge between the two. Without loss of generality, assume that vertex w is pendant and adjacent to v, and that vertex v connects to vertex vi ∈ P for some 3 ≤ i ≤ n − 4. Notice that i cannot be equal neither to 2 nor to n − 3, as this would increase the diameter of G.

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

(a)

(b)

(7 2 2)

(d)

7

(c)

(e)

5

445

(6 2 2)

4

Fig. 6. An illustration of small graphs on n vertices with diameter n − 3 that maximise the Wiener index.

Furthermore, let l denote the distance between vi and v3 . Reattaching the pendant path formed by vertices v and w from vertex vi to vertex v3 boils down to

W ( G2 ) − W ( G ) = 2l ( n − 2 − ( l + 1 ) − 2 ) − 4l = 2l ( n − l − 7 ), where G2 denotes the graph that results from this modification. As a remark, we cannot reattach the pendant path vw any closer to the endvertex of P without altering the diameter. Similarly as in the previous case, the increment W (G2 ) − W (G ) is positive if and only if 0 < l < n − 7. This is always the case whenever GࣇG2 . Indeed, the maximum over distances l, i.e. l = n − 7, occurs when the pendant path vw is attached to vertex vn−4 – the corresponding graph is evidently isomorphic to G2 . A straightforward calculation shows that



W ( G2 ) =



n−1 3

+ 2(1 + 2 + · · · + n − 4 ) + (n − 3 ) + 12 =

1 3 25 n − n + 20. 6 6

Case 3. Neither of the two vertices in G\P is pendant, and they form a cycle of length 5 together with three adjacent vertices of P. We deal with this case in the same way as we dealt with the previous two cases. Suppose that vertices vi , vi+1 and vi+2 for some 1 ≤ i ≤ n − 4 form a cycle of length 5 together with the designated vertices v and w, and assume that v is adjacent to vi (and hence that w is adjacent to vi+2 ). Again, it is easy to see that replacing the edge vi v with the edge v1 v and replacing the edge vi+2 w with the edge v3 w results in the graph of this form that attains the largest Wiener index. More precisely,

W (G3 ) − W (G ) = 2(i − 1 )(n − i − 4 ), where G3 denotes the graph obtained via the above mentioned rewiring process. Whenever G contains the cycle of length 5 under consideration and GࣇG3 , inequality 1 < i < n − 4 holds. Hence indeed, W(G3 ) > W(G), as claimed. It takes comparatively little effort to see that



W ( G3 ) =



n−1 3

+ 2 (1 + 2 + · · · + n − 4 ) + (n − 3 ) + 7 =

1 3 25 n − n + 15. 6 6

Case 4. Neither of the two vertices in G\P is pendant, and they form a cycle of length 6 together with four adjacent vertices of P. Here, we omit a thorough explanation as this case follows the same pattern as the previous one. Namely, relocating the cycle as far to either of the endvertices as possible (without altering the diameter) leads to the largest possible gain in the Wiener index, that is,



W ( G4 ) =



n−1 3

+ 2(1 + 2 + · · · + n − 5 ) + (n − 4 ) + 13 =

1 3 37 n − n + 28, 6 6

where G4 designates the graph that results from this transformation. Now we need to find at which of the graphs G1 = D(n, 2, 2 ), G2 , G3 and G4 the largest value of the Wiener index is attained (amongst these four graphs). Simple algebraic manipulations show that for n ≥ 8, the unique maximum is attained by the double broom D(n, 2, 2). What is left to consider are small values of n. We analyse them separately. Suppose first that n = 7. Notice that we may proceed using similar arguments as we did with graphs on n ≥ 8 vertices. Evaluating W(Gi ) for 1 ≤ i ≤ 4, that is, W (G1 ) = 48, W (G2 ) = 48, W (G3 ) = 43 and W (G4 ) = 42, leads to conclusion that in this situation, G1 = D(7, 2, 2 ) as well as G2 attain the maximum Wiener index. Notice that the resulting graph G2 in fact corresponds to T7 (refer to the definition of Tn in the introduction; in particular, see Fig. 6b). Hence, W (D(7, 2, 2 )) = W (T7 ), as stated in the theorem. For n = 6, we make use of the same machinery as above. The only difference to the previous analysis is that solely graphs G1 = D(6, 2, 2 ), G3 and G4 need to be compared. Indeed, graph G2 is redundant as its diameter equals 4 > 6 − 3. It

446

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

(c) (a)

(9 2 2 2)

(d)

7

(b)

(e)

(7 2 3)

(8 2 2 2)

6

(f)

5

Fig. 7. An illustration of small graphs on n vertices with diameter n − 4 that maximise the Wiener index.

turns out that W(D(6, 2, 2)) > W(G4 ) > W(G3 ); hence, once again, the maximum is uniquely attained by the double broom D(6, 2, 2). In the case of n = 5, the analysis simplifies even further: there are only two candidate graphs, that is, the star graph S5 and the cycle C5 . Notice that these graphs correspond to the (degenerated) double broom D(5, 2, 2) (lacking the path in the middle) and to the (degenerated) G3 (lacking the path attached to the cycle), respectively. A direct calculation leads to W (S5 ) = 16 > 15 = W (C5 ), as claimed in the statement of the theorem. Finally, let n = 4. Since the only (connected) graph on n = 4 vertices with diameter equal to n − 3 = 1 is the complete graph K4 with W (K4 ) = 6, it (uniquely) attains the maximum Wiener index.  3.2. Diameter n − 4 Similarly as above, we can significantly increase the range of validity of Theorem 6 for graphs on n vertices with diameter n − 4. Indeed, for c = 4, this theorem provides a lower bound n ≥ 41, which ensures the maximality of the corresponding double broom graph (with respect to the Wiener index). As stated below, this result can be generalised to n ≥ 11. Furthermore, we also provide a list of extremal graphs for smaller values of n, namely for 5 ≤ n ≤ 10. Before we elaborate on these findings, we define some additional notation. Let D(n, a, b, c) denote a path on n − a − b · c vertices together with a independent leaves adjacent to one of its endvertices and b paths of length c adjacent to the other endvertex, refer to Fig. 7. Theorem 8. Let G be a graph on n vertices with diameter equal to n − 4. Then the following holds: • • • • • •

if if if if if if

n ≥ 10, then W(G) ≤ W(D(n, 2, 3)) with equality if and only if G∼ =D(n, 2, 3); n = 9, then W (G ) ≤ W (D(9, 2, 3 )) = W (D(9, 2, 2, 2 )) with equality if and only if G∼ =D(9, 2, 3) or G∼ =D(9, 2, 2, 2); n = 8, then W(G) ≤ W(D(8, 2, 2, 2)) with equality if and only if G∼ =D(8, 2, 2, 2); n = 7, then W (G ) ≤ W (D(7, 2, 3 )) = W (C7 ) with equality if and only if G∼ =D(7, 2, 3) or G∼ =C 7 ; n = 6, then W(G) ≤ W(S6 ) with equality if and only if G∼ =S6 ; n = 5, then W(G) ≤ W(K5 ) with equality if and only if G∼ =K 5 .

Proof. Again, we divide the proof in several cases corresponding to the order n of G. The case n = 5 is evident from the fact that the complete graph K5 is the only connected graph on 5 vertices with diameter equal to n − 4 = 1. The case n = 6 follows immediately from Proposition 2. Graphs that maximise the Wiener index in the cases 7 ≤ n ≤ 10 were determined with the help of a computer programme. Note, however, that they could have been dealt with by investigating all possible relations between a path of length n − 4 and the 3 leftover vertices located off of this path, in an approach similar to the one encountered in Theorem 7. In the sequel, we prove the validity of the theorem for n ≥ 11. The main reason behind constraining particularly to the case of n ≥ 11 is the ability to take advantage of the proof of Theorem 6. Indeed, let P denote a longest path in a graph G on n ≥ 11 vertices with diameter n − 4, so the length of P is n − 4 and there are three vertices lying outside of P, say u, v and w. For a while, we can now reproduce the first few steps of the aforementioned proof. The subpaths PL and PR (each of them on four vertices), and the (possibly empty) subpath PM in the middle of P are all well-defined when n ≥ 11. Again, we gradually trim the given graph G until we obtain a graph (with an unaltered diameter) that maximises the Wiener index. Notice that inequality (2) came in handy only in Claim 4 of the proof. Therefore we may follow the steps in Claims 1, 2 and 3, leading to a graph with all bags attached to either PL or PR and none of them to the middle part PM . Before proceeding, we adopt notation analogous to that in Theorem 6, i.e. we label the vertices of P by P = v1 v2 . . . vn−3 with d (v1 , vn−3 ) = n − 4. Hence, PL = v1 v2 v3 v4 and PR = vn−6 vn−5 vn−4 vn−3 .

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

447

Hereon the proof falls into two major cases depending on whether all bags (formed by vertices u, v, w outside P) are connected to the same subpath (either PL or PR ) or whether, alternatively, they are distributed both along PL and PR . Case 1. Vertices u, v, w form bags attached to both PL and PR . Notice that this case can only occur if one of the vertices, say w, is attached to either PL or PR and the other two vertices form (one or two) bags attached to the opposite subpath. By symmetry, assume that w is connected to PR and u, v constitute bags attached to PL . Evidently, if there are several edges connecting w to PR , we can eliminate all but one as this leads to a greater Wiener index and preserves the overall diameter (obviously, in this process, the edge to vn−3 has to be discarded, otherwise the diameter would increase). We now show that in this case, reattaching w to vn−4 results in an increase in the Wiener index. Let lw denote the distance between the attachment point of w on PR and vn−4 , thus 0 ≤ lw ≤ 2. Clearly, only the distances to w change – the distance to vn−3 decreases by lw , the distances on the subpath from w to vn−4 are collectively preserved, and the distances to other vertices increase by lw . Hence, the total increment in the Wiener index is

−lw + lw (n − 3 − lw ) = lw (n − 4 − lw ) ≥ 0. Next we proceed to modifying the subpath PL with bags formed by vertices u, v attached to it. We show that it pays off the most to reattach vertices u and v to v2 and discard any additional edges incident to either of them. Taking into consideration both this transformation and the transformation of the subpath PR outlined above, what we get is precisely the double broom graph D(n, 2, 3), as claimed. First, let us observe how this modification affects the Wiener index locally, that is, how it alters the Wiener index restricted to the subgraph on vertices PL ∪ {u, v}. Clearly, the largest drop in the index would occur if the subpath PL combined with vertices u and v formed a path of length five (with no extra edges), with either  u adjacent to v4 and v adjacent to u, or v adjacent to v4 and u adjacent to v. As the Wiener index of such a path equals 73 = 35 and the local Wiener index of the transformed graph equals

 i< j

d ( vi , v j ) +

4  i=1

d (u, vi ) +

4  i=1

 

d (v, vi ) + d (u, v ) =

5 3

+ 8 + 8 + 2 = 28,

the largest possible decrease in the local Wiener index amounts to 7. Thus, we need to prove that the contribution of the vertices lying outside of PL ∪ {u, v} to the overall Wiener index outweighs this local decrease. Indeed, if the graph that we are dealing with at the onset differs from D(n, 2, 3), then at least one of the vertices u and v either lacks an edge to v2 or possesses several edges besides the one to v2 (which can be safely discarded without loss of generality). If neither u nor w is attached to v2 , reattaching them would lead to an increase of at least 2(n − 6 ) ≥ 10, since n ≥ 11. In fact, in the worst case, both u and v would be relocated from v3 to v2 (only one step further), so each of the distances from the n − 6 vertices located outside of PL ∪ {u, v} to both u and w would increase by one, amounting to a total increase of 2(n − 6 ). Consequently, as the minimum possible increase of 10 exceeds the largest possible drop of 7, the graph with the maximum Wiener index in this case is the double broom graph D(n, 2, 3). Notice that the analysis of the case when only one of the vertices u and v needs to be reattached to v2 resembles relocating w to vn−4 on the subpath PR , which led to a greater Wiener index, and will thus be omitted. Case 2. Vertices u, v, w form bags attached only either to PL or PR . We will not dwell into this case in great detail, but rather present the main idea of the proof, as it is similar to those we have dealt with so far. Due to symmetry, we may assume that the bags containing u, v and w are attached to PL . Step 1. In the first step of the proof, we check whether there exists an edge connecting any of the bags to vertex v4 . Whenever possible (i.e. when the diameter stays unaltered), we discard such an edge and replace it with an edge to vertex v3 . Evidently, this leads to an increase in the Wiener index. However, if this step is infeasible, we proceed differently. Clearly, the only problematic case, in which an edge to v4 cannot be discarded, occurs when vertices u, v, w form a path of length three attached to v4 . Here, we take the vertex lying farthest from v4 on this path and reattach it to vn−4 , and deploy Step 1 on the resulting graph. A simple calculation shows that this procedure yields a larger Wiener index. Moreover, it leads us to the same situation that we faced in the previous case – there are two vertices attached to PL and one to PR – and can be dealt with accordingly. All in all, after performing Step 1, we either reduce the problem to Case 1 or obtain a graph with all bags connected to vertices v1 , v2 and v3 . Step 2. Similarly as above, we check whether there exists an edge connecting any of the bags to vertex v3 . Whenever possible, we remove it and replace it with an edge to the vertex v2 . Again, this increases the Wiener index. If we cannot make this transformation, we use a different technique. Note that in the present case the analysis is more intricate. There are two main cases which prevent us from deploying Step 2: either there is a path of length two attached to v3 , say v3 uv, and w attached to either v1 , v2 , v3 or u, or there is a path of length three, formed by vertices u, v and w, say v3 uvw. The latter case can occur only when there is at least one additional edge amongst the vertices on this path, thus ensuring that the diameter equals n − 4. Yet again, a somewhat tedious verification shows that in both cases reattaching w to vn−4 gives rise to an increased Wiener index. Overall, after Step 2 we are left with two options – either we managed to reduce the problem to Case 1 and thus proceed accordingly, or we managed to reattach all bags to v2 and continue with Step 3.

448

Q. Sun, B. Ikica and R. Škrekovski et al. / Applied Mathematics and Computation 356 (2019) 438–448

Step 3. In this step, we first ensure that each of the vertices u, v and w is adjacent only to v2 . Doing this does not change the diameter and might even further increase the Wiener index. Finally, we reattach either of the three vertices to vn−4 and hence end up with the double broom graph D(n, 2, 3). Once more, the proof that this increases the Wiener index, is reasonably straightforward and, as such, is left to the reader.  Acknowledgements We are grateful to Matjaž Konvalinka for helpful comments and suggestions. The research was supported by the ARRS Research Program P1-0383, the ARRS Research Program P2-0098, the Natural Science Foundation of Jiangsu Province (No. BK20170480) and the Natural Science Foundation of the Higher Education Institutions of Jiangsu Province (No. 17KJB110021). References [1] V.K. Agrawal, S. Bano, K.C. Mathur, P.V. Khadikar, Novel application of Wiener vis-à-vis Szeged indices: antitubercular activities of quinolones, Proc. Indian Acad. Sci. Chem. Sci. 112 (20 0 0) 137–146. [2] Q. Cai, T. Li, Y. Shi, H. Wang, Sum of weighted distances in trees, Discrete Appl. Math. 257 (2019) 67–84. [3] Y. Chen, B. Wu, X. An, Wiener index of graphs with radius two, in: ISRN Combinatorics, Article ID 906756, 2013, p. 5. [4] E. DeLaViña, B. Waller, Spanning trees with many leaves and average distances, Electron. J. Comb. 15 (R33) (2014) 16. [5] K.C. Das, I. Gutman, M.J. Nadjafi-Arani, Relations between distance-based and degree-based topological indices, Appl. Math. Comput. 270 (2015) 142–147. [6] K.C. Das, M.J. Nadjafi-Arani, On maximum wiener index of trees and graphs with given radius, J. Comb. Optim. (2016) 1–14. [7] A.A. Dobrynin, R. Entringer, I. Gutman, Wiener index of trees: Theory and applications, Acta Appl. Math. 66 (3) (2001) 211–249. [8] M. Fischermann, A. Hoffmann, D. Rautenbach, L. Székely, L. Volkmann, Wiener index versus maximum degree in trees, Discrete Appl. Math. 122 (2003) 127–137. [9] I. Gutman, R. Cruz, J. Rada, Wiener index of Eulerian graphs, Discrete Appl. Math. 162 (2014) 247–250. [10] Y.L. Jin, X.D. Zhang, On the two conjectures of the wiener index, Match Commun. Math. Comput. Chem. 70 (2013) 583–589. [11] M. Knor, R. Škrekovski, Wiener index of line graphs, in: M. Dehmer, E. F. Emmert-Streib (Eds.), Quantitative Graph Theory: Mathematical Foundations and Applications, CRC Press, 2014, pp. 279–301. [12] H. Liu, X.F. Pan, On the wiener index of trees with fixed diameter, MATCH Commun. Math. Comput. Chem. 60 (2008) 85–94. [13] M. Knor, R. Škrekovski, A. Tepeh, Mathematical aspects of wiener index, Ars Math. Contemp. 11 (2016) 327–352. [14] S. Mukwembi, T. Vertík, Wiener index of trees of given order and diameter at most 6, Bull. Aust. Math. Soc. 89 (2014) 379–396. [15] J. Plesník, On the sum of all distances in a graph or digraph, J. Graph Theory 8 (1984) 1–21. [16] A.V. Sills, H. Wang, On the maximal wiener index and related questions, Discrete Appl. Math. 160 (2012) 1615–1623. [17] D. Stevanovic´ , Maximizing wiener index of graphs with fixed maximum degree, MATCH Commun. Math. Comput. Chem. 60 (2008) 71–83. [18] S.W. Tan, The minimum wiener index of unicyclic graphs with a fixed diameter, J. Appl. Math. Comput. 56 (2018) 93–114. [19] X.D. Zhang, Y. Liu, M.X. Han, Maximum wiener index of trees with given degree sequence, MATCH Commun. Math. Comput. Chem. 64 (2010) 661–682. [20] S.G. Wagner, A class of trees and its wiener index, Acta Appl. Math 91 (2006) 119–132. [21] S. Wang, X. Guo, Trees with extremal wiener indices, MATCH Commun. Math. Comput. Chem. 60 (2008) 609–622. [22] H. Wiener, Structural determination of paraffin boiling points, J. Amer. Chem. Soc. 69 (1947) 17–20. [23] K. Xu, M. Liu, K.C. Das, I. Gutman, B. Furtula, A survey on graphs extremal with respect to distance-based topological indices, MATCH Commun. Math. Comput. Chem. 71 (2014) 461–508. [24] Z. You, B. Liu, Note on the minimal wiener index of connected graphs with n vertices and radius r, MATCH Commun. Math. Comput. Chem. 66 (2011) 343–344.