Wiener index in graphs with given minimum degree and maximum degree

Let $G$ be a connected graph of order $n$.The Wiener index $W(G)$ of $G$ is the sum of the distances between all unordered pairs of vertices of $G$. In this paper we show that the well-known upper bound $\big( \frac{n}{\delta+1}+2\big) {n \choose 2}$ on the Wiener index of a graph of order $n$ and minimum degree $\delta$ [M. Kouider, P. Winkler, Mean distance and minimum degree. J. Graph Theory 25 no. 1 (1997)] can be improved significantly if the graph contains also a vertex of large degree. Specifically, we give the asymptotically sharp bound $W(G) \leq {n-\Delta+\delta \choose 2} \frac{n+2\Delta}{\delta+1}+ 2n(n-1)$ on the Wiener index of a graph $G$ of order $n$, minimum degree $\delta$ and maximum degree $\Delta$. We prove a similar result for triangle-free graphs, and we determine a bound on the Wiener index of $C_4$-free graphs of given order, minimum and maximum degree and show that it is, in some sense, best possible.


Introduction
Let G be a connected graph. The Wiener index W (G) of G is defined as the sum of the distances between all unordered pairs of vertices of G, i.e., W (G) and µ(G) differ by a factor of n 2 if n is the order of G. For graphs of given order, these two invariants are thus essentially interchangeable. The Wiener index was originally introduced as a tool in chemistry, while the average distance is a useful tool for the analysis of networks in mathematics and computer science since it is an indicator for the expected distance between two randomly chosen points in a network.
The natural question which connected graph maximises the Wiener index among all connected graphs of given order was answered, for example, in a classical paper by Plesní k (1984). We find it convenient to state his result in terms of average distance.
Proposition 1 If G is a connected graph with n vertices, then with equality if and only if G is a path.
Much research has been devoted to improving the bound in Proposition 1. A natural approach is to consider not only the order of a graph, but also the degrees of the vertices. The degree deg G (v) of a vertex v in G is the number of vertices adjacent to v. The minimum degree δ(G) and maximum degree ∆(G) is the smallest and largest degree of the vertices in G, and a δ-regular graph is one in which all vertices have degree δ.
In response to a conjecture by the computer programme GRAFFITI Fajtlowicz and Waller (1987), which states that in a δ-regular graph of order n the average distance is bounded from above by n δ , Kouider and Winkler (1997) proved that for every connected graph G of order n and minimum degree δ, µ(G) ≤ n δ + 1 + 2, and this bound is sharp apart from an additive constant. Improved bounds for triangle-free and C 4free graphs were given in Dankelmann and Entringer (2000), and for graphs not containing a complete bipartite graph K 3,3 as a subgraph in Dankelmann et al. (2005). Beezer et al. (2001) slightly strengthened 1 by taking into account also the number of edges, and thus proved the above-mentioned conjecture. In Dankelmann (2006), the maximum average distance of a graph in terms of order, minimum degree and size was determined up to an additive constant. It is easily shown that the above-mentioned GRAFFITI conjecture µ ≤ n δ for δ-regular graphs cannot be generalised to graphs that are not necessarily regular by replacing δ by the arithmetic mean of the vertex degrees. However, the question whether replacing δ by the harmonic mean of the vertex degrees yields a valid inequality, i.e., the question if the inequality µ(G) ≤ v∈V (G) 1 deg(v) holds for every connected graph was answered in the negative by Erdös et al. (1988), who showed that this conjecture becomes a true inequality if the right hand side is multiplied by a term O( log n log log n ). Bounds on the Wiener index of trees in terms of vertex degree have also been considered extensively. Every tree has minimum degree 1, so it is natural to ask how large or small the Wiener index can be in trees of given maximum degree. Answering this question for the maximum value of the Wiener index is fairly straightforward (see Plesní k (1984) and Stevanović (2008)), however determining the minimum Wiener index requires more effort Fischermann et al. (2002). For the more general problem of determining the extremal values on the Wiener index of a tree with given degree sequence see, for example, Cela et al. (2011), Schmuck et al. (2012 and Wang (2008). Trees in which all vertices have odd degree were considered, for example, in Lin (2013) and Furtula (2013).
A bound on the Wiener index of the strong product of graphs with given minimum degree was derived in Casablanca and Dankelmann (2019). Sharp bounds on the Wiener index of maximal k-degenerate graphs, i.e., graphs that are edge-maximal with the property that every subgraph has a vertex of degree at most k, were given by Bickle and Che (2021). The Wiener index of Eulerian digraphs of given minimum degree was considered in Dankelmann (2019). For further questions and results on the Wiener index of digraphs we refer the reader to Knor et al. (2016a), Knor et al. (2016b) and the classical paper Plesní k (1984). We mention two further noteworthy recent papers Mukwembi (2014); Klavzar and Nadjafi-Arani (2014) on the Wiener index.
The graphs that demonstrate that 1 is sharp apart from an additive constant are either regular or close to regular, and this applies also to the corresponding bounds for triangle-free graphs in Dankelmann and Entringer (2000). This suggests that stronger bounds hold for graphs of given minimum degree that contain a vertex whose degree is significantly larger, for example if the maximum degree is cn, where c ∈ (0, 1) and n is the order of the graph. The aim of this paper is to show that this is indeed the case and to determine upper bounds on the Wiener index or average distance of graphs in terms of order, minimum degree and maximum degree that are sharp apart from an additive constant. We note that similar bounds for the average eccentricity were given in Dankelmann and Osaye (2020).
This paper is organised as follows. In Section 2 we define the most important terms and the notation used in this paper. Section 3 defines the weighted versions of the average distance and the Wiener index, and gives a result which will be crucial to the proofs of our main results. In Section 4 we determine, apart from an additive constant, the maximum Wiener index and average distance of a graph of given order, minimum degree and maximum degree. A corresponding result for triangle-free graphs is given in Section 5. We consider graphs not containing a 4-cycle as a subgraph in Section 6. In the concluding Section 7 we pose an open problem arising from our investigations.

Terminology and Notation
The notation we use is as follows. We denote the vertex set and edge set of a graph G by V (G) and E(G), respectively, and n(G) stands for the order of G, i.e., for the number of vertices of G. The neighbourhood of a vertex v, i.e., the set of all vertices adjacent to v, is denoted by N G (v) and its elements are the neighbours of v. The closed neighbourhood of v is the set If A ⊆ V (G), then we write G[A] for the subgraph of G induced by A, i.e., the subgraph of G whose vertex set is A and in which two vertices are adjacent if and only if they are adjacent in G. The line graph of a graph G is the graph L whose vertex set is E(G), with two vertices of L being adjacent in L if, as edges of G, they share a vertex. The k-th power of G, denoted by G k , is the graph with the same vertex set as G in which two vertices are adjacent if their distance is not more than k.
A k-packing of G is a set A of vertices in which the distance between any two vertices of A is greater than k. A 2-packing is often referred to as a packing. A matching of G is a set of edges in which no two edges share a vertex. The vertex set V (M ) of a matching M is the set of vertices incident with an edge in M . The distance d G (e 1 , e 2 ) between two edges e 1 and e 2 is the smallest of the distances between a vertex incident with e 1 and a vertex incident with e 2 . (Note that in general this is not equal to the distance in the line graph of G.) If M is a set of edges, then the distance d(e, M ) between an edge e and M is the smallest of the distances between e and the edges in M .
A star is a tree that has one vertex which is adjacent to all other vertices. A double-star is a tree that has two vertices such that each of the other vertices is adjacent to exactly one of them. By a triangle we mean the complete graph on three vertices, and a graph is triangle-free if it does not contain a triangle as a subgraph. The cycle on 4-vertices is denoted by C 4 , and we say a graph is C 4 -free if it does not contain C 4 as a subgraph. We note that some authors use the term C 4 -free to mean that C 4 is not an induced subgraph, while we exclude C 4 as a subgraph, irrespective whether it is induced or not.

Weighted Wiener index and average distance
In this section we recall the definitions of weighted versions of the Wiener index and the average distance, as well as a bound on the weighted average distance which is used in the proofs of our main theorems. Both were given in Dankelmann and Entringer (2000); Klavzar and Gutman (1997).
We note that the constant weight function c with c(v) = 1 for all v ∈ V (G) yields the usual Wiener index and average distance.
Lemma 1 Let G be a connected graph with weight function c : V (G) → R ≥0 and let k, N be two positive integers, N a multiple of k, such that c Equality holds if and only if G is a path and c(v) = k for every v ∈ V .

A bound involving the maximum degree
In this section we prove our first main result, an upper bound on the Wiener index of graphs of given order, minimum degree and maximum degree. We state our result in terms of the average distance and not the Wiener index as this is more convenient for the proof.
Theorem 1 Let G be a connected graph of order n, minimum degree δ ≥ 3 and maximum degree ∆.
where N = n − ∆ + δ, and this bound is sharp apart from an additive constant.
Proof: We first find a packing A of G as follows. Choose a vertex v 1 of degree ∆ in G and let A = {v 1 }.
If there exists a vertex v 2 of G at distance exactly 3 from A, then add v 2 to A and let A = {v 1 , v 2 }.
If there exists a vertex v 3 at distance exactly 3 from A = {v 1 , v 2 }, then add also v 3 to A. Repeat this step, i.e., successively add vertices at distance 3 from A until, after k steps say, each vertex of G is within distance 2 of A.
. . , e k } is a subtree of G. By the maximality of A every vertex of G not in T 2 is adjacent to some vertex of T 2 . Hence we can extend T 2 to a spanning tree of G by adding each vertex in V (G) − V (T 2 ) to T 2 and joining it to some vertex of T 2 with an edge of G. Denote the resulting spanning tree of G by T .
Since the average distance of any spanning tree of G is not less than the average distance of G, it suffices to show that The tree T can be thought of as a weighted tree, where each vertex has weight exactly 1. Informally speaking, we now move the weight of every vertex to the closest vertex in A. More precisely, for every vertex u ∈ V (T ) let u A be a vertex in A closest to u and define a weight function c : This yields n = v∈A c(v) ≥ ∆ + 1 + (k − 1)(δ + 1), and so In our proof we consider µ c (T ) rather than µ(T ). Informally, the difference between these two values is not more than 4 since no weight was moved over a distance of more than 2, so no distance between two weights has changed by more than 4. More formally, We note that only the vertices in A have a nonzero weight. By the construction of T , each vertex v i ∈ A, i ≥ 2, is at distance exactly three in T from some vertex v j ∈ A with j < i. This implies that in the graph T 3 [A] there is a path from every vertex to v 1 , and so We modify the weight function c to obtain a new weight function Expressing W c (H) as n 2 µ c (H) and rearranging yields We bound the two terms of the right hand side of 6 separately. Renaming the vertices of A − {v 1 } as Now c(u i ) ≥ δ + 1 for i = 1, 2, . . . , k − 2 and Subject to these conditions the right hand side of 7 is maximised if c(u 1 ) = c(u 2 ) = . . . = c(u k−2 ) = δ + 1 and c(u k−1 ) = n − ∆ − 1 − (k − 2)(δ + 1). Substituting these values yields, after simplification, Since k ≤ n−∆+δ δ+1 by 3, and since the right hand side is increasing in k for k ≤ n−∆+δ δ+1 , we obtain by substituting this value and combining 7 and 8 that To bound µ c ′ (H) we recall that c ′ (v) ≥ δ + 1 for all vertices v of H and that v∈A c ′ (v) = n − ∆ + δ.
Let C be the least multiple of δ + 1 with C ≥ N . By Lemma 1 we have Substituting 9 and 10 into 6 yields Combining the inequalities 4, 5 and 11 we obtain that which is 2, and so the bound in the theorem follows.
To show that the above bound is sharp apart from an additive constant we consider the following graph for given n, ∆, δ ∈ N for which ∆ ≥ δ and n ≥ ∆ + δ + 1. In order to keep our calculations simple we assume that n − ∆ is a multiple of δ + 1, but we note that a similar construction, with slightly more . Let G 1 be a copy of the complete graph K ∆ , let G 2 , G 3 , . . . , G ℓ be disjoint copies of K δ+1 . For i = 1, 2, . . . , ℓ let u i and v i be two vertices of G i . Define G n,∆,δ to be the graph obtained from ℓ i=1 G i by deleting the edge u i v i for i = 2, 3, . . . , ℓ − 1 and adding the edge v i u i+1 for i = 1, 2, . . . , ℓ − 1. The graph G 28,8,3 is shown in Figure 1.
It is easy to verify that G n,∆,δ is a connected graph of order n, maximum degree ∆ and minimum degree δ.

A bound for triangle-free graphs
In this section we show that the bound in Theorem 1 can be improved by a factor of about 2 3 for graphs not containing a triangle.
Theorem 2 Let G be a connected, triangle-free graph of order n, minimum degree δ ≥ 3 and maximum degree ∆. Then where N = n − ∆ + δ, and this bound is sharp apart from an additive constant.
Proof: We first find a matching M of G as follows. Choose an edge e 1 of G that is incident with a vertex of degree ∆ and let M = {e 1 }. If there exists an edge e 2 of G at distance exactly 3 from M , then add e 2 to M , i.e., let M = {e 1 , e 2 }. If there exists an edge e 3 at distance 3 from M then add also e 3 to M . Repeat this step, i.e., successively add edges at distance 3 from M until, after k steps say, each edge of G is within distance 2 of M . Let M = {e 1 , e 2 , . . . , e k }. For i = 1, 2, . . . , k let e i = u i v i . Let T (e i ) be the double-star with vertex set N G (u i ) ∪ N G (v i ) that contains e i and all edges of G incident with u i or v i . By the construction of M , the trees T (e i ), i = 1, 2, . . . , k, are disjoint. The union k i=1 T (e i ) forms a subforest T 1 of G. It follows from the construction of M that for every i ∈ {2, 3, . . . , k} there exists an edge f i in G joining a vertex in T (e i ) to a vertex in T (e j ) for some j with 1 ≤ j < i. Then T 2 := T 1 + {f 2 , f 3 , . . . , f k } is a subtree of G. By the maximality of M , every edge of G is within distance 2 from some edge of M , and so every vertex of G is within distance 3 from some vertex of V (M ). We extend T 2 to a spanning tree T of G that preserves the distances to a nearest vertex in V (M ).
Since the average distance of a spanning tree of G is not less than the average distance of G, it suffices to show that For every vertex u ∈ V (T ) let u M be a vertex in V (M ) closest to u in T . As in Theorem 1 we define a function c : As in Theorem 1, the weight of c is concentrated in the vertices in V (M ). Since no weight has been moved over a distance of more than 3, a proof similar to the proof of 4 yields that We now consider the line graph L of T and define a new weight function c on the vertices of L, i.e., the edges of T , by The weight of c is concentrated entirely in M , and e∈E(T ) c(e) = n. Consider e i = u i v i ∈ M . Since G is triangle-free, u i and v i have no common neighbours and so the vertices in Since e 1 is incident with a vertex of degree ∆, while all the other vertices in V (M ) have degree at least δ, we conclude that Clearly e∈E(T ) c(e) = n, and so we have We now bound the difference between µ c (T ) and µ c (L). If u and v are vertices of T , and e u and e v are edges of T incident with u and v, respectively, then it is easy to see that d T (u, v) ≤ d L (e u , e v )+ 1. Hence no distance between two weights decreases by more than 1 if we consider L and c instead of T and c. Therefore, µ c (T ) ≤ µ c (L) + 1.
We now modify the weight function c to obtain a new weight function c ′ which satisfies c ′ (e) ≥ 2δ for all e ∈ M . We let It follows from 14 that c ′ (e) ≥ 2δ for all e ∈ M . Letting N = e∈M c ′ (e), we have N = n − ∆ + δ. We now express µ c (H) in terms of µ c ′ (H). Arguments similar to those in the proof of 6 in the proof of Theorem 1 show that We bound the two terms of the right hand side of 18 separately. Arguments similar to the ones in the proof of 8 show that Since k ≤ n−∆+δ 2δ by 15, and since the right hand side is increasing in k for k ≤ n−∆+δ 2δ , we obtain by substituting this value that , and so we obtain To bound µ c ′ (H) we recall that c ′ (e) ≥ 2δ for all e ∈ V (H) = M and thus for every vertex e of H, and that e∈M c ′ (e) = N . Let C be the least multiple of 2δ with C ≥ N . By Lemma 1 we have Since C ≤ N + 2δ − 1, this yields Substituting 20 and 21 into 18 yields Combining the inequalities 13, 16, 17 and 22 we obtain that which is 12, and so the bound in the theorem follows.
To see that the bound is sharp apart from an additive constant let n, ∆, δ ∈ N be given with ∆ ≥ δ and n ≥ ∆ + 3δ. In order to keep our construction and calculations simple, we assume that n − ∆ − δ is a multiple of 2δ, but as in Theorem 1 this assumption is not essential. Let ℓ = n−∆+δ 2δ . Let G 1 be the complete bipartite graph K δ,∆ , and for i = 2, 3, . . . , ℓ let G i be a copy of the complete bipartite graph K δ,δ . For i = 1, 2, . . . , ℓ choose two adjacent vertices u i and v i of G i , where deg G1 (u 1 ) = ∆. Let G n,∆,δ be the graph obtained from ℓ i=1 G i by deleting the edges u i v i for i = 2, 3, . . . , ℓ − 1 and adding the edges v i u i+1 for i = 1, 2, . . . , ℓ − 1. Clearly, G n,∆,δ is a triangle-free graph of order n, minimum degree δ and maximum degree ∆. A calculation similar to the one in Theorem 1 shows that, with N = n−∆+δ,

✷
Define µ ′ (n, ∆, δ) and W ′ (n, ∆, δ) to be the maximum average distance and maximum Wiener index, respectively, among all connected, triangle-free graphs of order n, minimum degree δ and maximum degree ∆. Theorem 2 shows that 6 Bounds for C 4 -free graphs In this section we show that the bound in Theorem 1 can be improved significantly for graphs not containing a 4-cycle. If δ + 1 is a prime power, then our bound is best possible in a sense specified later. For the statement and proof of our bound for C 4 -free graphs, we let δ ∈ N be fixed, and for given d ∈ {δ, ∆} we define We need the following lemma, whose special case d = δ can be found, for example, in Erdös et al. (1989).
Lemma 2 Let G be a C 4 -free graph of minimum degree δ. If v is a vertex of G of degree at least d, then Proof: Let w 1 , w 2 , . . . , w d be the neighbours of v. Then each w i is adjacent to v and at most one other vertex in N (v). Hence each w i has a set U i of at least δ − 2 neighbours in N 2 (v), and the sets U i , If d is even, then the lemma follows. If d is odd, the inequality is strict since otherwise, if |N ≤2 (v)| = d(δ − 1) + 1, each of the d neighbours of v is adjacent to exactly one other neighbour of v, a contradiction to the handshake lemma. ✷ Theorem 3 Let G be a connected graph of order n, minimum degree δ ≥ 3 and maximum degree ∆. If G does not contain C 4 as a subgraph, then where N = n − ε ∆ + ε δ , and ε ∆ , ε δ as defined in equation 23.
Proof: The proof is along similar lines as the proof of Theorem 1, hence we do not give all the details. We first find a 4-packing A of G as follows. Choose a vertex v 1 of degree ∆ in G and let A = {v 1 }. If there exists a vertex v 2 of G at distance exactly 5 from A, then add v 2 to A. If there exists a vertex v 3 at distance exactly 5 from A, then add also v 3 to A. Repeat this step, i.e., successively add vertices at distance exactly 5 from A until, after k steps say, each vertex of G is within distance 4 of A. Then By the construction of A the sets N ≤2 (v i ), i = 1, 2, . . . , k, are pairwise disjoint. For i = 1, 2, . . . , k let T (v i ) be a tree with vertex set N ≤2 (v i ) that preserves the distances from v i . The disjoint union k i=1 T (v i ) forms a subforest T 1 of G. It follows from the construction of A that for every i ∈ {2, 3, . . . , k} there exists an edge e i in G joining a vertex in T (v i ) to a vertex in T (v j ) for some j with 1 ≤ j < i. Hence T 2 := T 1 + {e 2 , e 3 , . . . , e k } is a subtree of G. By the maximality of A every vertex of G not in T 2 is within distance 4 from some vertex in A. We extend T 2 to a spanning tree T of G that preserves the distance in G to A.
It suffices to show that For every vertex u ∈ V (T ) let u A be a vertex in A closest to u in T . We define a weight function c : If v ∈ A, then every u ∈ N ≤2 (v) satisfies u A = v. Lemma 2 thus yields that c(v 1 ) ≥ ε ∆ and c(v i ) ≥ ε δ if i ∈ {2, 3, . . . , k}. If v ∈ V (G) − A, then c(v) = 0. We also note that v∈V (T ) c(v) = n. This yields n = v∈A c(v) ≥ ε ∆ + (k − 1)ε δ , and so Arguments similar to those in the proof of Theorem 1 show that As in the proof of Theorem 1, the graph H := T 5 [A] is connected and satisfies We modify the weight function c to obtain a new weight function c ′ on A. Let As in the proof of 6 in Theorem 1 shows that we can express µ c (H) in terms of µ c ′ (H) as follows: Arguments similar to the proof of 8 show that and Substituting 29 and 30 into 28 yields that Combining the inequalities 26, 27 and 31 we obtain that which is 24, and so the bound in the theorem follows. ✷ The following theorem shows that the bound in Theorem 3 is not far from best possible if δ + 1 is a prime power. Our construction is based on the graph H q described below, constructed independently by Erdös and Rényi (1962) and Brown Brown (1966), and a modification H ′ q , first described in Erdös et al. (1989).
Let q be a prime power. Let GF (q) be the field of order q and let GF (q) 3 be the 3-dimensional vector space over GF (q) whose vectors are the triples of elements of GF (q). We define H q to be the graph whose vertices are the 1-dimensional subspaces of GF (q) 3 , where two vertices are adjacent if, as subspaces, they are orthogonal. Using elementary linear algebra it is easy to verify that H q has q 2 + q + 1 vertices, that its vertices have degree either q or q + 1, and that H q is C 4 -free and connected. Erdös et al. (1989) described a modification H ′ q of the graph H q , obtained as follows. Choose a vertex z of degree q in H q and let u, v be two distinct neighbours of z. Delete z and all edges joining a neighbour of u to a neighbour of v. The resulting graph H ′ q is connected, C 4 -free and has q 2 + q vertices, its minimum degree is at least q − 1, and Fig. 2: The graph G k,ℓ,q for k = 2 and ℓ = 5.
For our lower bound we only count the distances between pairs x, y with either x ∈ V i and y ∈ V j where 2 ≤ i < j ≤ ℓ, or x ∈ V 1 and y ∈ V j for j = 2, 3, . . . , ℓ, ignoring all other pairs of vertices. Clearly, if x ∈ V i , y ∈ V j and i < j, then d(x, y) ≥ 5(j − i) − 4. If x ∈ V 1 and y ∈ V j , then d(x, y) ≥ 5j − 9. Hence W (G k,ℓ,q ) > |V 1 | |V j | 5j − 9

Open Problem
In this paper we gave three instances in which bounds on the Wiener index or the average distance for graphs of given order and minimum degree can be improved significantly if the graph contains a vertex of large degree. The same question can be asked for bounds in terms of other graph parameters. For example it was shown by Plesní k (1984) that the cycle is the unique graph maximising the Wiener index among all 2-edge-connected or 2-connected graphs of given order, and corresponding results for graphs of higher connectivity were given in Dankelmann et al. (2009). Can these bounds be improved significantly if the graph has a vertex of large degree?
Problem 1 Determine the maximum Wiener index among all 2-connected graphs of given order and maximum degree.