1 Introduction

Harry Wiener introduced the first topological index in 1947 [12]. He computed the sum of the shortest path distances between all pairs of vertices of a graph, now called the Wiener index. This distance-based topological index has many applications in chemical graph theory.

Later, many vertex degree-based topological indices of the molecular graph were introduced, proving to have a close connection with the molecular structure. For example, the first and the second Zagreb multiplicative indices (\(\Pi _1(G)\)) and (\(\Pi _2(G)\)) were introduced in [3], which are defined as follows.

$$\begin{aligned} \Pi _1(G) = \prod \limits _{v \in V(G)} \deg (v)^2 \text { and } \Pi _2(G) = \prod \limits _{uv \in E(G)} \deg (u) \deg (v). \end{aligned}$$

In the literature, \(\Pi _1(G)\) is also known as the Gutman index [10]. The indices \(\Pi _1\) and \(\Pi _2\) have a vast literature. See [1, 4, 5] for recent work on these indices. Attach a graph to a commutative ring R with unity by considering its non-zero zero-divisors as its vertices and connect two of them by an edge if their product is zero. This graph is called the zero-divisor graph of R, denoted by \(\Gamma (R)\), and is well-studied in the literature [7, 9]. This paper studies the first and second Zagreb indices for zero divisor graphs of finite commutative reduced rings with unity. Note that a ring is reduced if it has no non-zero nilpotent elements. We give explicit combinatorial formulas for these indices. The result we prove is the following.

Theorem 1

Let R be a finite commutative reduced ring. We can assume that \(R = \mathbb F_{q_1} \times \cdots \times \mathbb F_{q_k}\), where \(q_i = p_i^{k_i}\) and \(\mathbb F_q\) is the finite field with q elements. Then, the Zagreb first and second multiplicative index of the zero divisor graph \(\Gamma (R)\) are given by

$$\begin{aligned} \Pi _1(\Gamma (R))&= \prod _{A \in \mathcal P_k} \left( \sum\limits _{\begin{array}{l} B \in \mathcal P_k \\ A \cap B = \emptyset \end{array}} \prod _{j \in B}(q_j-1)^2\right) ^{\left( \prod _{i \in A}(q_i-1)\right) } \end{aligned}$$

and

$$\begin{aligned} \Pi _2(\Gamma (R)) =\prod\limits _{\begin{array}{l} A,B \in \mathcal P_k \\ A\cap B = \emptyset \end{array}} \left( \sum\limits _{\begin{array}{l} C \in \mathcal P_k \\ A \cap C = \emptyset \end{array}} \prod _{j \in C}(q_j-1)^{\left( \prod _{j \in A}(q_j-1)\right) }\right) \left( \sum\limits _{\begin{array}{l} D \in \mathcal P_k \\ B \cap D = \emptyset \end{array}} \prod _{j \in D}(q_j-1)^{\left( \prod _{j \in B}(q_j-1)\right) }\right) . \end{aligned}$$

The symbols used in the above theorem are explained in Sect. 2.

In Sect. 3, to explain our result’s applicability, we have explicitly calculated the first and the second Zagreb indices for many examples of zero divisor graphs.

2 Proof of the main theorem: a formula for the Zagreb multiplicative indices of the zero-divisor graphs

For graph-theoretic notions, we follow [11].

2.1 Zero-divisor graph of a commutative ring with unity

We start with defining the zero-divisor graph of a commutative ring with unity.

Definition 1

[2] Let R be a commutative ring with unity. Let \(Z(R)^{*}\) be the set of all non-zero zero-divisors of R. The zero-divisor graph of R, denoted by \(\Gamma (R)\), is defined to be the simple graph with vertex set \(Z(R)^{*}\) and two vertices of \(\Gamma (R)\) are adjacent if their product is zero.

Example 1

Consider the ring \(R = \mathbb Z_5 \times \mathbb Z_2\) the product of the ring of integers modulo 5 and the ring of integers modulo 2. Then the set of non-zero zero-divisors of R is given by \(Z(R)^{*} = \{(0,1),(1,0),(2,0),(3,0),(4,0)\}\). The associated zero-divisor graph \(\Gamma (R)\) is as follows.

figure a

2.2 H-join of graphs

The H-join operation of graphs, denoted it by \(H[G_1,G_2,\dots ,G_k]\), is introduced in [6].

Definition 2

[6, Equation (48) below] Let H be a graph with vertex set \(V = \{1,\dots ,k\}\) and let \(G_1,\dots ,G_k\) be a collection of graphs with the respective vertex sets \(V_i = \{v_1^{i},\dots ,v_{n_i}^i\}\) for \((1 \le i \le k)\). Then their generalized composition \(G = H[G_1,\dots ,G_k]\) has vertex set \(V_1 \sqcup \cdots \sqcup V_k\) and two vertices \(v_i^p\) and \(v_j^q\) of \(H[G_1,\dots ,G_k]\) are adjacent if one the following conditions is satisfied:

  1. (1)

    \(p=q\), and \(v_i^p\) and \(v_j^q\) are adjacent vertices in \(G_p\).

  2. (2)

    \(p \ne q\) and p and q are adjacent in H.

The graph H is said to be the base graph of G, and the graphs \(G_i\) are called the factors of G. Note that the zero-divisor graph given in Example 1 is the H-join \(K_2[K_1, \overline{K}_2]\).

2.3 The zero-divisor graph of a reduced ring as H-join of graphs

Let R be an arbitrary finite commutative ring with unity. First, we define an equivalence relation \(\sim\) on \(Z(R)^{*}\) as follows. For \(x,y \in Z(R)^{*}\), define \(x \sim y\) if, and only if, \({\text {Ann}}(x) = {\text {Ann}}(y)\), where \({\text {Ann}}(x) = \{a \in R: ax=0\}\). Let \(C_1, \dots , C_k\) be the equivalence classes of this relation with respective representatives \(c_1,\dots ,c_k\). Then \(Z(R)^{*} = \sqcup _{i=1}^k C_i\). We call these classes the equiv-annihilator classes of \(\Gamma (R)\).

Next, we further assume that R is a reduced ring. Then \(R = \mathbb F_{q_1} \times \cdots \times \mathbb F_{q_k}\), where \(q_i = p_i^{k_i}\) and \(\mathbb F_q\) is the finite field with q elements. Let \(\mathcal P_k = \{A \subseteq [k]: A \ne \emptyset \text { and } A \ne [k] \}\), where \([k]:= \{1,\dots ,k\}\). For \(A \in \mathcal P_k\), we define the characteristic vector of A to be the element \(\textbf{1}_A = (a_1,\dots ,a_k) \in R\) satisfying \(a_i = 1 \text { if } i \in A \text { and } a_i = 0 \text { otherwise}\). Also, for \(A \in \mathcal P_k\), we define the sets

$$\begin{aligned} C_A = \{(a_1,\dots ,a_k) \in R: a_i \text { is non-zero if, and only if, } i \in A\}. \end{aligned}$$

We have \(a \sim b\) if, and only if, \({\text {Ann}}(a) = {\text {Ann}}(b)\). Let \(a=(a_1,\dots ,a_k)\) and \(b=(b_1,\dots ,b_k)\) be two elements of R. Then \({\text {Ann}}(a) = {\text {Ann}}(b)\) if, and only if \({\text {supp}}a = {\text {supp}}b\), where \({\text {supp}}a: = \{1\le i \le k: a_i \text { is non-zero} \}\).

The equivalence classes of the equivalence relation \(\sim\) are precisely the sets \(C_A\) for \(A \in \mathcal P_k\). In particular, the set of non-zero zero-divisors of R is given by \(Z(R)^{*} = \sqcup _{A \in \mathcal P_k}C_A\) and the characteristic vector \(\textbf{1}_A\) of a set \(A \in \mathcal P_k\) can be taken as the canonical representative of the class \(C_A\). Therefore, there are \(2^k-2\) distinct equivalence classes in \(Z(R)^{*}\) for the relation \(\sim\). Also, the subgraph induced by the set \(C_A\) in \(\Gamma (R)\) is the empty graph (graph with no edges) on \(n_A:= \prod _{i \in A}(q_i-1)\) vertices.

Let H be the graph with vertex set \(V(H) = \{\textbf{1}_A: A \in \mathcal P_k\}\) and the vertices \(\textbf{1}_A\) and \(\textbf{1}_B\) are adjacent in H if, and only if, \(\textbf{1}_A \cdot \textbf{1}_B = 0\) if, and only if, \(A \cap B = \emptyset\). We also assume that the graph \(G_A\) has vertex set \(C_A = \{v_1^{A},\dots , v_{n_A}^{A}\}\) and defined to be the subgraph induced by the equivalence class \(C_A\) in \(\Gamma (R)\), where \(n_A=\prod _{i \in A}(q_i-1)\) defined earlier.

Given these, we have the following proposition whose proof follows from the definition of H-join of graphs and the above discussion.

Proposition 1

[8] The zero divisor graph \(\Gamma (R)\) is equal to the H-join \(H[G_A: A \in \mathcal P_k]\).

2.4 The Zagreb multiplicative indices of zero divisor graphs of reduced rings

First, we prove a lemma which describes degrees of vertices in \(\Gamma (R) = H[G_A: A \in \mathcal P_k]\).

Lemma 1

[8] Let \(v_i^A\) be a vertex of \(\Gamma (R) = H[G_A: A \in \mathcal P_k]\). Then we have

$$\begin{aligned} d_G(v_i^A) = \sum\limits _{\textbf{1}_B \in N_H(\textbf{1}_A)} |C_B| = \sum\limits _{\begin{array}{l} B \in \mathcal P_k \\ \textbf{1}_A \cdot \textbf{1}_B = 0 \end{array}} \prod _{j \in B}(q_j-1) =\sum\limits _{\begin{array}{l} B \in \mathcal P_k \\ A \cap B = \emptyset \end{array}} \prod _{j \in B}(q_j-1). \end{aligned}$$

Proof

The proof follows from the description of the graph \(\Gamma (R)\) as H-join given in Proposition 1.

The above lemma gives respectively that the Zagreb first and second multiplicative index of G are equal to

$$\begin{aligned} \Pi _1(G)&= \prod _{A \in \mathcal P_k} \prod _{j=1}^{n_A} \left( \sum\limits _{\begin{array}{l} B \in \mathcal P_k \\ A \cap B = \emptyset \end{array}} \prod _{j \in B}(q_j-1)\right) ^2 \\&= \prod _{A \in \mathcal P_k} \left( \sum\limits _{\begin{array}{l} B \in \mathcal P_k \\ A \cap B = \emptyset \end{array}} \prod _{j \in B}(q_j-1)^2\right) ^{|C_A|} \\&= \prod _{A \in \mathcal P_k} \left( \sum\limits _{\begin{array}{l} B \in \mathcal P_k \\ A \cap B = \emptyset \end{array}} \prod _{j \in B}(q_j-1)^2\right) ^{\Big (\prod _{i \in A}(q_i-1)\Big )} \end{aligned}$$

and

$$\begin{aligned} \Pi _2(G)&= \prod _{(v_i^A,v_j^B) \in E(G)} d(v_i^A) d(v_j^B) \\&= \prod _{(v_i^A,v_j^B) \in E(G)} \left( \sum\limits _{\begin{array}{l} C \in \mathcal P_k \\ A \cap C = \emptyset \end{array}} \prod _{j \in C}(q_j-1)\right) \left( \sum\limits _{\begin{array}{l} D \in \mathcal P_k \\ B \cap D = \emptyset \end{array}} \prod _{j \in D}(q_j-1)\right) \\&=\prod _{(\textbf{1}_A,\textbf{1}_B) \in E(H)} \left( \sum\limits _{\begin{array}{l} C \in \mathcal P_k \\ A \cap C = \emptyset \end{array}} \prod _{j \in C}(q_j-1)^{|C_A|}\right) \left( \sum\limits _{\begin{array}{l} D \in \mathcal P_k \\ B \cap D = \emptyset \end{array}} \prod _{j \in D}(q_j-1)^{|C_B|}\right) \\&=\prod _{(\textbf{1}_A,\textbf{1}_B) \in E(H)} \left( \sum\limits _{\begin{array}{l} C \in \mathcal P_k \\ A \cap C = \emptyset \end{array}} \prod _{j \in C}(q_j-1)^{\Big (\prod _{j \in A}(q_j-1)\Big )}\right) \left( \sum\limits _{\begin{array}{l} D \in \mathcal P_k \\ B \cap D = \emptyset \end{array}} \prod _{j \in D}(q_j-1)^{\Big (\prod _{j \in B}(q_j-1)\Big )}\right) \\&=\prod _{\begin{array}{l} A,B \in \mathcal P_k \\ A\cap B = \emptyset \end{array}} \left( \sum\limits _{\begin{array}{l} C \in \mathcal P_k \\ A \cap C = \emptyset \end{array}} \prod _{j \in C}(q_j-1)^{\Big (\prod _{j \in A}(q_j-1)\Big )}\right) \left( \sum\limits _{\begin{array}{l} D \in \mathcal P_k \\ B \cap D = \emptyset \end{array}} \prod _{j \in D}(q_j-1)^{\Big (\prod _{j \in B}(q_j-1)\Big )}\right) . \end{aligned}$$

Hence, we have proved the following fully combinatorial description of the Zagreb multiplicative indices of the zero divisor graphs of reduced rings.

Theorem 2

The Zagreb first and second multiplicative index of the zero divisor graph \(\Gamma (R)\) are given respectively by

$$\begin{aligned} \Pi _1(G) = \prod _{A \in \mathcal P_k} \left( \sum\limits _{\begin{array}{l} B \in \mathcal P_k \\ A \cap B = \emptyset \end{array}} \prod _{j \in B}(q_j-1)^2\right) ^{\left( \prod _{i \in A}(q_i-1)\right) } \end{aligned}$$

and

$$\begin{aligned} \Pi _2(G) = \prod\limits _{\begin{array}{l} A,B \in \mathcal P_k \\ A\cap B = \emptyset \end{array}} \left( \sum\limits _{\begin{array}{l} C \in \mathcal P_k \\ A \cap C = \emptyset \end{array}} \prod _{j \in C}(q_j-1)^{\Big (\prod _{j \in A}(q_j-1)\Big )}\right) \left( \sum\limits _{\begin{array}{l} D \in \mathcal P_k \\ B \cap D = \emptyset \end{array}} \prod _{j \in D}(q_j-1)^{\Big (\prod _{j \in B}(q_j-1)\Big )}\right) . \end{aligned}$$

Remark 1

The above description of the Zagreb multiplicative indices of the zero divisor graphs of a reduced ring \(\Gamma (R)\) is fully combinatorial because we don’t need any algebraic structural information about the ring R to calculate these indices. Since it only involves cardinalities of specific sets, it is also easy to calculate. This will be explained in the subsequent examples. Also, their logarithmic connection to the additive Zagreb indices is evident.

3 Explicit calculation of the multiplicative Zagreb indices of the zero-divisor graphs of reduced rings

In this section, using the formula given in theorem 2, we explicitly calculate the Zagreb multiplicative indices of zero divisor graphs of reduced rings.

Example 2

Assume that \(R = {\mathbb {F}}_{q_1} \times {\mathbb {F}}_{q_2}\) product of two finite fields. Then \(k=2\), \(\mathcal P_k = \{ \{1\}, \{2\}\}\), \(|C_{\{1\}}| = n_{\{1\}} = (q_1-1)\) and \(|C_{\{2\}}| = n_{\{2\}} = (q_2-1)\). For example, when \(q_1 = 2\) and \(q_3 = 2^2\) we have

figure b

Further, by Theorem 2, the first and the second Zagreb indices of \(\Gamma (R)\) are given by \(\Pi _1(\Gamma (R)) = (q_2-1)^{2(q_1-1)} + (q_1-1)^{2(q_2-1)} \text { and } \Pi _2 = (q_2-1)^{(q_1-1)}(q_1-1)^{(q_2-1)}.\)

Example 3

Let \(R = {\mathbb {F}}_{q_1} \times {\mathbb {F}}_{q_2}\times \mathbb F_{q_3}\) product of three finite fields. Then \(k=3\), \(\mathcal P_3 = \{\{1\},\{2\},\{3\},\{1,2\},\{1,3\},\{2,3\}\}, |C_{\{2,3\}}| = (q_2 -1)(p_3-1), |C_{\{1,3\}}| = (q_1 -1)(q_3-1), |C_{\{1,2\}}| = (q_1-1)(q_2-1), |C_{\{3\}}| = q_3-1, |C_{\{2\}}| = q_2-1, \text { and } |C_{\{1\}}| = q_1-1\).

We have, by Theorem 2, the first and the second Zagreb indices of \(\Gamma (R)\) are given by

$$\begin{aligned} \Pi _1(G) =&\left( (q_3-1)\right) \left( (q_1-1)(q_2-1)\right) ^{\left( (q_1-1)(q_2-1))(q_3-1)\right) }+ \\&\left( (q_1-1)\right) \left( (q_2-1)(q_3-1)\right) ^{\left( (q_2-1)(q_3-1)(q_1-1)\right) }+ \\&\left( (q_2-1)\right) \left( (q_1-1)(q_3-1)\right) ^{\left( (q_1-1)(q_3-1)(q_2-1)\right) }+ \\&\left( (q_3-1)\right) \left( (q_1-1)(q_3-1)\right) ^{\left( (q_1-1)(q_2-1)(q_2-1)\right) }+ \\&\left( (q_1-1)(q_3-1)\right) \left( (q_2-1)\right) ^{\left( (q_3-1)((q_1-1)(q_2-1)\right) }+ \\&\left( (q_3-1)\right) \left( (q_1-1)(q_2-1)\right) ^{\left( (q_2-1)(q_3-1)(q_1-1)\right) } \end{aligned}$$

and

$$\begin{aligned} \Pi _2(G)&= \left( (q_2-1)(q_3-2)\right) ^{2(q_1-1)} + \left( (q_1-1)(q_3-2)\right) ^{(q_2-1)} + \left( (q_1-1)(q_2-2)\right) ^{2(q_3-1)} \\&+ (q_3-1)^{2(q_1-1)(q_2-1)} + (q_1-1)^{2(q_2-1)(q_3-1)} + (q_2-1)^{2(q_1-1)(q_2-1)}. \end{aligned}.$$

The above two examples illustrate that the first and the second Zagreb multiplicative indices can be calculated analytically by knowing only the quantities \(q_1,\dots ,q_k\).