Introduction

Topological indices are important numerical invariants that capture structural properties of algebraic graphs, similar to their use in chemical graph theory. In this context, an algebraic structure can be visualized as a graph in which the edges are defined by algebraic connections or operations, and the elements correspond to the vertices. The basis for calculating topological indices is provided by the arrangement and connection of these vertices. Each vertex’s degree, which indicates how many connections it has throughout the structure, is a crucial component in determining these indices. These indices make it easier to compare various algebraic structures and enable a quantitative examination of the actual algebraic graph. Although topological indices come in a wide range of forms, they can be broadly divided into three categories: distance-based, degree-based and mixed indices.

Recently, a lot of research has been done on zero-divisor graph. Beck was the first to propose the idea of using a graph to connect the zero-divisors of a ring1. Let R be a ring and let Z(R) denote the set of all zero-divisors of R. We write \(Z(R)^{*} = Z(R) \setminus \{0\}\) for the set of all non-zero zero-divisors which will serve as the vertex set of the graph. For vertices \(x, y \in Z(R)^{*}\), we say that x and y are adjacent whenever \(xy = 0\). The resulting graph \(G = \Gamma (R)\) is called the zero-divisor graph of the ring R. Beck first introduced the concept of a zero-divisor graph and it was later simplified by Anderson and Livingston2 to better describe the structure of Z(R) in a ring. Redmond extended this notion to non-commutative rings3, showing that if the sets of left and right Z(R) coincide, then the zero-divisor graph \(\Gamma (R)\) is connected. DeMeyer and colleagues4 extended the notion of zero-divisor graph of rings to semi-groups in 2002. The zero-divisor graph for modules over commutative rings are thus given by Behboodi5 and we label zero-divisor graph by ZDG throughtout the article. For additional information about ZDG, readers may refer to6,7,8,9,10,11,12.

Distance-based indices take into consideration the distances between a graph’s vertex pairs. The total of all the distances between distinct vertices in a molecular network is known as the Wiener index. H.Wiener was the one who initially proposed this topological index13. Additionally, it led to certain modifications like the Tratch-Stankevich-Zefirov index and the hyper-Wiener index. Plavsic et al.14 and Ivanciuc et al.15 independently introduced the Harary index in 1993 for the purpose of characterizing molecular graphs and it was given this name in celebration of Professor Frank Harary’s 70th birthday. The reciprocal distance matrix yields the Harary index, which has some interesting physical and chemical characteristics. There has been some success with structure-property correlations using the Harary index and associated molecular descriptors16,17. Its modification has also been suggested and the correlations are improved when they are used when combined with other molecular descriptors18,19. The literature has many findings on the mathematical characteristics and uses of the Wiener index, Hyper-Wiener index and Harary index20,21,22,23,24,25.

The sum of the reciprocals of the distances between each pair of vertices in a connected graph that are not ordered is known as the Harary index of G. The Harary index is calculated for a connected graph G by the formula:

$$H(G) = \sum _{1 \le i < j \le n} \frac{1}{d(u_i, u_j)}$$

where \(d(u_i, u_j)\) represents the distance between vertices \(u_i\) and \(u_j\) within the graph.

The Harary index is an important topological index that captures the reciprocal distances between vertices in a graph. Studying the Harary index in the context of algebraic structures, such as ZDG of rings, provides deeper insights into the connectivity and structural properties of these graphs. Beyond algebra, the Harary index has significant applications in chemistry, where it helps characterize molecular graphs and predict chemical properties. Thus, analyzing the Harary index in this algebraic setting offers both theoretical interest and potential practical relevance. Huang and Zhang examined the Harary index’s function in fault-tolerant cryptographic networks, guaranteeing safe key distribution and network resilience against cyberattacks. In more recent times, the Harary index has drawn a lot of interest in the fields of cryptography and cybersecurity.

The importance of this study lies in its ability to connect specific graph-theoretic invariants to deep algebraic properties of the ring \(M_{n}(R)\). The structural properties of the \(\Gamma (M_{n}(R))\) provide insights into the ring’s ideals. For instance, its diameter relates to the maximum length of a chain of Z(R) whose products are zero which in turn can shed light on the ring’s nilpotency index. A finite diameter implies a certain level of connectedness among the Z(R) reflecting the underlying ideal structure while the girth (the length of the shortest cycle) can reveal the presence of specific types of ideals. Moreover, \(\Gamma (M_{n}(R))\) serves as an invariant for ring isomorphisms: if \(\Gamma (M_{n}(R)) \not \cong \Gamma (M_{n}(S))\), then the rings \(M_{n}(R)\) and \(M_{n}(S)\) are not isomorphic. This offers a combinatorial tool for classifying upper triangular matrix rings as the number of vertices and edges of \(\Gamma (M_{n}(R))\) directly correspond to the number of \(Z(R)^{*}\) in \(M_{n}(R)\), which can be expressed in terms of the properties of the base ring R. Furthermore, since \(M_{n}(R)\) is a fundamental example of a non-commutative ring, the study of its ZDG facilitates the extension of results from commutative to non-commutative settings with the graph’s structure capturing challenges such as \(xy \ne yx\) and the distinction between left and right Z(R) and thus providing a concrete framework for developing new theories in non-commutative ZDG.

The Harary index has practical applications in cryptography, cybersecurity, blockchain, IoT and wireless networks. It ensures fault tolerance, attack resistance and secure key distribution, making it essential for modern cryptographic systems. The applications shown above motivated us to look into the Harary index of ZDG. The Harary index of ZDG obtained from upper triangular matrices (\(M_3(\mathbb {Z}_2)\)) was examined in this study. In this study, we computed the Harary index of directed and undirected ZDG obtained from upper triangular matrices (\(M_3(\mathbb {Z}_2)\)).

Preliminaries

In this section, we explore the fundamental concepts of the Harary index of ZDG of upper triangular matrices.

Definition 1

A ZDG is one in which the vertices represent the elements of the ring and pairs of zero-divisor elements are connected by edges. For example, (VE) is a ZDG, where V is the collection of \(Z(R)^{*}\) of R and the vertices \(x_1\) and \(x_2\) are connected by an edge in V such that \(x_1\cdot x_2=0\). It is represented by \(\Gamma (R)\).

Definition 2

An upper triangular matrix is matrix in which all of the elements below the major diagonal of a square matrix are zero i.e. \(A = [a_{ij}], \quad \text {it is upper triangular matrix if} \quad a_{ij} = 0 \quad \text {for all} \quad i > j\), where i denotes row index and j denotes column index.

Definition 3

For a directed graph G with vertices \(V = \{ u_1, u_2, u_3, \dots , u_n \}\), the Harary Index is calculated by the sum of the reciprocals of the distances between each unordered pair of vertices in a connected graph.

$$H(G) = \sum _{i=1}^{n} \sum _{j=1}^{n} \frac{1}{d(u_i, u_j)} .$$

,where \(d(u_i, u_j)\) is the directed distance from vertex \(u_i\) to vertex \(u_j\) and vertex pairs with \(i = j\) are excluded from the Harary sum because the distance \(d(u_i, u_i) = 0\) and including \(\frac{1}{0}\) would be undefined. Only distinct vertex pairs contribute meaningfully to the index.

Definition 4

For an undirected graph G, the Harary Index H(G) is defined as:

$$H(G) = \sum _{1 \le i < j \le n} \frac{1}{d(u_i, u_j)}$$

,where \(d(u_i, u_j)\) is the shortest path distance between the vertices x and y.

ZDG of upper triangular matrices in \(M_2(R)\) and \(M_3(R)\)

This section defines and explores the ZDG of upper triangular matrices over rings, specifically \(M_2(R)\) and \(M_3(R)\), where R is a field or a finite ring like \(\mathbb {Z}_2\).

ZDG of \(M_2(\mathbb {Z}_2)\)

The general form of an upper triangular matrix in \(M_2\) is:

$$A = \begin{pmatrix} p & q \\ 0 & r \end{pmatrix}, \quad \text {where } p, q, r \in R$$

In \(\mathbb {Z}_2\), each of pqr can be 0 or 1, yielding \(2^3 = 8\) possible matrices. Excluding the zero matrix, we are left with 7 distinct non-zero matrices denoted as \(Z_1, Z_2, \dots , Z_7\).

$$\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 \\ 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 \\ 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}.$$

These matrices generate a non-commutative ring and their zero-divisor relationships define a ZDG, illustrated in Figure 1.

Fig. 1
Fig. 1
Full size image

\({Z}_{G}\).

ZDG of \(M_3(\mathbb {Z}_2)\)

The general form of upper triangular matrices in \(M_3\) is:

$$A = \begin{pmatrix} p & q & r \\ 0 & s & t \\ 0 & 0 & u \end{pmatrix}, \quad \text {where } p, q, r, s, t, u \in R$$

Restricting each entry to \(\{0, 1\} (mod 2)\), we obtain \(2^6 = 64\) total matrices. Excluding the zero matrix, 63 distinct upper triangular matrices remain, denoted \(P_1, P_2, \dots , P_{63}\).

$$\begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix},$$
$$\begin{pmatrix} 1 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix},$$
$$\begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix},$$
$$\begin{pmatrix} 1 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix},$$
$$\begin{pmatrix} 0 & 1 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix},$$
$$\begin{pmatrix} 0 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix},$$
$$\begin{pmatrix} 1 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix},$$
$$\begin{pmatrix} 0 & 1 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 1 \\ 0 & 0 & 0 \\ 0 & 0 & 1 \end{pmatrix},$$
$$\begin{pmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 0 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{pmatrix}.$$

Two types of ZDG arise:

  • Undirected: For \(x, y \ne 0\), if \(xy = 0\) and \(yx = 0\).

  • Directed: For \(x, y \ne 0\), if \(xy = 0\) but \(yx \ne 0\).

These graphs capture the structure of zero-divisor interactions within the ring of upper triangular matrices Tables 1, 2, 3, 4, 5 and 6.

Harary index of directed ZDG derived from upper triangular matrix \(M_2(\mathbb {Z}_2)\) and \(M_3(\mathbb {Z}_2)\) .

Consider the directed graph \(D_x\) (Figure a), formed from vertices \(P_1, P_2, \dots , P_6\), which are a subset of the 63 non-zero upper triangular matrices in \(M_3(\mathbb {Z}_2)\), as previously defined. We divided the graph into two sections to control graphical complication.

The second graph, \(D_y\) ( Figure b), includes vertices \(P_7, P_8, \dots , P_{63}\) and their associated directed edges. Both graphs are shown separately for clarity and are color-coded for easier understanding. Together, they represent the complete directed ZDG and are collectively denoted as \(D_z\).

In both figures (Figure 2), a single directional arrow \((\rightarrow )\) from vertex \(P_i\) to \(P_j\) implies that \(P_i \cdot P_j = 0\), i.e., \(P_i\) is a left zero-divisor with respect to \(P_j\). If there is no arrow from \(P_j\) to \(P_i\), it indicates that \(P_j \cdot P_i \ne 0\). This asymmetry illustrates the non-commutative nature of multiplication in \(M_3(\mathbb {Z}_2)\). Certain matrices, specifically:

$$P_{33}, P_{43}, P_{44}, P_{46}, P_{51}, P_{56}, P_{57}, P_{59}, P_{60}, P_{62}, P_{63}$$

do not act as \(Z(R)^{*}\) and are excluded from the graph.

Fig. 2
Fig. 2
Full size image

The directed ZDG (\(D_z\)) of the upper triangular matrix ring \(M_3(\mathbb {Z}_2)\). Each vertex represents a nonzero zero divisor in \(M_3(\mathbb {Z}_2)\) and a directed edge \(P_i \rightarrow P_j\) is drawn whenever \(P_{i}P_{j} = 0\).

Theorem 1

Let \(Z_G\)(Figure 1) be the ZDG of the directed upper triangular matrix ring \(M_2(\mathbb {Z}_2)\). Then, the Harary index of the associated directed graph is 7/2.

Proof

Let \((Z_1, Z_2, Z_3, Z_4\)) be vertices in a graph. Each entry d(pq) denotes the distance between vertices \(v_p\) and \(v_q\), where p and q range from 1 to 4. The Harary index is calculated by the sum of the reciprocals of the distances between each unordered pair of vertices in a connected graph.

$$H(G) = \sum _{p=1}^{n} \sum _{q=1}^{n} \frac{1}{d(v_p, v_q)} .$$

, where \(d(v_p, v_q)\) is the directed distance from vertex \(v_p\) to vertex \(v_q\).

Here, H(G) represents the Harary index of the graph G.

To compute the Harary index:

  1. 1.

    When we construct the table, the shortest reciprocals path distance between vertices \(v_p\) and \(v_q\),

  2. 2.

    The sum of the reciprocals of the distances between each unordered pair of vertices to calculate the Harary index H(G),

  3. 3.

    The value of \(\frac{1}{d(p, q)}\) is 0 if there is no path from \(v_p\) to \(v_q\).

\(\square\)

The table below illustrates the reciprocals distances between each pair of vertices.

Table 1 Pairwise distances between vertices.

Therefore, the Harary index of the graph \((Z_G)\) is

$$H(Z_G)= \sum _{q=2}^{4} \frac{1}{d(1,q)} + + \cdots + \sum _{q=4}^{3}\frac{1}{d(4,q)} =7/2.$$

Hence, Harary index of the associated directed graph is equivalent to 7/2.

Theorem 2

Let \(D_z\) be the ZDG of the directed upper triangular matrix ring \(M_3(\mathbb {Z}_2)\). Then, the Harary index of the associated directed graph is: \(\frac{\left( {\begin{array}{c}40\\ 4\end{array}}\right) +\left( {\begin{array}{c}10\\ 4\end{array}}\right) -\left( {\begin{array}{c}6\\ 2\end{array}}\right) -\left( {\begin{array}{c}2\\ 1\end{array}}\right) }{\left( {\begin{array}{c}10\\ 3\end{array}}\right) +\left( {\begin{array}{c}4\\ 2\end{array}}\right) }\).

Proof

Let \(( P_1, P_2, \dots , P_{63}\)) be vertices in a graph. Each entry d(pq) denotes the distance between vertices \(v_p\) and \(v_q\), where p and q range from 1 to 63. The Harary index is calculated by the sum of the reciprocals of the distances between each unordered pair of vertices in a connected graph.

$$H(D_z) = \sum _{p=1}^{n} \sum _{q=1}^{n} \frac{1}{d(v_p, v_q)} .$$

,where \(d(v_p, v_q)\) is the directed distance from vertex \(v_p\) to vertex \(v_q\).

Here, \(H(D_z)\) represents the Harary index of the graph \(D_z\).

To compute the Harary index:

  1. 1.

    When we construct the table, the shortest reciprocals path distance between vertices \(v_p\) and \(v_q\) is denoted by d(pq),

  2. 2.

    The sum of the reciprocals of the distances between each unordered pair of vertices to calculate the Harary index \(H(D_z)\),

  3. 3.

    The value of \(\frac{1}{d(p, q)}\) is 0 if there is no path from \(v_p\) to \(v_q\).

\(\square\)

The table below illustrates the reciprocals distances between each pair of vertices.

Table 2 Shortest reciprocals path distance between vertices \(v_p\) and \(v_q\).
Table 3 Shortest reciprocals path distance between vertices \(v_p\) and \(v_q\).
Table 4 Shortest reciprocals path distance between vertices \(v_p\) and \(v_q\).
Table 5 Shortest reciprocals path distance between vertices \(v_p\) and \(v_q\).

Therefore, the Harary index of the graph \(H(D_z)\) is

$$\begin{aligned} H(D_z)= \sum _{q=1}^{63} \frac{1}{d(1,q)} + \sum _{q=1}^{63} \frac{1}{d(2,q)} + \cdots + \sum _{q=1}^{63} \frac{1}{d(62,q)} + \sum _{q=1}^{63} \frac{1}{d(63,q)} \end{aligned}$$

= \(\frac{\left( {\begin{array}{c}40\\ 4\end{array}}\right) +\left( {\begin{array}{c}10\\ 4\end{array}}\right) -\left( {\begin{array}{c}6\\ 2\end{array}}\right) -\left( {\begin{array}{c}2\\ 1\end{array}}\right) }{\left( {\begin{array}{c}10\\ 3\end{array}}\right) +\left( {\begin{array}{c}4\\ 2\end{array}}\right) }\).

Hence, Harary index of the associated directed graph is given by: \(\frac{\left( {\begin{array}{c}40\\ 4\end{array}}\right) +\left( {\begin{array}{c}10\\ 4\end{array}}\right) -\left( {\begin{array}{c}6\\ 2\end{array}}\right) -\left( {\begin{array}{c}2\\ 1\end{array}}\right) }{\left( {\begin{array}{c}10\\ 3\end{array}}\right) +\left( {\begin{array}{c}4\\ 2\end{array}}\right) }\).

Remark

Let G be the directed ZDG associated with the ring \(M_{3}(\mathbb {Z}_{4})\). As the number of vertices increases (either by enlarging the matrix size or by increasing the modulus of the underlying ring), the computation and graphical representation of G become increasingly complex. Moreover, the Harary index H(G) always satisfies the lower bound

$$H(G) > \frac{\left( {\begin{array}{c}40\\ 4\end{array}}\right) + \left( {\begin{array}{c}10\\ 4\end{array}}\right) - \left( {\begin{array}{c}6\\ 2\end{array}}\right) - \left( {\begin{array}{c}2\\ 1\end{array}}\right) }{\left( {\begin{array}{c}10\\ 3\end{array}}\right) + \left( {\begin{array}{c}4\\ 2\end{array}}\right) }.$$

Harary index of undirected ZDG derived from upper triangular matrix \(M_3(\mathbb {Z}_2)\).

We’ll explore the graph which is derived from the vertices \(P_1,P_2,P_3,P_4,P_5,P_6,P_7,P_8, P_9, P_{10}, P_{11}, P_{12}\)

, \(P_{13}, P_{14}, P_{15}, P_{16}, P_{17}, P_{18}, P_{19}, P_{20}, P_{21}, P_{28}, P_{31}, P_{40}\) and \(P_{48}\). This Figure 3(\(D_{un}\)) shows that their vertices have a commutative relationship. In other words, if there is an edge between \(P_1\) and \(P_2\), then \(P_1\cdot P_2=0\) and \(P_2\cdot P_1=0\). Therefore, since the products of vertices connected by edges equal zero, they represent zero divisors. A ZDG is created when these zero divisors are joined. As upper triangular matrix \(P_{22}\), \(P_{23}\), \(P_{25}\),..., \(P_{62}\), \(P_{63}\) except \(P_{28}, P_{31}, P_{40}\) and \(P_{48}\) doesn’t make any commutative \(Z(R)^{*}\), so we remove these vertices from the graph. Therefore, the resulting undirected ZDG is shown in Figure 3 as \(D_{un}\).

Fig. 3
Fig. 3
Full size image

The undirected ZDG (\(D_{un}\)) of the upper triangular matrix ring \(M_3(\mathbb {Z}_2)\). Vertices correspond to the nonzero zero divisors in \(M_3(\mathbb {Z}_2)\) and two vertices \(P_i\) and \(P_j\) are adjacent whenever \(P_{i}P_{j} = P_{j}P_{i} = 0\).

Theorem 3

Let \(D_{un}\) be the ZDG of the undirected upper triangular matrix ring \(M_3(\mathbb {Z}_2)\). Then, the Harary index of the associated undirected graph is: \(\left( {\begin{array}{c}11\\ 3\end{array}}\right) -\left( {\begin{array}{c}5\\ 3\end{array}}\right) -\left( {\begin{array}{c}5\\ 5\end{array}}\right)\).

Proof

Let \(( P_1, P_2, \dots , P_{63}\)) be vertices in a graph. Each entry d(pq) denotes the distance between vertices \(v_p\) and \(v_q\), where p and q range from 1 to 63. The Harary index for a graph \(D_{un}\) is given by formula:

$$H(G) = \sum _{1 \le p < q \le n} \frac{1}{d(v_p, v_q)}$$

where:

  • \(\frac{1}{d(p, q)}\) is the shortest reciprocal path distance between vertices p and q,

  • The sum is taken over all pairs of vertices \(p, q \in V\),

  • The value of \(\frac{1}{d(p, q)}\) is 0 if there is no path from p to q.

\(\square\)

The table below illustrates the reciprocals distances between each pair of vertices.

Table 6 Shortest reciprocals path distance between vertices \(v_p\) and \(v_q\).

Therefore, the Harary index of the graph \((D_{un})\) is

$$\begin{aligned} H(D_{un})= \sum _{q=2}^{63} \frac{1}{d(1,q)} + \sum _{q=3}^{63} \frac{1}{d(2,q)} + \cdots + \frac{1}{d(62,63)} \end{aligned}$$

= \(\left( {\begin{array}{c}11\\ 3\end{array}}\right) -\left( {\begin{array}{c}5\\ 3\end{array}}\right) -\left( {\begin{array}{c}5\\ 5\end{array}}\right)\). Hence, Harary index of the associated undirected graph is equivalent to \(\left( {\begin{array}{c}11\\ 3\end{array}}\right) -\left( {\begin{array}{c}5\\ 3\end{array}}\right) -\left( {\begin{array}{c}5\\ 5\end{array}}\right)\).

Remark

Let G be the undirected ZDG associated with the given algebraic structure. As the number of vertices increases (either by enlarging the matrix size or by increasing the modulus of the underlying ring), the computation and graphical representation of G become increasingly complex. Moreover, the Harary index H(G) always satisfies the lower bound

$$H(G) > \left( {\begin{array}{c}11\\ 3\end{array}}\right) - \left( {\begin{array}{c}5\\ 3\end{array}}\right) - \left( {\begin{array}{c}5\\ 5\end{array}}\right) .$$

Conclusion

In this study, we computed the Harary index of directed and undirected graphs derived from the upper triangular matrix \(M_3(\mathbb {Z}_2)\) ZDG. Based on the ZDG of an upper triangular matrix \(M_3(\mathbb {Z}_2)\), we have found that the directed and undirected graphs have different Harary indices. In the future, we would expand our study to include Harary indices of directed and undirected graphs derived from the ZDG of the higher order matrix rings and also find some important topological indices such as Randic (Connectivity) Index and the First and Second Zagreb Indices of directed and undirected graphs derived from the ZDG of the upper triangular matrix \(M_3(\mathbb {Z}_2)\) and we may extend this investigation to other matrix rings over finite fields or explore dynamic scenarios where the network structure evolves over time. This study may be further extended by investigating the corresponding cozero-divisor graphs of upper triangular matrix rings. Since cozero-divisor graphs provide a complementary perspective on the algebraic structure of rings, incorporating them could deepen the understanding of the interaction between Z(R) and non-zero non-units. For possible extensions, Bilal Ahmad Rather’s research on the independent dominance polynomial of cozero-divisor graphs of \(\mathbb {Z}_n\)26 is a significant reference.