# Harary and hyper-Wiener indices of some graph operations

## Abstract

In this paper, we obtain the Harary index and the hyper-Wiener index of the H-generalized join of graphs and the generalized corona product of graphs. As a consequence, we deduce some of the results in (Das et al. in J. Inequal. Appl. 2013:339, 2013) and (Khalifeh et al. in Comput. Math. Appl. 56:1402–1407, 2008). Moreover, we calculate the Harary index and the hyper-Wiener index of the ideal-based zero-divisor graph of a ring.

## 1 Introduction

All graphs considered in this paper are finite, simple, and undirected. Let $$G=(V(G),E(G))$$ be a graph. For $$u\in V(G)$$ and a non-empty subset T of $$V(G)$$, $$N_{G}(u)=\{x\in V(G) : ux \in E(G) \}$$ and $$\langle T\rangle$$ denotes the subgraph induced by T. For $$u,v \in V(G)$$, the distance between u and v in G, denoted by $$d_{G}(u, v)$$, is equal to the length of the shortest path between u and v. Let $$K_{n}$$ be the complete graph on n vertices and $$K_{n_{1},n_{2},\ldots ,n_{k}}$$ be the complete k-partite graph. The complement of the graph G, denoted by $$G^{c}$$, is a graph with $$V(G^{c})=V(G)$$ and $$E(G^{c})=\{xy : xy \notin E(G)\}$$.

Let H be a graph with $$V(H)=\{x_{1},x_{2},\ldots , x_{k}\}$$. Let $$\mathscr{F}=\{G_{1},G_{2},\ldots ,G_{k}\}$$ be a family of graphs and $$\mathscr{S}=\{T_{i}\subseteq V(G_{i}): T_{i}\neq \emptyset , 1 \leq i\leq k\}$$. The H-generalized join of the family of k graphs $$\mathscr{F}$$, constrained by the family of vertex subsets $$\mathscr{S}$$, denoted by $$\bigvee_{(H,\mathscr{S})} \mathscr{F}$$ produces a graph such that the vertex set $$V(\bigvee_{(H,\mathscr{S})} \mathscr{F}) = \bigcup_{i=1}^{k} V(G_{i})$$ and the edge set $$E(\bigvee_{(H,\mathscr{S})} \mathscr{F})= ( \bigcup_{i=1}^{k}E(G_{i}) ) \cup ( \bigcup_{ \stackrel{x_{i}x_{j} \in E(H)}{i \neq j}} \{xy : x \in T_{i}, y \in T_{j} \} )$$, see [17]. If $$T_{i}=V(G_{i})$$ for $$1\leq i\leq k$$, then $$\bigvee_{(H,\mathscr{S})} \mathscr{F}$$ is the H-generalized join, denoted by $$H[G_{1},G_{2},\ldots ,G_{k}]$$, of $$G_{1},G_{2},\ldots , G_{k}$$. If $$G\cong G_{i}$$, for $$1\leq i\leq k$$, then $$H[G_{1},G_{2},\ldots , G_{k}]$$ is called the lexicographic product of H and G, denoted by $$H[G]$$. Also if $$H=K_{2}$$, then $$K_{2}[G_{1}, G_{2}]$$ is the join, denoted by $$G_{1}\vee G_{2}$$, of $$G_{1}$$ and $$G_{2}$$.

Let $$H'$$ be a graph on vertices and $$G_{1},G_{2}, \ldots , G_{\ell}$$ be a family of graphs. The generalized corona product, $$H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i}$$, of $$H', G_{1},G_{2}, \ldots , G_{\ell}$$ is a graph obtained by taking one copy of graph $$H'$$, $$G_{1},G_{2}, \ldots , G_{\ell}$$ and joining the ith vertex of $$H'$$ to every vertex of $$G_{i}$$, see [9]. If $$G \cong G_{i}$$, for $$1\leq i\leq \ell$$, then the graph $$H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i}$$ is called corona product of $$H'$$ and G, denoted by $$H' \circ G$$. Several work has been done on the corona product of graphs and generalized corona of graphs. This can be seen in [9, 14, 15].

Throughout this paper, all rings are finite commutative rings with unity. The nilradical of a ring R is the set $$\mathrm{Nil}(R)=\{x\in R: x^{k}=0, \text{ for some positive integer } k\}$$. A ring R is reduced if $$\mathrm{Nil}(R)=(0)$$. For $$x \in R$$ and an ideal I of R, $$x+I = \overline{x}$$ is the co-set of I in R with respect to x and $$\mathrm{Ann}(x: I)=\{y\in R: xy \in I\}$$. If $$I=(0)$$ is the zero ideal of R, then $$\mathrm{Ann}(x : (0))=\{y\in R: xy=0\}$$. In short, we use $$\mathrm{Ann}(x)$$ instead of $$\mathrm{Ann}(x : (0))$$. An element u of R is said to be unit if there exists an element v of R such that $$uv=1$$. A non-zero element x of R is said to be zero-divisor if there exists a non-zero element y of R such that $$xy=0$$. Let $$Z(R)$$ be the set of all zero-divisors of R. For a positive integer n, $$\mathbb{Z}_{n}$$ denotes the ring of integer modulo n.

Given a ring R, the zero-divisor graph of R, denoted by $$\Gamma (R)$$, is a graph with $$V(\Gamma (R))= Z(R)$$ and two distinct vertices x and y are adjacent if and only if $$xy=0$$. For any two vertices a and b in $$\Gamma (R)$$, define $$a\sim b$$ if and only if $$\mathrm{Ann}(a) = \mathrm{Ann}(b)$$. One can see that, the relation is an equivalence relation. Let $$A_{a_{1}}, A_{a_{2}},\ldots , A_{a_{k}}$$ be the equivalence classes of the relation with respective representatives are $$a_{1},a_{2},\ldots , a_{k}$$. The compressed zero-divisor graph, denoted by $$\Gamma ^{E}(R)$$ (defined in [19]) is a graph with $$V(\Gamma ^{E}(R))=\{a_{1},a_{2},\ldots , a_{k}\}$$ and two distinct vertices $$a_{i}$$ and $$a_{j}$$ are adjacent if and only if $$a_{i}a_{j}=0$$. It is observed in [18] that, $$\Gamma (R)$$ is a $$\Gamma ^{E}(R)$$-generalized join of $$\langle A_{a_{1}} \rangle , \langle A_{a_{2}} \rangle , \ldots , \langle A_{a_{k}} \rangle$$, that is $$\Gamma (R) \cong \Gamma ^{E}(R)[\langle A_{a_{1}} \rangle , \langle A_{a_{2}} \rangle , \ldots , \langle A_{a_{k}} \rangle ]$$ and $$\Gamma ^{E}(R)$$ is a connected subgraph of $$\Gamma (R)$$ induced by $$\{a_{1},a_{2},\ldots , a_{k}\}$$.

The concept of an ideal-based zero-divisor graph was introduced by Redmond [12]. The ideal-based zero-divisor graph of a ring R with respect to an ideal I, denoted by $$\Gamma _{I}(R)$$, is a graph with $$V(\Gamma _{I}(R)) = \{x\in R \backslash I: xy \in I ,\text{ for some }y \in R \backslash I \}$$ and two distinct vertices x and y are adjacent if and only if $$xy \in I$$. The ideal-based zero-divisor graph $$\Gamma _{I}(R)$$ is a natural generalization of the zero-divisor graph. Clearly, $$\Gamma _{I}(R)$$ is empty graph (that is, it has no vertex) if and only if I is a prime ideal of R. So, throughout this paper we consider only non-prime ideals. The ideal-based zero-divisor graphs have been studied in [2, 10, 12].

We associate with each graph G a numerical value, called the topological index of G. This index remains invariant under the graph isomorphism. By modelling a chemical substance with a graph, we can apply these indices and obtain physico-chemical properties of that substance solely by means of mathematical calculations without any experiments in laboratory. The topological indices have many applications in the fields of chemical graph theory, molecular topology and mathematical chemistry. There are several results on the topological indices have been found in past, see for instant, [38, 11, 13, 15, 16, 21].

Here, we consider the following well-known distance-based topological indices.

The Harary index of a graph has been introduced independently by Plavšić et al. [11] and by Ivanciuc et al. [7], in 1993.

(i) The Harary index of G is defined as $$\mathcal{H}(G) = \sum \frac{1}{d_{G}(u,v)}$$, where the summation runs over all unordered pairs u and v of vertices of G. The Harary index has been studied extensively in the past. For instance, see [5, 6, 21].

The hyper-Wiener index of acyclic graphs was introduced by Randic in 1993. Then Klein et al. generalized Randic’s definition for all connected graphs, as a generalization of the Wiener index. The Wiener index $$W(G)$$ of a connected graph G is defined as $$W(G)=\sum_{\{u,v\}\subseteq V(G)} d_{G}(u,v)$$.

(ii) The hyper-Wiener index of G is defined as

\begin{aligned} WW(G) = \frac{1}{2} W(G) + \frac{1}{2} \sum _{\{u,v\} \subseteq V(G)} d_{G}^{2}(u, v), \end{aligned}

where $$d_{G}^{2}(u, v) = (d_{G}(u, v))^{2}$$.

In [8], Khalifeh et al. computed the exact formula for the hyper-Wiener index of various graph operations, including join, Cartesian product, lexicographic product. The hyper-Wiener index has been studied extensively in the past, see some of the references [6, 8, 13].

The paper is organized as follows.

In Sect. 2, we find the Harary index of the H-generalized join of graphs. As a consequence, we obtain the Harary index of the lexicographic product of graphs, join of graphs and corona product of graphs which are given in [4]. Also, we find the Harary index of the the ideal-based zero-divisor graph of a ring. Moreover, we calculate the Harary index of the ideal-based zero-divisor graph of $$\mathbb{Z}_{n}$$ and zero-divisor graph of $$\mathbb{Z}_{n}$$, where $$\mathbb{Z}_{n}$$ is the ring of integers modulo n.

In Sect. 3, we determine the hyper-Wiener index of the H-generalized join of graphs. As a consequence, we obtain the hyper-Wiener index of the lexicographic product of graphs, and join of graphs which are given in [8]. Further, we give a formula for the hyper-Wiener index of generalized corona product of graphs and the ideal-based zero-divisor graph of a ring and zero-divisor graph of a ring. Finally, we compute the hyper-Wiener index of ideal-based zero-divisor graph of $$\mathbb{Z}_{n}$$ and zero-divisor graph of $$\mathbb{Z}_{n}$$.

## 2 Main results

For a non-empty subset T of $$V(G)$$ and $$u\in V(G)$$, define $$d_{G}(u,T)=\text{min}\{d_{G}(u,v): v\in T\}$$. Note that if $$u\in T$$, then $$d_{G}(u,T)=0$$. For the positive integers n and k with $$k \leq n$$, $$\binom{n}{k}$$ denotes the number of ways to choose k elements from an n elements set and $$\binom{k-1}{k}=0$$.

### 2.1 Harary index of H-generalized join of graphs

In this subsection, we compute an exact formula for the Harary index of H-generalized join of graphs.

### Lemma 1

Let H be a graph with $$V(H)=\{u_{1},u_{2},\ldots ,u_{k}\}$$ and $$\mathscr{F}= \{G_{1},G_{2},\ldots ,G_{k}\}$$ be a family of graphs. Consider a family $$\mathscr{S}= \{T_{1},T_{2},\ldots ,T_{k}\}$$ of non-empty sets such that $$T_{i} \subseteq V(G_{i})$$, for $$1 \leq i \leq k$$ and $$G = \bigvee_{(H,\mathscr{S})} \mathscr{F}$$.

(i) If H is connected, then $$\bigvee_{(H,\mathscr{S})} \mathscr{F}$$ is connected if and only if for $$1 \leq i \leq k$$, $$d_{G_{i}}(u, T_{i})\neq 0$$, for all $$u \in V(G_{i})\setminus T_{i}$$.

(ii) If $$G= \bigvee_{(H,\mathscr{S})} \mathscr{F}$$ is connected, then

\begin{aligned} \mathcal{H}(G) ={}& \frac{1}{2} \sum_{i=1}^{k} \biggl[ \binom{ \vert T_{i} \vert }{2} + \bigl\vert E\bigl(\langle T_{i}\rangle \bigr) \bigr\vert \biggr] \\ &{} + \sum_{i=1}^{k}\sum _{ \stackrel{\{u,v\} \subseteq V(G_{i}) \setminus T_{i}}{}} \frac{1}{\min \{d_{G_{i}}(u,v), d_{G_{i}}(u,T_{i})+d_{G_{i}}(v,T_{i})+2\}} \\ &{} +\sum_{i=1}^{k}\sum _{ \stackrel{u\in V(G_{i}) \setminus T_{i}}{v\in T_{i}}} \frac{1}{\min \{d_{G_{i}}(u,v), d_{G_{i}}(u,T_{i})+2\}} \\ &{} +\sum_{1\leq i < j \leq k}\sum_{ \stackrel{u\in V(G_{i})}{v \in V(G_{j})}} \frac{1}{d_{G_{i}}(u,T_{i})+d_{H}(u_{i},u_{j})+d_{G_{j}}(v,T_{j})}. \end{aligned}
(2.1)

### Proof

Proof of $$(i)$$ is straightforward.

For proving $$(ii)$$, let us first observe the following.

For $$u,v\in V(G)$$ with $$u\neq v$$,

$$d_{G}(u,v) = \textstyle\begin{cases} 2 \quad \text{if u,v\in T_{i}, uv\notin E(G),} \\ \text{min}\{d_{G_{i}}(u,v), d_{G_{i}}(u,T_{i})+d_{G_{i}}(v,T_{i})+2\} \\ \phantom{2}\quad\text{if u,v\in V(G_{i}) \setminus T_{i},} \\ \text{min}\{d_{G_{i}}(u,v),d_{G_{i}}(u,T_{i})+2\} \\ \phantom{2}\quad\text{if u\in V(G_{i}) \setminus T_{i}, v\in T_{i}}, \\ d_{G_{i}}(u,T_{i})+d_{H}(u_{i},u_{j})+d_{G_{j}}(v,T_{j}) \\ \phantom{2}\quad\text{if u\in V(G_{i}), v\in V(G_{j}), i\neq j. } \end{cases}$$
(2.2)

Then by the definition of G,

\begin{aligned} \mathcal{H}(G) ={}& \sum_{i=1}^{k}\sum _{\{u,v\} \subseteq V(G_{i})}\frac{1}{d_{G}(u,v)} + \sum _{1\leq i < j \leq k} \sum_{\stackrel{u \in V(G_{i})}{v \in V(G_{j})}}\frac{1}{d_{G}(u,v)} \\ = {}&\sum_{i=1}^{k} \biggl[\sum _{\{u,v\}\subseteq T_{i}} \frac{1}{d_{G}(u,v)} +\sum_{\{u,v\}\subseteq V(G_{i}) \setminus T_{i}} \frac{1}{d_{G}(u,v)} + \sum_{ \stackrel{u \in V(G_{i}) \setminus T_{i}}{v \in T_{i}}} \frac{1}{d_{G}(u,v)} \biggr] \\ &{} + \sum_{1\leq i < j \leq k}\sum_{ \stackrel{u \in V(G_{i})}{v \in V(G_{j})}} \frac{1}{d_{G}(u,v)}. \end{aligned}

For $$u,v \in T_{i}$$,

$$d_{G}(u,v) = \textstyle\begin{cases} 1 & \text{if uv\in E(G_{i}),} \\ 2 & \text{otherwise.} \end{cases}$$
(2.3)

Hence $$\sum_{\{u,v\}\subseteq T_{i}} \frac{1}{d_{G}(u,v)}= |E( \langle T_{i} \rangle )| + \frac{1}{2} [\binom{|T_{i}|}{2}- |E( \langle T_{i} \rangle )| ]$$. The result follows from Equation (2.2). □

The following result gives a formula for the Harary index of H-generalized join of graphs.

### Proposition 1

Let H be a connected graph with $$V(H)= \{u_{1},u_{2},\ldots ,u_{k}\}$$. Let $$G_{1},G_{2},\ldots ,G_{k}$$ be a collection of graphs with $$|V(G_{i})|= \nu _{i}$$, $$|E(G_{i})|= \varepsilon _{i}$$, for $$i= 1,2,\ldots ,k$$ and $$G=H[G_{1},G_{2}, \ldots ,G_{k}]$$. Then the Harary index of G is given by

$$\mathcal{H}(G)=\frac{1}{2} \sum _{i=1}^{k} \biggl[ \binom{\nu _{i}}{2}+\varepsilon _{i} \biggr] + \sum_{1 \leq i< j \leq k}\nu _{i}\nu _{j}\frac{1}{d_{H}(u_{i},u_{j})}.$$
(2.4)

### Proof

If $$T_{i}= V(G_{i})$$, then $$\bigvee_{(H,\mathscr{S})} \mathscr{F} = H[G_{1},G_{2}, \ldots , G_{k}]$$ and $$V(G_{i}) \setminus T_{i} = \emptyset$$. Therefore, the 2nd and 3rd terms of Equation (2.1) in Lemma 1 become zero. Hence the result follows. □

Next, we recall the following equivalence relation defined in [1]. For a graph G, we define a relation $$\sim _{G}$$ on $$V(G)$$ as follows. For any $$x,y \in V(G)$$, define $$x\sim _{G} y$$ if and only if $$N_{G}(x) = N_{G}(y)$$. Clearly, the relation $$\sim _{G}$$ is an equivalence relation on $$V(G)$$. Let $$[x]$$ be the equivalence class containing x and D be the set of all equivalence classes of this relation $$\sim _{G}$$. Based on this equivalence classes, we define the reduced graph H of a graph G as follows. The reduced graph H of G is the graph with $$V(H) = D$$ and two distinct vertices $$[u]$$ and $$[v]$$ are adjacent in H if and only if u and v are adjacent in G. Note that if $$V(H) = \{[u_{1}],[u_{2}],\ldots ,[u_{k}]\}$$, then G is the H-generalized join of $$\langle [u_{1}]\rangle , \langle [u_{2}]\rangle ,\ldots ,\langle [u_{k}] \rangle$$, that is, $$G \cong H[\langle [u_{1}]\rangle , \langle [u_{2}]\rangle ,\ldots , \langle [u_{k}]\rangle ]$$ and each $$[u_{i}]$$ is an independent subset (that is, $$\langle [u_{i}]\rangle$$ has no edge) of G. Clearly, H is isomorphic to a subgraph of G induced by $$\{u_{1},u_{2},\ldots , u_{k}\}$$. Note that G is connected if and only if its reduced graph is connected.

The following result is a consequence of Proposition 1.

### Corollary 1

Let G be a connected graph and H be the reduced graph of G with $$V(H)=\{[u_{1}], [u_{2}], \ldots , [u_{k}]\}$$. Then

$$\mathcal{H}(G)=\frac{1}{4}\sum_{i=1}^{k} \bigl(\nu _{i}^{2}- \nu _{i}\bigr)+\sum _{1 \leq i< j \leq k} \nu _{i} \nu _{j} \frac{1}{d_{H}([u_{i}],[u_{j}])},$$

where $$\nu _{i}=| [u_{i}]|$$, for $$1\leq i\leq k$$.

### Proof

As $$G \cong H[\langle [u_{1}]\rangle , \langle [u_{2}]\rangle ,\ldots , \langle [u_{k}]\rangle ]$$ and $$|E(\langle [u_{i}]\rangle )|=0$$ for $$i=1,2,\ldots ,k$$, the result follows. □

The next result is an immediate consequence of Corollary 1.

### Corollary 2

Let $$G=K_{\nu _{1},\nu _{2},\ldots ,\nu _{k}}$$ be a complete k-partite graph. Then

\begin{aligned} \mathcal{H}(G)&= \frac{1}{4} \sum_{i=1}^{k} \bigl(\nu _{i}^{2}-\nu _{i}\bigr)+ \sum _{1 \leq i< j \leq k }\nu _{i}\nu _{j}. \end{aligned}

### Proof

As $$K_{\nu _{1},\nu _{2},\ldots ,\nu _{k}} \cong K_{k}[K_{\nu _{1}}^{c}, K_{ \nu _{2}}^{c}, \ldots , K_{\nu _{k}}^{c}]$$, we have $$d_{K_{k}}([u_{i}], [u_{j}])=1$$ and hence the result follows. □

### Example 1

Let $$G=K_{\nu _{1},\nu _{2},\ldots ,\nu _{k}}$$, where $$\nu _{i} = \nu$$ for $$1 \leq i \leq k$$. Then

\begin{aligned} \mathcal{H}(G) = \frac{1}{4} \bigl( 2k^{2} \nu ^{2} - k\nu -k\nu ^{2} \bigr). \end{aligned}

Using Proposition 1, we deduce the following results in [4].

### Corollary 3

(Theorem 3, [4])

Let $$G_{1}$$ and $$G_{2}$$ be the two graphs with $$|V(G_{i})|=\nu _{i}$$ and $$|E(G_{i})|=\varepsilon _{i}$$, for $$i=1,2$$. Then $$\mathcal{H}(G_{1} \vee G_{2}) = \frac{1}{2} (\nu _{1} \nu _{2} + \varepsilon _{1} + \varepsilon _{2} )+ \frac{1}{4} (\nu _{1}+ \nu _{2} ) (\nu _{1}+\nu _{2}-1 )$$.

### Proof

As $$K_{2}[G_{1},G_{2}] = G_{1} \vee G_{2}$$, the proof directly follows from Proposition 1. □

### Corollary 4

(Theorem 10, [4])

Let $$G_{1}$$ and $$G_{2}$$ be two connected graphs with $$|V(G_{i})|=\nu _{i}$$ and $$|E(G_{i})|=\varepsilon _{i}$$, for $$i=1,2$$. Then $$\mathcal{H}(G_{1}[G_{2}])= \frac{1}{4} \nu _{1}\nu _{2} (\nu _{2}-1) + \frac{1}{2}\nu _{1} \varepsilon _{2} +\nu _{2}^{2} \mathcal{H}(G_{1})$$.

### Proof

Clearly, the lexicographic product of $$G_{1}$$ and $$G_{2}$$ is the $$G_{1}$$-generalized join of $$H_{1},H_{2},\ldots ,H_{k}$$, where $$H_{i}\cong G_{2}$$, for $$1\leq i \leq k$$. So, $$G_{1}[G_{2}] \cong G_{1}[H_{1},H_{2},\ldots ,H_{k}]$$. By Proposition 1,

$$\mathcal{H}\bigl(G_{1}[G_{2}]\bigr)= \frac{\nu _{1}}{2} \biggl[ \binom{\nu _{2}}{2} + \varepsilon _{2} \biggr] + \nu _{2}^{2} \mathcal{H}(G_{1}).$$

Hence the result. □

We now observe that the generalized corona product of graphs, $$H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i}$$ can be realized as H-generalized join of some graphs.

Let $$H'$$ be a graph with $$V(H')=\{u_{1},u_{2},\ldots ,u_{\ell}\}$$ and $$G_{1},G_{2},\ldots ,G_{\ell}$$ be a family of graphs. We define a graph H with $$V(H)= V(H') \cup \{u_{\ell +1}, u_{\ell +2}, \ldots , u_{2\ell}\}$$ and $$E(H)=E(H') \cup \{u_{i}u_{\ell +i}: 1\leq i\leq \ell \}$$. From the definition of generalized corona product of graphs and H-generalized join of graphs, we have

### Note 1

$$H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i}\cong H[H_{1},H_{2}, \ldots , H_{\ell},H_{\ell +1},H_{\ell +2},\ldots ,H_{2\ell}]$$, where $$H_{i} \cong K_{1}$$ and $$H_{\ell +i} \cong G_{i}$$, for $$i = 1,2,\ldots ,\ell$$.

Using Proposition 1 and Note 1, we find a formula for the Harary index of generalized corona product of graphs.

### Theorem 1

Let $$H'$$ be a connected graph on vertices and $$G=H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i}$$, where $${G_{i}}$$ is a graph with $$|V(G_{i})| = \nu _{i}$$ and $$|E(G_{i})|= \varepsilon _{i}$$, for $$i = 1,2,\ldots ,\ell$$. Then

\begin{aligned} \mathcal{H}(G) ={}& \frac{1}{2} \sum_{1 \leq i \leq \ell} \biggl[\binom{\nu _{i}}{2} + \varepsilon _{i} \biggr] + \mathcal{H} \bigl(H'\bigr) + \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j} \frac{1}{d_{H'}(u_{i-\ell},u_{j-\ell})+ 2} \\ &{} + \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} \frac{1}{d_{H'}(u_{i},u_{j-\ell}) +1} + \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i = j-\ell}} \nu _{j}. \end{aligned}

### Proof

By Note 1, $$G= H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i} \cong H[H_{1},H_{2}, \ldots , H_{\ell},H_{\ell +1},H_{\ell +2},\ldots ,H_{2\ell}]$$, where $$H_{i} \cong K_{1}$$ and $$H_{\ell +i}= G_{i}$$ for $$i = 1,2,\ldots ,\ell$$ and also H is defined in the Note 1. Then it is easy to observe that

$$d_{G}(u,v) = \textstyle\begin{cases} d_{H'}(u_{i},u_{j}) & \text{if u \in V(H_{i}), v \in V(H_{j}), 1 \leq i < j \leq \ell ,} \\ 2 & \text{if u,v\in V(H_{i}), uv \notin E(H_{i}),\ell + 1 \leq i \leq 2\ell , } \\ d_{H'}(u_{i},u_{j-\ell})+1 & \text{if u \in V(H_{i}), v\in V(H_{j}), 1 \leq i \leq \ell , \ell + 1 \leq j \leq 2\ell ,} \\ d_{H'}(u_{i-\ell},u_{j-\ell})+2 & \text{if u\in V(H_{i}), v\in V(H_{j}), \ell +1 \leq i < j \leq 2\ell .} \end{cases}$$
(2.5)

Then

\begin{aligned} \mathcal{H}(G) ={}& \sum_{i=1}^{2\ell}\sum _{\{u,v\} \subseteq V(H_{i})} \frac{1}{d_{G}(u,v)}+ \sum _{1 \leq i < j \leq 2\ell} \sum_{ \stackrel{u\in V(H_{i})}{v \in V(H_{j})}}\frac{1}{d_{G}(u,v)} \\ ={}&\sum_{i=\ell +1}^{2\ell} \sum _{\{u,v\} \subseteq V(H_{i})} \frac{1}{d_{G}(u,v)} + \sum_{1\leq i < j \leq \ell} \sum_{ \stackrel{u\in V(H_{i})}{v \in V(H_{j})}}\frac{1}{d_{G}(u,v)} + \sum _{ \ell +1 \leq i < j \leq 2\ell}\sum_{ \stackrel{u\in V(H_{i})}{v \in V(H_{j})}} \frac{1}{d_{G}(u,v)} \\ &{}+ \sum_{\stackrel{1\leq i \leq \ell}{\ell +1 \leq j \leq 2\ell}} \sum_{\stackrel{u\in V(H_{i})}{v \in V(H_{j})}} \frac{1}{d_{G}(u,v)} \\ ={}& \sum_{\ell +1 \leq i \leq 2\ell} \frac{1}{2} \biggl[ \binom{\nu _{i}}{2} + \varepsilon _{i} \biggr] + \sum _{1 \leq i < j \leq \ell} \frac{1}{d_{H'}(u_{i},u_{j})} \\ &{}+ \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j} \frac{1}{d_{H'}(u_{i-\ell},u_{j-\ell})+ 2} + \sum_{ \stackrel{1 \leq i \leq \ell}{\ell +1 \leq j \leq 2\ell}} \nu _{j} \frac{1}{d_{H'}(u_{i},u_{j-\ell}) +1}, \\ & \text{by Proposition } 1 \text{ and Equation } (2.5). \\ ={}& \sum_{\ell +1 \leq i \leq 2\ell} \frac{1}{2} \biggl[ \binom{\nu _{i}}{2} + \varepsilon _{i} \biggr] + \mathcal{H} \bigl(H'\bigr) + \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j} \frac{1}{d_{H'}(u_{i-\ell},u_{j-\ell})+ 2} \\ &{}+ \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} \frac{1}{d_{H'}(u_{i},u_{j-\ell}) +1} + \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i = j-\ell}} \nu _{j}. \end{aligned}

Hence the result. □

By Theorem 1, we deduce the following result in [4].

### Corollary 5

(Theorem 4, [4])

Let $$H_{1}$$ and $$H_{2}$$ be the graphs with $$|V(H_{i})|=\nu _{i}$$ and $$|E(H_{i})|=\varepsilon _{i}$$, for $$i=1,2$$. Then the Harary index of the corona product of $$H_{1}$$ and $$H_{2}$$ is given by $$\mathcal{H}(H_{1} \circ H_{2}) = \mathcal{H}(H_{1}) + \nu _{2} \mathcal{H}_{1}(H_{1}) + \nu _{2}^{2} \mathcal{H}_{2}(H_{1}) + \frac{1}{4} (\nu _{2} +3)\nu _{1} \nu _{2} + \frac{1}{2} \nu _{1} \varepsilon _{2}$$, where $$\mathcal{H}_{1}(H_{1}) = \sum_{ \substack{\{u_{i},u_{j}\} \subseteq V(H_{1})\\ }} \frac{1}{d_{H_{1}}(u_{i},u_{j})+1}$$, $$\mathcal{H}_{2}(H_{1})= \sum_{ \substack{\{u_{i},u_{j} \} \subseteq V(H_{1})\\ }} \frac{1}{d_{H_{1}}(u_{i},u_{j})+2}$$ and $$u_{i}$$’s are the vertices of $$H_{1}$$.

### Proof

By the definition of corona product of $$H_{1}$$ and $$H_{2}$$, $$H_{1} \circ H_{2} = H_{1} \tilde{\circ} \bigwedge_{i= 1}^{ \nu _{1}} G_{i}$$, where $$G_{i}=H_{2}$$ for $$1 \leq i \leq \nu _{1}$$. By Theorem 1, we have

\begin{aligned} \mathcal{H}(H_{1} \circ H_{2}) ={}& \frac{\nu _{1}}{2} \biggl[\binom{\nu _{2}}{2} + \varepsilon _{2} \biggr] + \mathcal{H}(H_{1}) + \nu _{2}^{2} \sum _{\ell +1 \leq i < j \leq 2\ell} \frac{1}{d_{H_{1}}(u_{i-\nu _{1}},u_{j-\nu _{1}})+ 2} \\ &{}+ \nu _{2} \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\nu _{1}}} \frac{1}{d_{H_{1}}(u_{i},u_{j-\nu _{1}}) +1} + \nu _{1}\nu _{2} \\ ={}& \mathcal{H}(H_{1}) + \nu _{2} \mathcal{H}_{1}(H_{1}) + \nu _{2}^{2}\mathcal{H}_{2}(H_{1}) + \frac{1}{4} \bigl[\nu _{1}\nu _{2}( \nu _{2} -1) \bigr] \\ &{}+ \nu _{1} \nu _{2} + \frac{1}{2} \nu _{1} \varepsilon _{2}. \end{aligned}

Hence the result follows. □

### 2.2 Harary index of the ideal-based zero-divisor graph

In this subsection, we compute a formula for the Harary index of the ideal-based zero-divisor graph of a ring.

We recall some observations and results given in [3]. We define a relation $$\sim _{I}$$ on $$V(\Gamma _{I}(R))$$ as follows. For $$x,y \in V(\Gamma _{I}(R))$$, define $$x \sim _{I} y$$ if and only if $$\mathrm{Ann}(x:I)=\mathrm{Ann}(y:I)$$. Clearly, the relation $$\sim _{I}$$ is an equivalence relation on $$V(\Gamma _{I}(R))$$. Let $$A_{a_{1}},A_{a_{2}},\ldots ,A_{a_{k}}$$ be the equivalence classes of the relation $$\sim _{I}$$ with respective representatives are $$a_{1},a_{2},\ldots ,a_{k}$$.

### Observation 1

The subgraph $$\langle A_{a_{i}}\rangle$$ induced by $$A_{a_{i}}$$ of $$\Gamma _{I}(R)$$ is either complete or totally disconnected (that is, it has no edge). In fact, $$\langle A_{a_{i}} \rangle$$ is complete if and only if $$a_{i}^{2} \in I$$ and $$\langle A_{a_{i}}\rangle$$ is totally disconnected if and only if $$a_{i}^{2} \notin I$$.

The ideal-based compressed zero-divisor graph $$\Gamma _{I}^{E}(R)$$ of R is a graph with $$V(\Gamma _{I}^{E}(R))=\{a_{1},a_{2},\ldots ,a_{k}\}$$ and two distinct vertices $$a_{i}$$ and $$a_{j}$$ are adjacent if and only if $$a_{i}a_{j}\in I$$.

In [3], it is observed that, $$\Gamma _{I}(R)$$ is a $$\Gamma _{I}^{E}(R)$$-generalized join of $$\langle A_{a_{1}} \rangle , \langle A_{a_{2}} \rangle , \ldots , \langle A_{a_{k}} \rangle$$, that is,

$$\Gamma _{I}(R) \cong \Gamma _{I}^{E}(R) \bigl[\langle A_{a_{1}} \rangle , \langle A_{a_{2}} \rangle , \ldots ,\langle A_{a_{k}} \rangle \bigr]$$
(2.6)

and $$\Gamma _{I}^{E}(R)$$ is a connected subgraph of $$\Gamma _{I}(R)$$ induced by $$\{a_{1},a_{2},\ldots ,a_{k}\}$$.

We recall the following results in [3].

### Lemma 2

([3])

For $$x,y \in V(\Gamma _{I}(R))$$, $$x \sim _{I} y$$ in $$V(\Gamma _{I}(R))$$ if and only if $$\overline{x} \sim \overline{y}$$ in $$V(\Gamma (\frac{R}{I}))$$, where the relation is defined on $$V(\Gamma (\frac{R}{I}))$$ in the introduction.

### Lemma 3

([3])

Let $$a \in V(\Gamma _{I}^{E}(R))$$. If $$x\in A_{a}$$, then the co-set $$x+I \subseteq A_{a}$$. In particular, $$A_{a}$$ is the disjoint union of $$|A_{\overline{a}}|$$ co-sets of I and $$|A_{a}|=|A_{\overline{a}}||I|$$, where $$A_{\overline{a}}$$ is the equivalence class of under the relation defined on $$V(\Gamma (\frac{R}{I}))$$.

Now we are ready to give a formula for the Harary index of the ideal-based zero-divisor graph of a ring.

### Theorem 2

If I is an ideal of R and $$H=\Gamma _{I}^{E}(R)$$, then the Harary index of $$\Gamma _{I}(R)$$ is given by

\begin{aligned} \mathcal{H}\bigl(\Gamma _{I}(R)\bigr) ={}& \sum _{ \stackrel{1 \leq i \leq k}{a_{i}^{2} \in I}} \binom{ \vert A_{\overline{a_{i}}} \vert \vert I \vert }{2} + \frac{1}{2}\sum _{ \stackrel{1 \leq i \leq k}{ a_{i}^{2} \notin I}} \binom{ \vert A_{\overline{a_{i}}} \vert \vert I \vert }{2} \\ &{}+ \vert I \vert ^{2} \sum_{\stackrel{1\leq i < j \leq k}{}} \vert A_{ \overline{a_{i}}} \vert \vert A_{\overline{a_{j}}} \vert \frac{1}{d_{H}(a_{i},a_{j})}, \end{aligned}

where $$a_{i}$$’s are the vertices of H.

### Proof

Let $$G = \Gamma _{I}(R)$$. Then

\begin{aligned} \mathcal{H}\bigl(\Gamma _{I}(R)\bigr) = \sum _{i=1}^{k} \sum_{ \substack{ \{u,v\}\subseteq A_{a_{i}}}} \frac{1}{d_{G}(u,v)} + \sum_{ \substack{1\leq i< j\leq k}} \sum _{ \substack{u\in A_{a_{i}} \\ v \in A_{a_{j}}}} \frac{1}{d_{G}(u,v)}. \end{aligned}
(2.7)

Note that the first term of Equation (2.7) is divided into two terms, that is

\begin{aligned} \sum_{i=1}^{k} \sum _{\{u,v\} \subseteq A_{a_{i}}} \frac{1}{d_{G}(u,v)} = \sum_{ \stackrel{1 \leq i \leq k}{a_{i}^{2} \in I}} \sum_{ \substack{ \{u,v\}\subseteq A_{a_{i}}}} \frac{1}{d_{G}(u,v)}+ \sum _{ \stackrel{1 \leq i \leq k}{a_{i}^{2} \notin I}} \sum_{ \substack{ \{u,v\}\subseteq A_{a_{i}}}} \frac{1}{d_{G}(u,v)} . \end{aligned}

By Observation 1, it is clear that

\begin{aligned} d_{G}(u,v) = \textstyle\begin{cases} 1 & \text{if u,v\in A_{a_{i}}, a_{i}^{2} \in I ,} \\ 2 & \text{if u,v\in A_{a_{i}}, a_{i}^{2} \notin I,} \\ d_{H}(a_{i},a_{j}) & \text{if u\in A_{a_{i}}, v\in A_{a_{j}}, i \neq j. } \end{cases}\displaystyle \end{aligned}
(2.8)

Therefore

\begin{aligned} \mathcal{H}\bigl(\Gamma _{I}(R)\bigr) = \sum _{ \stackrel{1 \leq i \leq k}{a_{i}^{2} \in I}} \binom{ \vert A_{a_{i}} \vert }{2} + \frac{1}{2}\sum _{\stackrel{1 \leq i \leq k}{ a_{i}^{2} \notin I}} \binom{ \vert A_{a_{i}} \vert }{2} +\sum_{\stackrel{1\leq i < j \leq k}{}} \vert A_{a_{i}} \vert \vert A_{a_{j}} \vert \frac{1}{d_{H}(a_{i},a_{j})}. \end{aligned}

Hence by Lemma 3, the result follows. □

In particular, if $$I=(0)$$ is the zero ideal of R, then the following result gives a formula for the Harary index of the zero-divisor graph of R.

### Corollary 6

Let R be a ring and $$H = \Gamma ^{E}(R)$$. Then

$$\mathcal{H}\bigl(\Gamma (R)\bigr) =\sum_{ \stackrel{1 \leq i \leq k}{a_{i}^{2} =0}} \binom { \vert A_{a_{i}} \vert }{2} + \frac{1}{2}\sum_{\stackrel{1 \leq i \leq k}{a_{i}^{2}\neq 0}} \binom { \vert A_{a_{i}} \vert }{2} + \sum_{1 \leq i< j \leq k} \vert A_{a_{i}} \vert \vert A_{a_{j}} \vert \frac{1}{d_{H}(a_{i},a_{j})},$$

where $$a_{i}$$’s are the vertices of H.

### Proof

If $$I=(0)$$, then $$|I|=1$$ and $$\Gamma _{I}(R)\cong \Gamma (R)$$. Hence by Lemma 3, $$|A_{\overline{a_{i}}}|=|A_{a_{i}}|$$, for $$1\leq i\leq k$$. Therefore, the result follows from Theorem 2. □

### 2.3 Harary index of $$\Gamma _{I}(\mathbb{Z}_{n})$$

In this subsection, we find the Harary index of $$\Gamma _{I}(\mathbb{Z}_{n})$$ and $$\Gamma (\mathbb{Z}_{n})$$, where $$\mathbb{Z}_{n}$$ is the ring of integers modulo n.

Let $$n=p_{1}^{\alpha _{1}}p_{2}^{\alpha _{2}}\cdots p_{k}^{\alpha _{k}}$$ be a composite number and $$m=p_{1}^{\gamma _{1}}p_{2}^{\gamma _{2}}\cdots p_{k}^{\gamma _{k}}$$ be a proper divisor of n, where $$p_{i}$$’s are distinct prime numbers. If I is an ideal of $$\mathbb{Z}_{n}$$ generated by the element m, then it is well known that, the quotient ring $$\frac{\mathbb{Z}_{n}}{I} \cong Z_{m}$$.

It is observed in [3] that $$\Gamma _{I}^{E}(\mathbb{Z}_{n}) \cong \Gamma ^{E}( \frac{\mathbb{Z}_{n}}{I}) \cong \Gamma ^{E}(\mathbb{Z}_{m})$$. Also, it is proved in [20] that $$a\in V(\Gamma ^{E}(\mathbb{Z}_{m}))$$ if and only if a is a proper divisor of m. For $$a \in V(\Gamma ^{E}(\mathbb{Z}_{m}))$$, we define $$S(a)=\{k\in \mathbb{Z}_{m}: gcd(k,m)=a\}$$, where $$gcd(k,m)$$ is the greatest common divisor of integers k and m.

We recall the following results in [3, 18, 20].

### Proposition 2

([20])

For a proper divisor a of m, $$|S(a)|=\phi (\frac{m}{a})$$, where ϕ denotes Euler’s totient function.

### Lemma 4

([3])

For $$a\in V(\Gamma ^{E}(\mathbb{Z}_{m}))$$, $$|A_{a}|=\phi (\frac{m}{a})|I|$$.

### Lemma 5

([18])

Let $$a_{i},a_{j}\in V(\Gamma ^{E}(\mathbb{Z}_{m}))$$ with $$i\neq j$$ and $$H= \Gamma ^{E}(\mathbb{Z}_{m})$$. Then

$$d_{H}(a_{i},a_{j}) \in \{1,2,3\}$$, for all $$a_{i},a_{j}\in V(\Gamma ^{E}(\mathbb{Z}_{m})), i \neq j$$.

(i) $$m | a_{i}a_{j} \Leftrightarrow d_{H}(a_{i},a_{j})=1 \Leftrightarrow a_{i}a_{j} \in E(\Gamma ^{E}( \mathbb{Z}_{m}))$$.

(ii) $$m \nmid a_{i}a_{j}$$ and $$gcd(a_{i},a_{j})\neq 1\Leftrightarrow d_{H}(a_{i},a_{j})=2$$.

(iii) $$m \nmid a_{i}a_{j}$$ and $$gcd(a_{i},a_{j})=1\Leftrightarrow d_{H}(a_{i},a_{j})=3$$.

It is observed in [3] that $$\Gamma _{I}(\mathbb{Z}_{n}) \cong \Gamma ^{E}(\mathbb{Z}_{m})[ \langle A_{a_{1}} \rangle , \langle A_{a_{2}} \rangle ,\ldots , \langle A_{a_{k}} \rangle ]$$.

Using the above results, we find the Harary index of $$\Gamma _{I}(\mathbb{Z}_{n})$$.

### Theorem 3

If I is an ideal of $$\mathbb{Z}_{n}$$ generated by m, then the Harary index of $$\Gamma _{I}(\mathbb{Z}_{n})$$is given by

\begin{aligned} \mathcal{H}\bigl(\Gamma _{I}(\mathbb{Z}_{n})\bigr)={}&\sum _{ \stackrel{}{m | a_{i}^{2}}} \binom {\phi (\frac{m}{a_{i}} ) \vert I \vert }{2} + \frac{1}{2}\sum _{ \stackrel{}{m\nmid a_{i}^{2}}} \binom {\phi (\frac{m}{a_{i}} ) \vert I \vert }{2} + \vert I \vert ^{2} \biggl[ \sum_{ \stackrel{}{m | a_{i}a_{j}}} \phi \biggl( \frac{m}{a_{i}} \biggr)\phi \biggl(\frac{m}{a_{j}} \biggr) \\ &{}+\frac{1}{2}\sum_{ \stackrel{m\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})\neq 1}} \phi \biggl( \frac{m}{a_{i}}\biggr)\phi \biggl(\frac{m}{a_{j}} \biggr) + \frac{1}{3}\sum_{ \stackrel{m\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})= 1}} \phi \biggl( \frac{m}{a_{i}} \biggr)\phi \biggl(\frac{m}{a_{j}} \biggr) \biggr], \end{aligned}

where $$a_{i}$$’s are the proper divisors of m.

### Proof

Note that if $$a | m$$, then $$m | a^{2}$$ if and only if $$a^{2}$$ is the 0th element of $$\mathbb{Z}_{m}$$. Hence the result follows from Theorem 2, Lemmas 4 and 5. □

As the zero ideal $$I =(0)$$ of $$\mathbb{Z}_{n}$$ is generated by the 0th element n of $$\mathbb{Z}_{n}$$, we have the following result.

### Corollary 7

The Harary index of $$\Gamma (\mathbb{Z}_{n})$$ is

\begin{aligned} \mathcal{H}\bigl(\Gamma (\mathbb{Z}_{n})\bigr)={}& \sum _{ \stackrel{}{n | a_{i}^{2}}}\binom {\phi (\frac{n}{a_{i}})}{2} + \frac{1}{2}\sum _{\stackrel{}{n\nmid a_{i}^{2}}} \binom {\phi (\frac{n}{a_{i}})}{2} + \sum_{ n | a_{i}a_{j}} \phi \biggl(\frac{n}{a_{i}} \biggr)\phi \biggl(\frac{n}{a_{j}} \biggr) \\ &{}+ \frac{1}{2}\sum_{ \stackrel{ n\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})\neq 1}} \phi \biggl( \frac{n}{a_{i}} \biggr)\phi \biggl(\frac{n}{a_{j}} \biggr) + \frac{1}{3}\sum_{ \stackrel{ n\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})= 1}} \phi \biggl( \frac{n}{a_{i}} \biggr)\phi \biggl(\frac{n}{a_{j}} \biggr), \end{aligned}

where $${a_{i}}$$’s are the proper divisors of n.

### Proof

Clearly, the zero ideal $$I=(0)$$ is generated by the 0th element $$n=p_{1}^{\alpha _{1}}p_{2}^{\alpha _{2}}\ldots p_{k}^{\alpha _{k}}(=m)$$. As $$\Gamma _{I}(\mathbb{Z}_{n})\cong \Gamma (\mathbb{Z}_{n})$$ and by Theorem 3, the result follows. □

## 3 Hyper-Wiener index of H-generalized join of graphs

In this section, we find a formula for the hyper-Wiener index of H-generalized join of graphs. We first recall the following result in [3].

### Proposition 3

([3])

Let $$G_{1},G_{2},\ldots ,G_{k}$$ be the graphs with $$|V(G_{i})|=\nu _{i}$$ and $$|E(G_{i})|=\varepsilon _{i}$$, for $$i = 1,2,\ldots ,k$$. Let H be a connected graph with $$V(H)=\{x_{1},x_{2},\ldots ,x_{k}\}$$ and $$G=H[G_{1},G_{2},\ldots ,G_{k}]$$. Then the Wiener index of G is given by

\begin{aligned} W(G)=\sum_{i=1}^{k} \biggl[ 2 \binom {\nu _{i}}{2} - \varepsilon _{i} \biggr] + \sum _{1 \leq i< j \leq k} \nu _{i}\nu _{j}d_{H}(x_{i},x_{j}). \end{aligned}

The following result yields a formula for the hyper-Wiener index of H-generalized join of graphs.

### Proposition 4

Let H be a connected graph with $$V(H)= \{u_{1},u_{2},\ldots ,u_{k}\}$$. Let $$G_{1},G_{2},\ldots ,G_{k}$$ be a collection of graphs with $$|V(G_{i})|= \nu _{i}$$, $$|E(G_{i})|= \varepsilon _{i}$$, for $$i= 1,2,\ldots ,k$$ and $$G=H[G_{1},G_{2}, \ldots ,G_{k}]$$. Then the hyper-Wiener index of G is given by

\begin{aligned} WW(G) =\frac{3}{2} \sum_{i=1}^{k} \biggl( {\nu _{i}}^{2} -\nu _{i} - \frac{4}{3}\varepsilon _{i} \biggr) + \frac{1}{2}\sum _{1 \leq i< j \leq k} \nu _{i}\nu _{j} \bigl[d_{H}(u_{i},u_{j})+ d_{H}^{2}(u_{i},u_{j}) \bigr]. \end{aligned}
(3.1)

### Proof

By Proposition 3, it is enough to find $$\sum_{ \{u,v\} \subseteq V(G)} d_{G}^{2}(u,v)$$. Note that, let $$u,v \in V(G_{i})$$. If $$uv \notin E(G_{i})$$, then $$d_{G}(u,v)=2$$ and if $$u\in V(G_{i})$$, $$v\in V(G_{j})$$, with $$i \neq j$$, then $$d_{G}(u,v)=d_{H}(u_{i},u_{j})$$. Therefore

\begin{aligned} \sum_{ \{u,v\} \subseteq V(G)} d_{G}^{2}(u,v) &= \sum_{i=1}^{k} \sum _{\stackrel{\{u,v \} \subseteq V(G_{i})}{}} d_{G}^{2}(u,v) + \sum _{\stackrel{1\leq i < j \leq k}{}}\sum_{ \stackrel{u\in V(G_{i})}{v \in V(G_{j})}} d_{G}^{2}(u,v) \\ & = \sum_{i=1}^{k} \biggl[ 4 \binom {\nu _{i}}{2} - 3\varepsilon _{i} \biggr] + \sum _{1 \leq i < j \leq k}\nu _{i}\nu _{j} d_{H}^{2}(u_{i},u_{j}). \end{aligned}

Hence the result follows. □

The following results are a direct consequence of Proposition 4.

### Corollary 8

Let G be a connected graph and H be the reduced graph of G with $$V(H)= \{[u_{1}], [u_{2}],\ldots , [u_{k}]\}$$. Then

$$WW(G)=\frac{3}{2}\sum_{i=1}^{k} \bigl({\nu _{i}}^{2} -\nu _{i}\bigr) + \frac{1}{2}\sum_{1 \leq i< j \leq k} \nu _{i}\nu _{j} \bigl[d_{H}\bigl([u_{i}],[u_{j}] \bigr)+d^{2}_{H}\bigl([u_{i}],[u_{j}] \bigr) \bigr],$$

where $$\nu _{i}=|[u_{i}]|$$, for $$1\leq i\leq k$$.

### Proof

As $$\varepsilon _{i}=|E(\langle [u_{i}]\rangle )|=0$$ for $$1\leq i\leq k$$, the result follows from Proposition 4. □

### Corollary 9

Let $$G=K_{\nu _{1},\nu _{2},\ldots ,\nu _{k}}$$ be a complete k-partite graph. Then

\begin{aligned} WW(G)&= \frac{3}{2} \sum_{i=1}^{k} \bigl(\nu _{i}^{2}-\nu _{i}\bigr) + \sum _{1 \leq i< j \leq k }\nu _{i}\nu _{j}. \end{aligned}

In particular, $$WW(G) = \frac{5}{4} \sum_{i=1}^{k} (\nu _{i}^{2} - \nu _{i}) + \mathcal{H}(G)$$.

### Proof

As $$K_{\nu _{1},\nu _{2},\ldots ,\nu _{k}} \cong K_{k}[K_{\nu _{1}}^{c}, K_{ \nu _{2}}^{c}, \ldots , K_{\nu _{k}}^{c}]$$, we have $$d_{K_{k}}([u_{i}], [u_{j}])=1$$ and hence the result follows. □

The following results in [8] are a direct consequence of Proposition 4.

### Corollary 10

(Theorem 3, [8])

Let H and G be connected graphs with $$|V(H)|= \nu _{1}$$, $$|E(H)|=\varepsilon _{1}$$, $$|V(G)|=\nu _{2}$$ and $$|E(G)|=\varepsilon _{2}$$. Then

\begin{aligned} WW\bigl(H[G]\bigr)& = \nu _{2}^{2} WW(H)+\frac{3}{2} \nu _{1} \biggl[ \nu _{2}^{2}- \nu _{1} \nu _{2}- \frac{4}{3}\varepsilon _{2} \biggr]. \end{aligned}

### Proof

Let $$V(H)= \{u_{1}, u_{2}, \ldots , u_{\nu _{1}}\}$$ and $$G_{1}, G_{2}, \ldots G_{\nu _{1}}$$ be a collection of $$\nu _{1}$$ graphs with $$|V(G_{i})|=n_{i}, |E(G_{i})|=m_{i}$$, for $$1\leq i\leq \nu _{1}$$. Clearly, $$H[G] \cong H[G_{1},G_{2},\ldots ,G_{\nu _{1}}]$$, where $$G \cong G_{i}$$, for $$1 \leq i \leq \nu _{1}$$. Therefore, $$n_{i}=\nu _{2}$$ and $$m_{i}=\varepsilon _{2}$$, for $$i=1,2,\dots ,\nu _{1}$$. By Proposition 4,

\begin{aligned} WW\bigl(H[G]\bigr) ={}&\frac{1}{2} \Biggl[ \sum _{i=1}^{\nu _{1}} \biggl[ 2 \binom {n_{i}}{2} - m_{i} \biggr] + \sum_{1 \leq i< j \leq \nu _{1}} n_{i}n_{j} d_{H}(u_{i},u_{j}) \Biggr] \\ &{}+ \frac{1}{2} \Biggl[ \sum_{i=1}^{\nu _{1}} \biggl[4 \binom {n_{i}}{2} - 3 m_{i} \biggr] + \sum _{1 \leq i < j \leq \nu _{1}} n_{i}n_{j} d_{H}^{2}(u_{i},u_{j}) \Biggr]. \end{aligned}

Hence the result follows. □

### Corollary 11

(Theorem 2, [8])

Let G and H be the graphs with $$|V(G)|=\nu _{1}$$, $$|E(G)|=\varepsilon _{1}$$, $$|V(H)|= \nu _{2}$$ and $$|E(H)|= \varepsilon _{2}$$. Then

\begin{aligned} WW(G \vee H)=\frac{3}{2} \nu _{1}^{2}+ \frac{3}{2} \nu _{2}^{2}-2 \varepsilon _{2}-2 \varepsilon _{1} -\frac{3}{2} \nu _{1}- \frac{3}{2} \nu _{2}+ \nu _{1} \nu _{2}. \end{aligned}

### Proof

As $$K_{2}[G,H]= G \vee H$$, the proof directly follows from Proposition 4. □

Next, let us find the hyper-Wiener index of generalized corona product of graphs.

### Theorem 4

Let $$H'$$ be a connected graph on vertices and $$G=H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i}$$, where $${G_{i}}$$ is a graph with $$|V(G_{i})| = \nu _{i}$$ and $$|E(G_{i})|= \varepsilon _{i}$$, for $$i = 1,2,\ldots ,\ell$$. Then the hyper-Wiener index of G is given by

\begin{aligned} WW(G) ={}& \frac{3}{2} \sum_{1 \leq i \leq \ell} \biggl[ { \nu _{i}}^{2} -\nu _{i} - \frac{4}{3} \varepsilon _{i} \biggr]+ WW\bigl(H'\bigr) + \frac{3}{2}\sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} d_{H'}(u_{i},u_{j-\ell}) \\ &{}+ \frac{1}{2} \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} d^{2}_{H'}(u_{i},u_{j-\ell}) + \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} + \sum _{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i = j-\ell}} \nu _{j} \\ &{}+ \frac{1}{2}\sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i} \nu _{j}d^{2}_{H'}(u_{i- \ell},u_{j-\ell}) + \frac{5}{2}\sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j}d_{H'}(u_{i-\ell},u_{j-\ell}) \\ &{}+ 3\sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j} . \end{aligned}

### Proof

By Note 1, we have $$G= H' \tilde{\circ} \bigwedge_{i=1}^{\ell} G_{i} \cong H[H_{1},H_{2}, \ldots , H_{\ell},H_{\ell +1},H_{\ell +2},\ldots ,H_{2\ell}]$$, where $$H_{i} \cong K_{1}$$ and $$H_{\ell +i}= G_{i}$$ for $$i = 1,2,\ldots ,\ell$$ and also H is defined in the Note 1. Then the first term of Equation (3.1) in Proposition 4 is equal to $$\frac{3}{2} \sum_{1 \leq i \leq \ell} [ {\nu _{i}}^{2} -\nu _{i} - \frac{4}{3}\varepsilon _{i} ]$$ and the second term of the Equation (3.1) is

\begin{aligned} &\frac{1}{2} \sum_{1 \leq i < j \leq 2\ell} \nu _{i} \nu _{j} \bigl[d_{G}(u_{i},u_{j})+ d_{G}^{2}(u_{i},u_{j}) \bigr] \\ &\quad = \frac{1}{2} \biggl[ \sum_{ \substack{1 \leq i < j \leq \ell}} \bigl[d_{G}(u_{i},u_{j})+ d_{G}^{2}(u_{i},u_{j}) \bigr] \\ &\qquad{}+ \sum_{\substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell}} \nu _{j} \bigl[d_{G}(u_{i},u_{j})+ d_{G}^{2}(u_{i},u_{j}) \bigr] + \sum_{ \substack{\ell +1 \leq i < j \leq 2\ell}} \nu _{i}\nu _{j} \bigl[d_{G}(u_{i},u_{j})+ d_{G}^{2}(u_{i},u_{j}) \bigr] \biggr] \\ &\quad= \frac{1}{2} \biggl[\sum_{\substack{1 \leq i < j \leq \ell}} \bigl[d_{H'}(u_{i},u_{j})+ d^{2}_{H'}(u_{i},u_{j}) \bigr] \\ & \qquad{}+ \sum_{\substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell}} \nu _{j} \bigl[d_{H'}(u_{i},u_{j-\ell})+1)+ \bigl(d_{H'}(u_{i},u_{j-\ell})+1\bigr)^{2} \bigr] \\ & \qquad{}+ \sum_{\substack{\ell +1 \leq i < j \leq 2\ell}} \nu _{i}\nu _{j} \bigl[\bigl(d_{H'}(u_{i-\ell},u_{j-\ell})+2 \bigr)+ \bigl(d_{H'}(u_{i-\ell},u_{j-\ell})+2 \bigr)^{2} \bigr] \biggr] \\ &\quad\text{by Equation (2.5)}. \end{aligned}
(3.2)

Therefore

\begin{aligned} WW(G) ={}& \frac{3}{2} \sum_{1 \leq i \leq \ell} \biggl( { \nu _{i}}^{2} -\nu _{i} - \frac{4}{3} \varepsilon _{i} \biggr) + \frac{1}{2} \biggl(\sum _{1 \leq i < j \leq \ell} d_{H'}(u_{i},u_{j})+ \sum_{1 \leq i < j \leq \ell} d^{2}_{H'}(u_{i},u_{j}) \\ &{}+ \sum_{\stackrel{1 \leq i \leq \ell}{\ell +1 \leq j \leq 2\ell}} \nu _{j} \bigl[d_{H'}(u_{i},u_{j-\ell}) +1\bigr]+ \sum _{ \stackrel{1 \leq i \leq \ell}{\ell +1 \leq j \leq 2\ell}} \nu _{j} {\bigl(d_{H'}(u_{i},u_{j- \ell}) +1\bigr)}^{2} \\ &{}+ \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j} \bigl[d_{H'}(u_{i- \ell},u_{j-\ell})+ 2 \bigr]+ \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i} \nu _{j} {\bigl[d_{H'}(u_{i-\ell},u_{j-\ell})+ 2 \bigr]}^{2} \biggr) \\ ={}& \frac{3}{2} \sum_{\ell +1 \leq i \leq 2\ell} \biggl[ { \nu _{i}}^{2} -\nu _{i} - \frac{4}{3} \varepsilon _{i} \biggr] + WW\bigl(H'\bigr)\\ &{}+ \frac{1}{2} \biggl( \biggl[ \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} d_{H'}(u_{i},u_{j-\ell}) + \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} + \sum _{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i = j-\ell}} \nu _{j} \biggr] \\ &{}+ \biggl[\sum _{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} d^{2}_{H'}(u_{i},u_{j-\ell}) + 2 \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} d_{H'}(u_{i},u_{j-\ell}) \\ &{}+ \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} \nu _{j} + \sum _{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i = j-\ell}} \nu _{j} \biggr] + \biggl[\sum _{\ell +1 \leq i < j \leq 2\ell} \nu _{i} \nu _{j}d_{H'}(u_{i-\ell},u_{j-\ell}) + 2 \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j} \biggr] \\ &{}+ \biggl[ \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i}\nu _{j} d^{2}_{H'}(u_{i- \ell},u_{j-\ell}) + 4 \sum_{\ell +1 \leq i < j \leq 2\ell} \nu _{i} \nu _{j} d_{H'}(u_{i-\ell},u_{j-\ell}) \\ &{}+4 \sum_{\ell +1 \leq i < j \leq 2\ell}\nu _{i}\nu _{j} \biggr] \biggr). \end{aligned}

Hence the result. □

The following result is a direct consequence of Theorem 4.

### Corollary 12

If $$H_{1}$$ and $$H_{2}$$ are two graphs with $$|V(H_{i})|=\nu _{i}$$ and $$|E(H_{i})| = \varepsilon _{i}$$ for $$i=1,2$$, then the hyper-Wiener index, $$WW(H_{1} \circ H_{2})$$, of the corona product of $$H_{1}$$ and $$H_{2}$$ is given by

$$WW(H_{1})(1+\nu _{2})^{2} + \frac{3}{2}\nu _{1} [{\nu _{2}}^{2} - \nu _{2} -\frac{4}{3} \varepsilon _{2} ]+ \nu _{2} [2W(H_{1})(1+ \nu _{2}) + ({\nu _{1}}^{2} -\nu _{1})(1+ \frac{3}{2}\nu _{2}) + \nu _{1} ]$$.

### Proof

By the definition of the corona product of $$H_{1}$$ and $$H_{2}$$, $$H_{1} \circ H_{2} = H_{1} \tilde{\circ} \bigwedge_{i= 1}^{ \nu _{1}} G_{i}$$, where $$G_{i}=H_{2}$$ for $$1 \leq i \leq \nu _{1}$$. By Theorem 4, we have

\begin{aligned} WW(H_{1} \circ H_{2}) ={}& 3\nu _{1} \binom{\nu _{2}}{2} -2\nu _{1} \varepsilon _{1} + WW(H_{1}) + \frac{3}{2} \nu _{2} \bigl[2W(H_{1})\bigr] \\ &{}+ \frac{\nu _{2}}{2} \sum_{ \substack{1 \leq i \leq \ell \\ \ell +1 \leq j \leq 2\ell \\ i \neq j-\ell}} d^{2}_{H_{1}}(u_{i},u_{j-\ell}) + \bigl({\nu _{1}}^{2} -\nu _{1}\bigr) \nu _{2} + \nu _{1}\nu _{2} \\ &{}+ \frac{1}{2} {\nu _{2}}^{2}\sum _{\ell +1 \leq i < j \leq 2\ell} d^{2}_{H_{1}}(u_{i- \ell},u_{j-\ell}) \\ &{}+ \frac{5}{2}{\nu _{2}}^{2}\sum _{\ell +1 \leq i < j \leq 2\ell}d_{H_{1}}(u_{i- \ell},u_{j-\ell}) + 3 \nu _{2}^{2}\binom{\nu _{1}}{2}. \end{aligned}

Hence the result follows. □

### 3.1 Hyper-Wiener index of an ideal-based zero-divisor graph

In this subsection, we give a formula for the hyper-Wiener index of the ideal-based zero-divisor graph of ring.

### Theorem 5

If I is an ideal of R and $$H=\Gamma _{I}^{E}(R)$$, then the hyper-Wiener index of $$\Gamma _{I}(R)$$ is given by

\begin{aligned} WW\bigl(\Gamma _{I}(R)\bigr) ={}& \sum_{ \stackrel{1 \leq i \leq k}{ a_{i}^{2} \in I}} \binom{ \vert A_{\overline{a_{i}}} \vert \vert I \vert }{2} + 3 \sum_{ \stackrel{1 \leq i \leq k}{ a_{i}^{2} \notin I}} \binom{ \vert A_{\overline{a_{i}}} \vert \vert I \vert }{2} \\ &{}+\frac{1}{2} \vert I \vert ^{2} \biggl(\sum _{ \stackrel{1\leq i < j \leq k}{}} \vert A_{\overline{a_{i}}} \vert \vert A_{ \overline{a_{j}}} \vert \bigl[ d_{H}(a_{i},a_{j}) + d^{2}_{H}(a_{i},a_{j}) \bigr] \biggr), \end{aligned}

where $$a_{i}$$’s are the vertices of H.

### Proof

Let $$G = \Gamma _{I}(R)$$. By Equation (2.6), we have $$G \cong \Gamma _{I}^{E}(R)[\langle A_{a_{1}} \rangle , \langle A_{a_{2}} \rangle , \ldots ,\langle A_{a_{k}} \rangle ]$$. Then

\begin{aligned} WW(G) = {}&\frac{1}{2} \biggl[\sum _{\stackrel{1 \leq i \leq k}{}} \sum_{ \substack{ \{u,v\}\subseteq A_{a_{i}}}} \bigl[d_{G}(u,v)+d^{2}_{G}(u,v) \bigr] \biggr] \\ &{}+ \frac{1}{2} \biggl[ \sum_{\substack{1\leq i< j\leq k}} \sum _{ \substack{u\in A_{a_{i}} \\ v \in A_{a_{j}}}} \bigl[d_{G}(u,v)+d^{2}_{G}(u,v) \bigr] \biggr]. \end{aligned}
(3.3)

Note that the first term of the Equation (3.3) is divided into two terms, that is

\begin{aligned} \frac{1}{2} \biggl[\sum_{\stackrel{1 \leq i \leq k}{a_{i}^{2} \in I}} \sum _{\substack{ \{u,v\}\subseteq A_{a_{i}}}} \bigl[d_{G}(u,v)+ d^{2}_{G}(u,v) \bigr] +\sum_{\stackrel{1 \leq i \leq k}{a_{i}^{2} \notin I}} \sum _{ \substack{ \{u,v\}\subseteq A_{a_{i}}}} \bigl[d_{G}(u,v)+d^{2}_{G}(u,v) \bigr] \biggr]. \end{aligned}

By Observation 1 and Lemma 3, we have

\begin{aligned} WW\bigl(\Gamma _{I}(R)\bigr) = {}&\sum_{ \stackrel{1 \leq i \leq k}{ a_{i}^{2} \in I}} \binom{ \vert A_{\overline{a_{i}}} \vert \vert I \vert }{2} + 3 \sum_{ \stackrel{1 \leq i \leq k}{ a_{i}^{2} \notin I}} \binom{ \vert A_{\overline{a_{i}}} \vert \vert I \vert }{2} \\ &{}+\frac{1}{2} \sum_{\substack{1\leq i< j\leq k}} \sum _{ \substack{u\in A_{a_{i}} \\ v \in A_{a_{j}}}} \bigl[d_{G}(u,v)+ d^{2}_{G}(u,v) \bigr]. \end{aligned}

Hence the result follows. □

In particular, if $$I=(0)$$ is the zero ideal of R, then we have the following result.

### Corollary 13

If R is a ring and $$H=\Gamma ^{E}(R)$$, then

\begin{aligned} WW\bigl(\Gamma (R)\bigr) ={}& \sum_{ \stackrel{1 \leq i \leq k}{ a_{i}^{2} = 0}} \binom{ \vert A_{a_{i}} \vert }{2} + 3 \sum_{\stackrel{1 \leq i \leq k}{ a_{i}^{2} \neq 0}} \binom{ \vert A_{a_{i}} \vert }{2} \\ &{} +\frac{1}{2} \biggl(\sum_{ \stackrel{1\leq i < j \leq k}{}} \vert A_{a_{i}} \vert \vert A_{a_{j}} \vert \bigl[ d_{H}(a_{i},a_{j}) + d^{2}_{H}(a_{i},a_{j}) \bigr] \biggr), \end{aligned}

where $$a_{i}$$’s are the vertices of H.

### Proof

If $$I=(0)$$, then $$|I|=1$$ and $$\Gamma _{I}(R)\cong \Gamma (R)$$. Hence by Lemma 3, $$|A_{\overline{a_{i}}}|=|A_{a_{i}}|$$, for $$1\leq i\leq k$$. Therefore, the result follows from Theorem 5. □

The next result gives the hyper-Wiener index of the ideal-based zero-divisor graph of the ring of integers modulo n.

### Theorem 6

If I is an ideal of $$\mathbb{Z}_{n}$$ generated by m, then

\begin{aligned} WW\bigl(\Gamma _{I}(\mathbb{Z}_{n})\bigr) ={}&\sum _{\stackrel{}{m | a_{i}^{2}}} \binom {\phi (\frac{m}{a_{i}} ) \vert I \vert }{2} + 3\sum _{ \stackrel{}{m\nmid a_{i}^{2}}} \binom {\phi (\frac{m}{a_{i}} ) \vert I \vert }{2} + \vert I \vert ^{2} \biggl( \sum_{ \stackrel{}{m | a_{i}a_{j}}} \phi \biggl(\frac{m}{a_{i}} \biggr)\phi \biggl(\frac{m}{a_{j}} \biggr) \\ &{} +3\sum_{\stackrel{m\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})\neq 1}} \phi \biggl( \frac{m}{a_{i}} \biggr)\phi \biggl(\frac{m}{a_{j}} \biggr) +6\sum_{ \stackrel{m\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})= 1}} \phi \biggl( \frac{m}{a_{i}} \biggr)\phi \biggl(\frac{m}{a_{j}} \biggr) \biggr), \end{aligned}

where $$a_{i}$$’s are the proper divisors of m.

### Proof

Note that if $$a | m$$, then $$m | a^{2}$$ if and only if $$a^{2}$$ is the 0th element of $$\mathbb{Z}_{m}$$. Hence the result follows from Theorem 5, Lemmas 4 and 5. □

As the zero ideal $$I =(0)$$ of $$\mathbb{Z}_{n}$$ is generated by the 0th element n of $$\mathbb{Z}_{n}$$, we deduce the following result.

### Corollary 14

The hyper-Wiener index of $$\Gamma (\mathbb{Z}_{n})$$ is

\begin{aligned} WW\bigl(\Gamma (\mathbb{Z}_{n})\bigr) ={}&\sum _{\stackrel{}{n | a_{i}^{2}}} \binom {\phi (\frac{n}{a_{i}} )}{2} + 3\sum _{ \stackrel{}{n \nmid a_{i}^{2}}} \binom {\phi (\frac{n}{a_{i}} )}{2} + \sum_{ \stackrel{}{n | a_{i}a_{j}}} \phi \biggl(\frac{n}{a_{i}} \biggr)\phi \biggl(\frac{n}{a_{j}} \biggr) \\ & {}+3\sum_{\stackrel{n\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})\neq 1}} \phi \biggl( \frac{n}{a_{i}} \biggr)\phi \biggl(\frac{n}{a_{j}} \biggr) +6\sum_{ \stackrel{n\nmid a_{i}a_{j}}{gcd(a_{i},a_{j})= 1}} \phi \biggl( \frac{n}{a_{i}} \biggr)\phi \biggl(\frac{n}{a_{j}} \biggr), \end{aligned}

where $$a_{i}$$’s are the proper divisors of n.

### Proof

Clearly, the zero ideal $$I=(0)$$ is generated by $$n=p_{1}^{\alpha _{1}}p_{2}^{\alpha _{2}}\ldots p_{k}^{\alpha _{k}}(=m)$$. As $$\Gamma _{I}(\mathbb{Z}_{n})\cong \Gamma (\mathbb{Z}_{n})$$, we have $$|I| = 1$$. By Theorem 6, the result follows. □

## Data Availability

No datasets were generated or analysed during the current study.

## References

1. Anderson, D.F., Levy, R., Shapiro, J.: Zero-divisor graphs, von Neumann regular rings and Boolean algebras. J. Pure Appl. Algebra 180, 221–241 (2003)

2. Atani, S.E.: An ideal-based zero-divisor graph of a commutative semiring. Glas. Mat. 44(64), 141–153 (2009)

3. Balamoorthy, S., Kavaskar, T., Vinothkumar, K.: Wiener index of an ideal-based zero-divisor graph of commutative ring with unity. AKCE Int. J. Graphs Comb. https://doi.org/10.1080/09728600.2023.2263040

4. Das, K.C., Xu, K., Cangul, L.N., Cevik, A.S., Graovac, A.: On the Harary index of graph operations. J. Inequal. Appl. 2013, 339 (2013)

5. Das, K.C., Zhou, B., Trinajstić, N.: Bounds on Harary index. J. Math. Chem. 46, 1369–1376 (2009)

6. Feng, L., Ilić Zagreb, A.: Harary and hyper-Wiener indices of graphs with a given matching number. Appl. Math. Lett. 23, 943–948 (2010)

7. Ivanciuc, O., Balaban, T.S., Balaban, A.T.: Reciprocal distance matrix, related local vertex invariants and topological indices. J. Math. Chem. 12, 309–318 (1993)

8. Khalifeh, M.H., Yousefi-Azari, H., Ashraf, A.R.: The hyper-Wiener index of graph operations. Comput. Math. Appl. 56, 1402–1407 (2008)

9. Laali, A.R.F., Javadi, H.H.S., Kiani, D.: Spectra of generalized corona of graphs. Linear Algebra Appl. 493, 411–425 (2016)

10. Maimani, H., Pournaki, M.R., Yessami, S.: Zero divisor graph with respect to an ideal. Commun. Algebra 34, 923–929 (2006)

11. Plavšić, D., Nikolić, S., Trinajstić, N., Mihalić, Z.: On the Harary index for the characterization of chemical graphs. J. Math. Chem. 12, 235–250 (1993)

12. Redmond, S.: An ideal-based zero-divisor graph of a commutative ring. Commun. Algebra 31, 4425–4443 (2003)

13. Russell, K., Hua, W.: The hyper-Wiener index of trees. Congr. Numer. 187, 40–54 (2007)

14. Saravanan, M., Murugan, S.P., Arunkumar, G.: A generalization of Fiedler’s lemma and the spectra of H-join of graphs. Linear Algebra Appl. 625, 20–43 (2021)

15. Sarkar, P., De, N., Pal, A.: Zagreb indices of double join and double corona of graphs based on the total graph. Int. J. Appl. Comput. Math. 6, 1–13 (2020)

16. Sarkar, P., De, N., Pal, A.: On some topological indices and their importance in chemical sciences: a comparative study. Eur. Phys. J. Plus 137(195), 1–12 (2022)

17. Schwenk, A.J.: Computing the characteristic polynomial of a graph. In: Bary, R., Harary, F. (eds.) Graphs Combinatorics. Lecture Notes in Mathematics, vol. 406, pp. 153–172 (1974)

18. Selvakumar, K., Gangaeswari, P., Arunkumar, G.: The Wiener index of the zero-divisor graph of a finite commutative ring with unity. Discrete Appl. Math. 311, 72–84 (2022)

19. Spiroff, S., Wickham, C.: A zero-divisor graph determined by equivalence classes of zero-divisors. Commun. Algebra 39, 2338–2348 (2011)

20. Young, M.: Adjacency matrices of zero-divisor graphs of integers modulo n. Involve 8, 753–761 (2015)

21. Zhou, B., Du, Z., Trinajstić, N.: Harary index of landscape graphs. Int. J. Chem. Model. 1, 35–44 (2008)

## Funding

For the first author, this research was supported by the CSIR-UGC, India Junior Research Fellowship (UGC-Ref. No.: 1085/(CSIR-UGC NET JUNE 2019)), while the second author was supported by the National Board of Higher Mathematics (NBHM), Government of India grant No. 02011/50/2023 NBHM(R.P)/R&D II/13885/ dated 19.10.2023.

## Author information

Authors

### Contributions

Each author contributed the same level of work.

### Corresponding author

Correspondence to K. Vinothkumar.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

### Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and permissions

Balamoorthy, S., Kavaskar, T. & Vinothkumar, K. Harary and hyper-Wiener indices of some graph operations. J Inequal Appl 2024, 34 (2024). https://doi.org/10.1186/s13660-024-03112-6