1 Introduction

The Wiener index is a graph invariant based on distances in the graph. For a connected graph G, the Wiener index is the sum of distances between all unordered pairs of vertices in the graph and is denoted by W(G). That means,

where \(d_G(u,v)\) denotes the distance from u to v i.e. the minimum length of a path from u to v in the graph G.

It was first introduced by Wiener (1947) while studying its correlations with boiling points of paraffin considering its molecular structure. Since then, it has been one of the most frequently used topological indices in chemistry, as molecular structures are usually modelled as undirected graphs. Many results on the Wiener index and closely related parameters such as the gross status (Harary 1959), the distance of graphs (Entringer et al. 1976), and the transmission (Šoltés 1991) have been studied. A great deal of knowledge on the Wiener index is accumulated in several survey papers (Dobrynin et al. 2001, 2002; Dobrynin , Mel’nikov 2012; Knor and Škrekovski 2014; Xu et al. 2014). Finding a sharp bound on the Wiener index for graphs under some constraints has been one of the research topics attracting many researchers.

The most basic upper bound of W(G) states that, if G is a connected graph of order n, then

$$\begin{aligned} W(G) \le \frac{(n-1)n(n+1)}{6}, \end{aligned}$$
(1)

which is attained only by a path (Dankelmann et al. 2008a; Plesník 1984; Lovász 1979). Many sharp or asymptotically sharp bounds on W(G) in terms of other graph parameters are known, for instance, minimum degree (Beezer et al. 2001; Dankelmann and Entringer 2000; Kouider and Winkler 1997), connectivity (Dankelmann et al. 2009; Favaron et al. 1989), edge-connectivity (Dankelmann et al. 2008b, a) and maximum degree (Fischermann et al. 2002). For finding more details in mathematical aspect of Wiener index, see also results (Das and Nadjafi-Arani 2017; Gutman et al. 2014; Klavžar and Nadjafi-Arani 2014; Knor et al. 2014, 2016; Li et al. 2018; Mukwembi and Vetrík 2014; Wagner et al. 2009; Wagner 2006; Wang and Yu 2006).

One can study the Wiener index of the family of connected planar graphs. Since the bound given in Eq. 1 is attained by a path, it is natural to ask the same question for some particular family of planar graphs. For instance, the Wiener index of a maximal planar graph with n vertices, \(n\ge 3\) has a sharp lower bound \((n-2)^2+2\). This bound is attained by any maximal planar graph such that the distance between any pair of vertices is at most 2 (for instance a planar graph containing the n-vertex star). Che and Collins (2018), and independently Ćzabarka et al. (2019), gave a sharp upper bound of a particular class of maximal planar graphs known as Apollonian networks. An Apollonian network may be formed, starting from a single triangle embedded on the plane, by repeatedly selecting a triangular face of the embedding, adding a new vertex inside the face, and connecting the new vertex to each of the three vertices of the face. They showed that

Theorem 1.1

(Che and Collins 2018; Ćzabarka et al. 2019) Let G be an Apollonian network of order \(n\ge 3\). Then W(G) has a sharp upper bound

$$\begin{aligned} W(G)\le \bigg \lfloor \frac{1}{18}(n^3+3n^2)\bigg \rfloor = {\left\{ \begin{array}{ll} \frac{1}{18}(n^3+3n^2), &{}\text {if }n\equiv 0(mod \ 3);\\ \frac{1}{18}(n^3+3n^2-4), &{}\text {if }n\equiv 1(mod \ 3);\\ \frac{1}{18}(n^3+3n^2-2), &{}\text {if }n\equiv 2(mod \ 3). \end{array}\right. } \end{aligned}$$

It has been shown explicitly in Che and Collins (2018) that the bound is attained for the maximal planar graphs \(T_n\), we will give the construction of \(T_n\) in the next section, see Definition 2.1. The authors in Che and Collins (2018) also conjectured that this bound also holds for every maximal planar graph. It has been shown that the conjectured bound holds asymptotically (Ćzabarka et al. 2019). In particular, they showed the following result.

Theorem 1.2

(Ćzabarka et al. (2019)) For \(k=3,4,5\), there exists a constant \(C_k\) such that

$$\begin{aligned} W(G)\le \frac{1}{6k}n^3+C_k n^{5/2} \end{aligned}$$

for every k-connected maximal planar graph of order n.

In this paper, we confirm the conjecture.

Theorem 1.3

Let G be an \(n\ge 6\) vertex maximal planar graph. Then

$$\begin{aligned} W(G)\le \bigg \lfloor \frac{1}{18}(n^3+3n^2)\bigg \rfloor = {\left\{ \begin{array}{ll} \frac{1}{18}(n^3+3n^2), &{}\text {if }n\equiv 0(mod \ 3);\\ \frac{1}{18}(n^3+3n^2-4), &{}\text {if }n\equiv 1(mod \ 3);\\ \frac{1}{18}(n^3+3n^2-2), &{}\text {if }n\equiv 2(mod \ 3). \end{array}\right. } \end{aligned}$$

Equality holds if and only if G is isomorphic to \(T_n\) for all \(n\ge 9\).

2 Notations and preliminaries

Let G be a graph. We denote vertex set and edge set of G by V(G) and E(G) respectively. A path in a graph is an alternating sequence of distinct vertices and edges, starting from a vertex and ending at a vertex. Such that every edge is incident to neighbouring vertices in the sequence. The length of the path is the number of edges in the given path. With a slight abuse of notion, a cycle in a graph G is a non-zero length path from a vertex v to itself v. We use standard function \(d_G(v,u)\) to denote the length of shortest path from the vertex v to the vertex u. Even more, we may define a function that denotes the distance from a vertex to the set of vertices. Let v be a vertex of G and \(S \subseteq V(G)\) then \(d_G(S,v):=min_{u\in S}\{d_G(u,v)\}\).

For a vertex set \(S \subset V(G)\), the status of S is defined as the sum of all distances from the vertices of the graph to the set S. It is denoted by \(\sigma _G(S)\), thus

$$\begin{aligned} \sigma _G(S):=\sum _{u\in V(G)}d_G(S,u). \end{aligned}$$

For simplicity, we may omit subscript G in the given functions if the underlined graph is obvious. With a slight abuse of notation, we use \( \sigma _G(v):=\sigma _G(\{v\})\).

We have,

$$\begin{aligned} W(G) = \frac{1}{2} \sum _{v \in V(G)} \sigma _G(v). \end{aligned}$$

Here we use definition from Che and Collins (2018), for an Apollonian network \(T_n\) on n vertices. We will prove later that it is the unique maximal planar graph that maximizes the Wiener index of the maximal planar graphs.

Fig. 1
figure 1

Apollonian networks maximizing Wiener index of maximal planar graphs, Che and Collins (2018)

Definition 2.1

(Che and Collins (2018)) The Apollonian network \(T_n\) is the maximal planar graph on \(n\ge 3\) vertices, with the following structure, see Fig. 1.

If n is a multiple of 3, then the vertex set of \(T_n\) can be partitioned in three sets of same size, \(A=\{a_1,a_2,\cdots ,a_k\}\), \(B=\{b_1, b_2,\dots ,b_k\}\) and \(C=\{c_1,c_2,\cdots ,c_k\}\). The edge set of \(T_n\) is the union of following three sets \(E_1=\bigcup _{i=1}^{k}\{(a_i,b_i), (b_i,c_i), (c_i,a_i)\}\) forming concentric triangles, \(E_2=\bigcup _{i=1}^{k-1} \{(a_i,b_{i+1}), (a_i,c_{i+1}), (b_i,c_{i+1})\}\) forming ‘diagonal’ edges, and \(E_3= \bigcup _{1}^{k-1} \{(a_i,a_{i+1}), (b_i,b_{i+1}), (c_i,c_{i+1})\}\) forming paths in each vertex class, see Fig. 1a.

If \(3|(n-1)\), then \(T_n\) is the Apollonian network which may be obtained from \(T_{n-1}\) by adding a degree three vertex in the face \(a_1,b_1,c_1\) or \(a_{\frac{n-1}{3}},b_{\frac{n-1}{3}},c_{\frac{n-1}{3}}\), see Fig. 1b. Note that both graphs are isomorphic.

If \(3|(n-2)\), then \(T_n\) is the Apollonian network which may be obtained from \(T_{n-2}\) by adding a degree three vertex in each of the faces \(a_1,b_1,c_1\) and \(a_{\frac{n-1}{3}},b_{\frac{n-1}{3}},c_{\frac{n-1}{3}}\), see Fig. 1c.

The following lemmas will be used in the proof of Theorem 1.3. At first, we would like to recall some standard definitions. A connected graph G is said to be svertex connected or simply s-connected if it has more than s vertices and remains connected whenever fewer than s vertices are removed. An induced subgraph of a graph G is another graph, formed from a subset of the vertices of G and all of the edges connecting pairs of vertices in that subset. Formally let G be a graph and S be a subset of vertices of G, \(S\subseteq V(G)\). Then induced subgraph G[S] of G is a graph on the vertex set S and and \(E(G[S])=\{e\in E(G): e\subseteq S\}\). A connected graph G is called Hamiltonian graph, if there is a cycle that includes every vertex of G, and the cycle is called Hamiltonian cycle.

Lemma 2.2

Let G be an s-connected, maximal planar graph and S be a cut set of size s of G. Then G[S] is Hamiltonian.

Proof

Let us denote vertices of S, \(S=\{v_1,v_2,\dots ,v_s\}\). Let u and w be two distinct vertices, \(\{u,w\}\in V(G){\setminus } S\) such that any path from u to w contains at least one vertex from S. Since G is s-connected, by Menger’s Theorem, there are s pairwise internally vertex disjoint paths from u to w. Each of the paths intersects S in disjoint nonempty sets, therefore each of the paths contains exactly one vertex from S. We may assume, that in a particular planar embedding of G, those paths are ordered in such a way that one of the two regions determined by the cycle obtained from two paths from u to w containing \(v_{i_x}\) and \({v_{i_{x+1}}}\) has no vertex from S (where indices are taken modulo s), see Fig. 2. From the maximality of the planar graph, there is a path from the vertex u to the vertex w that does not contain a vertex from S, a contradiction. Thus we must have the edges \(\{v_{i_x},v_{i_{x+1}}\}\). Therefore we have a cycle of length s on the vertex set S, \(v_{i_{1}},v_{i_{2}},\cdots ,v_{i_{s}},v_{i_{1}}\) in the given order. hence G[S] is Hamiltonian. \(\square \)

Fig. 2
figure 2

s pairwise disjoint paths from u to w

The following definition is particularly helpful for the proof of Theorem 1.3. Given a set \(S\subseteq V\), we define the Breadth First Search partition of V with root S, \({\mathcal {P}}_{S}^G\) or simply \({\mathcal {P}}_{S}\) when the underline graph is clear, by \({\mathcal {P}}_{S} = \{S_0,S_1,\dots \}\), where \(S_0 = S\), and for \(i \ge 1\), \(S_i\) is the set of vertices at distance exactly i from S, formally \(S_i=\{v\in V(G):d_G(S,v)=i\}\). We refer to those sets as levels of \({\mathcal {P}}_{s}\). In particular \(S_1\) is the first level. For the largest integer integer k, for which \(S_k \ne \emptyset \), we refer to \(S_k\) as the last level. We refer to \(S_0\) and the last level as terminal level. Note that by definition every level besides the terminal level is a cut set of G. We denote by \({\mathcal {P}}_{v}\) the Breadth First Search partition from \(\{v\}\), that is the partition \({\mathcal {P}}_{\{v\}}.\)

The following three lemmas play a critical role to prove Theorem 1.3.

Lemma 2.3

Let G be an \(n+s\) vertex graph and S, \(S\subset V(G)\), be a set of vertices of size s. Such that each non-terminal level of \({\mathcal {P}}_{S}\) has size at least 3. Then we have

$$\begin{aligned} \sigma (S)\le \sigma _3(n):= {\left\{ \begin{array}{ll} \frac{1}{6}(n^2+3n), &{}\text {if }n\equiv 0 \; (mod \ 3);\\ \frac{1}{6}(n^2+3n+2), &{}\text {if }n\equiv 1,2 \; (mod \ 3). \end{array}\right. } \end{aligned}$$

Proof

If \({\mathcal {P}}_{S} = \{S_0,S_1,\dots \}\), by definition, we have that \(\sigma (S) = \displaystyle \sum _{i} i\left|{S}\right|.\) Therefore

$$\begin{aligned} \sigma (S)&= \left|{S_1}\right| + 2\left|{S_2}\right| + 3\left|{S_3}\right| + \cdots \\ {}&\le 3\bigg (1+2+\dots + \left\lfloor {\frac{n}{3}}\right\rfloor \bigg )+\bigg (\left\lfloor {\frac{n}{3}}\right\rfloor +1 \bigg )\bigg (n-3 \left\lfloor {\frac{n}{3}}\right\rfloor \bigg )= \sigma _3(n). \end{aligned}$$

\(\square \)

Lemma 2.4

Let G be an \(n+s\) vertex graph and S, \(S\subset V(G)\), be a set of vertices of size s. Such that each non-terminal level of \({\mathcal {P}}_{S}\) has size at least 4. Then we have

$$\begin{aligned} \sigma (S)\le \sigma _4(n):= {\left\{ \begin{array}{ll} \frac{1}{8}(n^2+4n), &{}\text {if }n\equiv 0 \;(mod \ 4);\\ \frac{1}{8}(n^2+4n+3), &{}\text {if }n\equiv 1,3 \; (mod \ 4);\\ \frac{1}{8}(n^2+4n+4), &{}\text {if }n\equiv 2 \;(mod \ 4). \end{array}\right. } \end{aligned}$$

Proof

We have

$$\begin{aligned} \sigma (S)&\le 4\bigg (1+2+\dots + \left\lfloor {\frac{n-1}{4}}\right\rfloor \bigg )+\bigg (\left\lfloor {\frac{n-1}{4}}\right\rfloor +1 \bigg )\bigg (n-1-4 \left\lfloor {\frac{n-1}{4}}\right\rfloor \bigg )\\&=\sigma _4(n) \end{aligned}$$

\(\square \)

Lemma 2.5

Let G be an \(n+s\) vertex graph and S, \(S\subset V(G)\), be a set of vertices of size s. Such that each non-terminal level of \({\mathcal {P}}_{S}\) has size at least 5. Then we have

$$\begin{aligned} \sigma (S)\le \sigma _5(n):= {\left\{ \begin{array}{ll} \frac{1}{10}(n^2+5n), &{}\text {if }n\equiv 0 \;(mod \ 5);\\ \frac{1}{10}(n^2+5n+4), &{}\text {if }n\equiv 1,4\; (mod \ 5);\\ \frac{1}{10}(n^2+5n+6), &{}\text {if }n\equiv 2, 3\; (mod \ 5). \end{array}\right. } \end{aligned}$$

Proof

We have

$$\begin{aligned} \sigma (S)&\le 5\bigg (1+2+\dots + \left\lfloor {\frac{n-1}{5}}\right\rfloor \bigg )+\bigg (\left\lfloor {\frac{n-1}{5}}\right\rfloor +1 \bigg )\bigg (n-1-5 \left\lfloor {\frac{n-1}{5}}\right\rfloor \bigg )\\&=\sigma _5(n) \end{aligned}$$

\(\square \)

3 Proof of Theorem 1.3

Proof

From Che and Collins (2018), we know that the desired lower bound is attained for \(T_n\). For the upper bound, we are going to prove Theorem 1.3 by induction on the number of vertices. In Che and Collins (2018), they prove it for \(n\le 10\) without computer aid, but in Ćzabarka et al. (2019), it is shown that the upper bound of Theorem 1.3 holds, for \(6\le n \le 18\) with using computer program. It is also shown by means of computer program that the upper bound is sharp for \( 6 \le n \le 18\) and the extremal graph is unique \(T_n\) for \( 9 \le n \le 18\). For our proof, we use the computer-aided result of Ćzabarka et al. (2019) only for Case 2.1 and for the uniqueness of the extremal graph. For the rest, the result in Che and Collins (2018) is enough. Unfortunately, we do not know any proof of the cases \(n \le 18\) without the use of computers. So, we assume \(n\ge 19\) from now on.

Let G be a maximal planar graph of \(n \ge 19\) vertices. The proof contains three cases depending on the connectivity of the graph G. Since G is a maximal planar graph, it is either 3, 4 or 5-connected. Notice that the result in Ćzabarka et al. (2019) is much stronger asymptotically than ours if G is 4 or 5-connected, but we are to prove the upper bound for every \(n \ge 19\). In Case 2, it makes the proof somewhat technical.

Case 1 Let G be a 5-connected graph. For every fixed vertex \(v \in V(G)\), consider \({\mathcal {P}}_{v}\). Since G is 5-connected, and each of the non-terminal levels of \({\mathcal {P}}_{v}\) is a cut set, we have that each non-terminal level has size at least 5. Therefore from Lemma 2.5, we have,

$$\begin{aligned} W(G)=\frac{1}{2}\sum _{v\in V(G)}\sigma (v)\le \frac{n}{2} \sigma _5(n-1) \le \frac{n}{20}(n^2+3n+2)< \bigg \lfloor \frac{1}{18}(n^3+3n^2)\bigg \rfloor , \end{aligned}$$

for all \(n\ge 4\). Therefore we are done if G is 5-connected.

Case 2 Let G be 4-connected and not 5-connected. Then G contains a cut set of size 4, which induces a cycle of length four, by Lemma 2.2. Let us denote the vertices of this cut set as \(v_1,v_2,v_3\) and \(v_4\), forming the cycle in this given order. The cut-set divides the plane into two regions. We call them the inner and the outer region respectively. Let us denote the number of vertices in the inner region by x and assume, without loss of generality, that x is minimal possible, but greater than one. Obviously \(x\le \frac{n-4}{2}\) or \(x=n-5\). From here on, we deal with several sub-cases depending on the value of x.

Case 2.1 If \(x\ge 4\) and \(x\ne n-5\).

Let us consider the sub-graph of G, say \(G'\), obtained by deleting all vertices from the outer region of the cycle \(v_1,v_2,v_3,v_4\) in G. The graph \(G'\) is not maximal since the outer face is a 4-cycle. The graph G is 4-connected, therefore it does not contain neither \(\{v_1,v_3\}\) nor \(\{v_2,v_4\}\), consequently we may add any of them to \(G'\), to obtain a maximal planar graph. Adding an edge decreases the Wiener index of \(G'\). In the following paragraph, we prove that one of the edges decreases the Wiener index of \(G'\) by at most \(\frac{x^2}{16}\).

Let \(A_i=\{v\in V(G')|d(v,v_i)<d(v,v_j), \forall j\in \{1,2,3,4\}{\setminus }\{i\}\}\) for \(i\in \{1,2,3,4\}\). Let A be the subset of vertices of \(G'\) not contained in any of the \(A_i\)’s. So \(A,A_1,A_2,A_3,A_4\) is a partition of vertices of \(G'\). It is simple to observe that, if adding an edge \(\{v_i,v_{i+2}\}\), for \(i\in \{1,2\}\), decreases the distance between a pair of vertices, then these vertices are from \(A_{i}\) and \(A_{i+2}\). If there is a vertex u which has at least three neighbours from the cut set, without loss of generality say \(v_1,v_2,v_3\), then \(A_{2}=\emptyset \), since G is 4-connected. Therefore we are done if there exists such vertex. Otherwise, for each pair \(\{v_1, v_{2}\}\), \(\{v_2, v_{3}\}\), \(\{v_3, v_{4}\}\), \(\{v_4, v_{1}\}\), there is a distinct vertex which is adjacent to both vertices of the pair. Hence the size of A is at least 4. The size of the vertex set \(\cup _{i=1}^{4}A_i\), is at most x. By the AM-GM inequality, we have that one of \(\left|{A_1}\right|\cdot \left|{A_3}\right|\) or \(\left|{A_2}\right|\cdot \left|{A_4}\right|\) is at most \(\frac{x^2}{16}\). Therefore we can choose one of the edges \(\{v_1,v_3\}\) or \(\{v_2,v_4\}\), such that after adding that edge to the graph \(G'\), the Wiener index of the graph decreases by at most \(\frac{x^2}{16}\). Let us denote the maximal planar graph obtained by adding this edge to \(G'\) by \(G_{x+4}\).

Similarly, we denote the maximal planar graph obtained from G, by deleting all vertices in the inner region and adding the diagonal by \(G_{n-x}\). This decreases the Wiener index by at most \(\frac{(n-x-4)^2}{16}\).

Consider the graph \(G_{n-x}\) and a sub-set of it’s vertices \(S=\{v_{1},v_{2},v_{3},v_{4}\}\). Since the graph G is 4-connected, each non-terminal level of \({\mathcal {P}}_{S}^{G_{n-x}}\) has at least 4 vertices. Therefore we get that \(\sigma _{G_{n-x}}(S)\le \sigma _4(n-x-4)= \frac{(n-x-2)^2}{8}\), from Lemma 2.4.

Recall that \(G'\) is the graph obtained from G by deleting the vertices from the outer region. For each \(i \in \{1,2,3,4\}\), consider the BFS partition \({\mathcal {P}}_{v_i}^{G'}\). Note that, \(x\ge 4\), G is 4-connected, and by minimality of x, we have that every non-terminal level of \({\mathcal {P}}_{v_i}^{G'}\) has at least 5 vertices, except two cases. The first level may contain only four vertices and the penultimate level may also contain four vertices with the last level having exactly one vertex. Status of the \(v_i\) is maximised, if the number of vertices in the first and the penultimate level is four, with the last level containing only one vertex and every other level contains exactly five vertices.

To simplify calculations of the status of the vertex \(v_i\), we may hang a new temporary vertex on the root, and we may bring a vertex from the last level to the previous level. These modifications do not change the status of the vertex, but it increases the number of vertices. Now we may apply Lemma 2.5 for this BFS partition, considering that number of vertices in all levels is exactly 5. Therefore we have \(\sigma _{G'}(v_i)\le \frac{(x+4)^2+5(x+4)}{10}\). Observe that this status contains distances, from \(v_i\) to other vertices from the cut set, which equals to four. Note that this is a uniform upper bound for the status of each of the vertices from the cut set.

Finally we may upper bound the Wiener index of G in the following way,

$$\begin{aligned} \begin{aligned} W(G)&\le W(G_{n-x})+\frac{(n-x-4)^2}{16}+W(G_{x+4})+\frac{x^2}{16}-8\\&\quad +x\cdot \sigma _{G_{n-x}}(\{v_1,v_2,v_3,v_4\})+(n-x-4)\cdot (\sigma _{G'}(v_1)-4). \end{aligned} \end{aligned}$$

In the first line, we upper bound all distances between pairs of vertices on the cut set and outer region, and between pairs of vertices on the cut set and inner region. We subtract 8 since distances between the pairs from the cut set were double-counted. In the second line, we upper bound all distances from the outer region to the inner region. These distances are split in two, distances from the outer region to the cut set and from a fixed vertex of the cycle, without loss of generality say \(v_1\), to the inner region.

We are going to prove that \(W(G)\le \frac{1}{18}(n^3+3n^2)-1\), therefore we will be done in this sub-case. We need to prove the following inequality

$$\begin{aligned} \begin{aligned} \frac{1}{18}(n^3+3n^2)-1&\ge \frac{1}{18}((n-x)^3+3(n-x)^2)+\frac{(n-x-4)^2}{16}\\&\quad +\frac{1}{18}((x+4)^3+3(x+4)^2)+\frac{x^2}{16}-8\\&\quad +x\cdot \frac{(n-x-2)^2}{8}+(n-x-4)\cdot (\frac{(x+4)^2+5(x+4)}{10}-4). \end{aligned} \end{aligned}$$

After we simplify, we get

$$\begin{aligned} \begin{aligned} \frac{82}{45}- \frac{9n}{10}+\frac{n^2}{16}+ \frac{x}{5} + \frac{41 n x}{120}- \frac{n^2 x}{24}- \frac{3 x^2}{40}+ \frac{n x^2}{60} + \frac{x^3}{40}\le 0. \end{aligned} \end{aligned}$$
(2)

We know that \(4\le x\le \frac{n-4}{2}\) and if we set \(x=4\), we get \(2176 + 528 n - 75 n^2\le 0\) which holds for all \(\ge 10\). Therefore, if the derivative of the right hand side of the inequality is negative for all \(\{x\mid 4\le x\le \frac{n-4}{2}\}\), then the inequality holds for all these values of x. Differentiating the LHS of the Inequality (2), with respect to x, we get

$$\begin{aligned} \begin{aligned}&\frac{\delta }{\delta x} \bigg ( \frac{82}{45}- \frac{9n}{10}+\frac{n^2}{16}+ \frac{x}{5} + \frac{41 n x}{120}- \frac{n^2 x}{24}- \frac{3 x^2}{40}+ \frac{n x^2}{60} + \frac{x^3}{40} \bigg )\\&\quad =\frac{1}{5} + \frac{41 n}{120} - \frac{n^2}{24} - \frac{3 x}{20} + \frac{n x}{30} + \frac{3 x^2}{40}. \end{aligned} \end{aligned}$$
(3)

If we set \(x=4\) in Eq. 3, we get \(\frac{1}{120} (96 + 57 n - 5 n^2)\), which is negative for all \(\ge 13\). If we set \(x=\frac{n-4}{2}\) in Eq. 3, we get \(\frac{1}{160} (-n^2 + 8 n + 128)\), which is negative for all \(\ge 17\). Therefore Eq. 3 is negative in the whole interval. Since \(n\ge 19\), we have \(W(G)\le \frac{1}{18}(n^3+3n^2)-1\), and this sub-case is settled.

Case 2.2 If \(2\le x\le 3\).

From the minimality of x and maximality of G, we have \(x=2\). Let us consider the maximal planar graph, denoted by \(G_{n-2}\), obtained from G by deleting these two vertices from the inner region and adding an edge which decreases the Wiener index by at most \(\frac{(n-6)^2}{16}\), such edge exists as in the previous case.

Since G is 4-connected, for each vertex v, \(v\in V(G)\), each level of \({\mathcal {P}}_{v}^{G}\) contains at least 4 vertices, but possibly the last one. Therefore status of both vertices inside can be bounded by \(\sigma _5(n)=\frac{1}{8}((n-1)^2+4(n-1)+4)\). This bound comes from Lemma 2.4. Finally, we have

$$\begin{aligned} \begin{aligned} W(G)&\le W(G_{n-2})+\frac{(n-6)^2}{16}+\frac{2}{8}((n-1)^2+4(n-1)+4)-1\\&\le \frac{1}{18}((n-2)^3+3(n-2)^2)+\frac{(n-6)^2}{16}+\frac{2}{8}((n-1)^2+4(n-1)+4)-1\\&=\frac{1}{18}n^3 + \frac{7}{48}n^2-\frac{1}{4}n +\frac{49}{18}-1\le \frac{1}{18}(n^3+3n^2)-1. \end{aligned} \end{aligned}$$
(4)

The last inequality holds for all \(n\ge 9\), so this sub-case is done too.

Case 2.3 If \(x=n-5\).

Therefore we have one vertex outside of the cut set. Let us consider the maximal planar graph, denoted by \(G_{n-1}\), obtained from G by deleting the vertex from the outer region and adding an edge which decreases the Wiener index by at most \(\frac{(n-5)^2}{16}\).

By the choice of x, we have that for the vertex outside the cut set v. Each level of \({\mathcal {P}}_{v}^{G}\) contains at least 5 vertices, except the first one which contains only 4 and the penultimate level may contain 4 vertices too followed by one vertex in the last level. The status of the vertex v is maximized if the last level contains exactly one vertex, the penultimate and the first level contain four vertices while every other level contains five vertices. Therefore status of v can be bounded by \(\frac{1}{10}(n^2+5n)\). This bound comes from Lemma 2.5. Finally, we have

$$\begin{aligned} \begin{aligned} W(G)&\le W(G_{n-1})+\frac{(n-5)^2}{16}+\frac{1}{10}(n^2+5n)\\&\le \frac{1}{18}((n-1)^3+3(n-1)^2)+\frac{(n-5)^2}{16}+\frac{1}{10}(n^2+5n)\\&=\frac{1}{18}n^3 + \frac{13}{80}n^2+\frac{7}{24}n - \frac{241}{144}\le \frac{1}{18}(n^3+3n^2)-1. \end{aligned} \end{aligned}$$
(5)

The last inequality holds for all \(n\ge 9\), so this sub-case is done too.

Case 3. Let G be 3-connected and not 4-connected. Since G is not 4-connected and it is a maximal planar graph, it must have a cut set of size 3, say \(\{v_1,v_2,v_3\}\). This induces a triangle from the Lemma 2.2. Without loss of generality, let us assume that number of vertices in the inner smaller region of the cut set is minimal possible, say x.

Case 3.1. If \(x\le 2\).

From the minimality of x, we have \(x=1\). Let us denote this vertex as v. Let \(G_{n-1}\) be a maximal planar graph obtained from G by deleting the vertex v. From the Lemma 2.3, we have \(\sigma _G(v)\le \frac{1}{6}(n^2+n)-\frac{1}{3}\mathbb {1}_{3|(n-1)}\), where \(\mathbb {1}_{3|(n-1)}\) equals one if 3 divides \(n-1\) and zero otherwise. Finally we have,

$$\begin{aligned} \begin{aligned} W(G)&\le W(G_{n-1})+\sigma _G(v) \\&\le \frac{1}{18}((n-1)^3+3(n-1)^2)-\frac{1}{9}\mathbb {1}_{3|n}-\frac{2}{9}\mathbb {1}_{3|(n-2)} +\frac{1}{6}(n^2+n) \\&\quad -\frac{1}{3}\mathbb {1}_{3|(n-1)}= \frac{n^3}{18}+\frac{n^2}{6}+\frac{1}{9}-\frac{1}{9}\mathbb {1}_{3|(n)}-\frac{2}{9}\mathbb {1}_{3|(n-2)}-\frac{1}{3}\mathbb {1}_{3|(n-1)}\\&\le \bigg \lfloor \frac{1}{18}(n^3+3n^2)\bigg \rfloor . \end{aligned} \end{aligned}$$
(6)

In this case, the equality holds if and only if the graph obtained after deleting the vertex v is \(T_{n-1}\). We can observe that, if we add the vertex v to the graph \(T_{n-1}\), the choice that maximizes the status of v , \(\sigma _G(v)= \frac{1}{6}(n^2+n)-\frac{1}{3}\mathbb {1}_{3|(n-1)}\), is only when we add v in one ot the two faces which gets us the graph \(T_n\). Hence we have the desired upper bound of the Wiener index and equality holds if and only if \(G=T_n\).

Case 3.2 If \(x=3\).

Let us denote vertices in the inner region as \(x_1,\ x_2\text { and }x_3\). From the minimality of x and maximality of G, the structure of G in the inner region is well defined, see Fig. 3a. If we remove these three inner vertices, the graph we get is denoted by \(G_{n-3}\) and is still maximal. Hence we may use the induction hypothesis for the graph \(G_{n-3}\). Consider the graph \(G_{n-3}\) and a vertex set \(S=\{v_1,v_2,v_3\}\). Each level of \({\mathcal {P}}_{S}^{G_{n-3}}\) has at least three vertices except the terminal one. Therefore we may apply Lemma 2.3, then we have \(\sigma _{G_{n-3}}(\{v_1,v_2,v_3\})\le \frac{1}{6}((n-6)^2+3(n-6)+2)\). To estimate distances from the vertices in the outer region to the vertices in the inner region we do the following. We first estimate distances from the outer region to the cut set and from the fixed vertex on the cut set to all \(x_i\). The distances from the vertices in the outer region to the set \(\{v_1,v_2,v_3\}\), is \(\sigma _{G_{n-3}}( \{v_1,v_2,v_3\})\). The sum of distances from \(v_i\) to the vertices \(\{x_1,x_2,x_3\}\) is 4. Note that, if we take a vertex in the outer region which has at least two neighbours on the cut set, then for this vertex we need to count 3 for the distances from the cut set to the vertices \(\{x_1,x_2,x_3\}\). Since we have at least two such vertices, all cross distances can be bounded by \(3\sigma _{G_{n-3}}( \{v_1,v_2,v_3\})+4(n-5)+6\). Then we have,

$$\begin{aligned} W(G)&\le W(G_{n-3})+W(K_3)+3\sigma _{G_{n-3}}(\{v_1,v_2,v_3\})+4n-14 \nonumber \\&\le \frac{1}{18}((n-3)^3+3(n-3)^2)+\frac{1}{2}((n-6)^2+3(n-6)+2)+4n-11\nonumber \\&< \bigg \lfloor \frac{1}{18}(n^3+3n^2)\bigg \rfloor . \end{aligned}$$
(7)

Therefore, this case is also settled.

Fig. 3
figure 3

The unique inner regions for the 3-connected case when \(x=3\) and \(x=4\)

Case 3.3 If \(x=4\).

From the minimality of x and the maximality of the planar graph G, there is only one configuration of the inner region (Fig. 3b). Consider a maximal planar graph on the \(n-4\) vertices, say \(G_{n-4}\), that is obtained from G by deleting the four inner vertices. We will apply the induction hypothesis for this graph, to upper bound the sum of distances between all pairs of vertices from \(V(G_{n-4})\) in G. By applying Lemma 2.3 for \(G_{n-4}\) and \(S= \{v_1,v_2,v_3\}\), we get \(\sigma _{G_{n-4}}(\{v_1,v_2,v_3\})\le \frac{1}{6}((n-4-3)^2+(n-4-3)+2)\). The sum of the distances between the four inner vertices is 7. The sum of the distances from each \(v_i\) to all of the vertices inside is at most six. By a similar argument as in the previous case we have,

$$\begin{aligned} W(G)&\le \frac{1}{18}((n-4)^3+3(n-4)^2)+7+\frac{4}{6}((n-7)^2+(n-7)+2)+6(n-4)\nonumber \\&< \bigg \lfloor \frac{1}{18}(n^3+3n^2)\bigg \rfloor . \end{aligned}$$
(8)

Therefore, this case is also settled.

Case 3.4 If \(x=5\).

From the minimality of x and the maximality of the planar graph G, there are three configurations of the inner region, see Fig. 4. Consider a maximal planar graph on the \(n-5\) vertices, say \(G_{n-5}\), which is obtained from G by deleting 5 vertices from the inner region. We will apply the induction hypothesis for this graph \(G_{n-5}\), to bound the sum of the distances between the vertices of \(V(G_{n-5})\) in the graph G. By applying Lemma 2.3 for \(G_{n-5}\) and \(S= \{v_1,v_2,v_3\}\), we get \(\sigma _{G_{n-5}}(\{v_1,v_2,v_3\})\le \frac{1}{6}((n-8)^2+(n-8)+2)\). The sum of the distances between five inner vertices is at most 13. The sum of the distances from \(v_i\) to all of the vertices inside is at most 8. Finally, we have

$$\begin{aligned} W(G)&\le \frac{1}{18}((n-5)^3+3(n-5)^2)+13+\frac{5}{6}((n-8)^2+(n-8)+2)+8(n-5)\nonumber \\&< \bigg \lfloor \frac{1}{18}(n^3+3n^2)\bigg \rfloor . \end{aligned}$$
(9)

Therefore this case is also settled.

Fig. 4
figure 4

3-Connected, \(x=5\)

Case 3.5 If \(x\ge 6\).

First we settle for \(x\ge 7\) and then for \(x=6\). Consider the maximal planar graph on \(n-x\) vertices, say \(G_{n-x}\), which is obtained from G by deleting those x vertices from the inner region of the cut set \(\{v_1,v_2,v_3\}\). Consider the maximal planar graph on \(x+3\) vertices, say \(G_{x+3}\), which is obtained from G, by deleting all \(n-x-3\) vertices from the outer region of the cut set \(\{v_1,v_2,v_3\}\). We know by induction that \(W(G_{x+3})\le \frac{1}{18}((x+3)^3+3(x+3)^2)\). There are at least two vertices from the cut set \(\{v_1,v_2,v_3\}\), such that each of them has at least two neighbours in the outer region of the cut set. Without loss of generality, we may assume they are \(v_1\) and \(v_2\). Hence if we consider \({\mathcal {P}}_{v_1}^{G_{n-x}}\) and \({\mathcal {P}}_{v_2}^{G_{n-x}}\), we will have 4 vertices in the first level of and at least three in the following levels until the last one. Therefore we have \(\sigma _{G_{n-x}}(v_1)\le \sigma _3(n-x-2)+1\le \frac{1}{6}((n-x-2)^2+3(n-x-2)+8)\) from Lemma 2.3 and same for \(v_2\). Now let us consider \({\mathcal {P}}_{\{v_1,v_2\}}^{G_{x+3}}\), from minimality of x, each non-terminal level of the \({\mathcal {P}}_{\{v_1,v_2\}}^{G_{x+3}}\) contains at least 4 vertices. Therefore by applying Lemma 2.4, we get \(\sigma _{G_{x+3}}(\{v_1,v_2\})\le \frac{1}{8}(x^2+6x+9)\). We have,

$$\begin{aligned} \begin{aligned} W(G)&\le (W(G_{x+3})+W(G_{n-x})-3)+(n-x-3)(\sigma _{G_{x+3}}(\{v_1,v_2\})-1)\\&\quad +x \bigg (\text {max} \bigg \{ \sigma _{G_{n-x}}(v_{1}),\sigma _{G_{n-x}}(v_{2}) \bigg \}-2\bigg ). \end{aligned} \end{aligned}$$
(10)

The first term of the sum is an upper bound for the sum of all distances which does not cross the cut set. The second and the third terms upper-bounds all cross distances in the following way- we may split this sum into two parts for each crossing pair sum from inside to the set \(\{v_1, v_2\}\) and from \(v_i\), \(i \in \{1,2\}\) to the vertex outside, those are the second and the third terms of the sum accordingly. Therefore applying estimates, we get

$$\begin{aligned} \begin{aligned} \frac{1}{18}(n^3+3n^2)-1&\ge \frac{1}{18}((x+3)^3+3(x+3)^2)+\frac{1}{18}((n-x)^3+3(n-x)^2)-3\\&\quad +\frac{(n-x-3)(x^2+6x+1)}{8}\\&\quad +\frac{x((n-x-2)^2+3(n-x-2)-4)}{6}. \end{aligned} \end{aligned}$$
(11)

After simplification we have

$$\begin{aligned} -x^3+x^2(n+3)+x(21-6n)-(15+3n)\ge 0. \end{aligned}$$
(12)

where

$$\begin{aligned} \frac{\delta }{\delta x} \bigg (-x^3+x^2(n+3)+x(21-6n)-(15+3n)\bigg )=-3x^2+(2n+6)x+21-6n. \end{aligned}$$

The derivative is positive when \(x\in [7,\frac{n}{2}]\). Hence since the inequality (12) holds for \(x=7\), it also holds for all x, \(x \in [7,\frac{n}{2}]\). Therefore, if \(x\ge 7\) we are done.

Finally if \(x=6\), then distances from \(v_1\) and \(v_2\) to all vertices inside is 9 instead of \(\frac{73}{8}\) as it was used the in Inequality 11. Thus we get an improvement of Inequality (11), which shows that \(W(G) < \left\lfloor {\frac{1}{18}(n^3+3n^2)}\right\rfloor \) even for \(x=6\). Therefore we have settled 3-connected case too. \(\square \)

4 Concluding remarks

There is the unique maximal planar graph \(T_n\), maximizing the Wiener index, Theorem 1.3. Clearly \(T_n\) is not 4-connected. One may ask for the maximum Wiener index for the family of 4-connected and 5-connected maximal planar graphs. In Ćzabarka et al. (2019), asymptotic results were proved for both cases. Moreover, based on their constructions, they conjecture sharp bounds for both 4-connected and 5-connected maximal planar graphs. Their conjectures are the following.

Conjectute 4.1

Let G be an \(n\ge 6\) vertex maximal 4-connected planar graph. Then

$$\begin{aligned}W(G)\le {\left\{ \begin{array}{ll} \frac{1}{24}n^3+\frac{1}{4}n^2+\frac{1}{3}n-2, &{}\text {if }n\equiv 0,2 \; (mod \ 4);\\ \frac{1}{24}n^3+\frac{1}{4}n^2+\frac{5}{24}n-\frac{3}{2}, &{}\text {if } n\equiv 1 \;(mod \ 4);\\ \frac{1}{24}n^3+\frac{1}{4}n^2+\frac{5}{24}n-1, &{}\text {if }n\equiv 3 \;(mod \ 4); \end{array}\right. } \end{aligned}$$

Conjectute 4.2

Let G be an \(n\ge 12\) vertex maximal 4-connected planar graph. Then

$$\begin{aligned}W(G)\le {\left\{ \begin{array}{ll} \frac{1}{30}n^3+\frac{3}{10}n^2-\frac{23}{15}n+32, &{}\text {if }n\equiv 0 \;(mod \ 5);\\ \frac{1}{30}n^3+\frac{3}{10}n^2-\frac{23}{15}n+\frac{156}{5}, &{}\text {if }n\equiv 1 \;(mod \ 5);\\ \frac{1}{30}n^3+\frac{3}{10}n^2-\frac{23}{15}n+\frac{168}{5}, &{}\text {if }n\equiv 2 \;(mod \ 5);\\ \frac{1}{30}n^3+\frac{3}{10}n^2-\frac{23}{15}n+31, &{}\text {if }n\equiv 3 \;(mod \ 5);\\ \frac{1}{30}n^3+\frac{3}{10}n^2-\frac{23}{15}n+\frac{161}{5}, &{}\text {if }n\equiv 4 \;(mod \ 5);\\ \end{array}\right. } \end{aligned}$$