#### Abstract

Relating graph structures with words which are finite sequences of symbols, Parikh word representable graphs (PWRGs) were introduced. On the other hand, in chemical graph theory, graphs have been associated with molecular structures. Also, several topological indices have been defined in terms of graph parameters and studied for different classes of graphs. In this study, we derive expressions for computing certain topological indices of PWRGs of binary core words, thereby enriching the study of PWRGs.

#### 1. Introduction

Among various studies that involve graphs for analyzing and solving different kinds of problems, relating words that are finite sequences of symbols with graphs is an interesting area of investigation (for example, [1–5]). Based on the notion of subwords (also called scattered subwords) of a word and the concept of a matrix called Parikh matrix of a word, introduced in [6] and intensively investigated by many researchers (for example, [7–13] and references therein) with entries of the Parikh matrix giving the counts of certain subwords in a word, a graph called Parikh word representable graph (PWRG) of a word, was introduced in [14] and its relationship with the corresponding word and partition was studied in [15].

On the other hand, there has been a great interest in various topological indices associated with graphs (for example, [16–19]) due to their application in the area of chemical graph theory [20], which deals with representations of organic compounds or equivalently their molecular structures as graphs, with atoms other than hydrogen often represented by vertices and covalent chemical bonds by edges. In fact, in chemical graph theory, there have been attempts to capture the molecular structure in terms of the topological index of the corresponding graph.

There are a number of studies (for example, [21]) of various topological indices of graphs establishing formulae for computing the indices and also providing upper and lower bounds on the values of such indices. Recently, in [22], properties of one of the important topological indices, namely, Wiener index and some of its variants related to PWRGs of binary words, were studied. In this study, certain distance-based topological indices of PWRGs of binary core words are investigated.

#### 2. Preliminaries

The basic definitions and notations relating to words are as given in [23, 24]. We recall here some of the needed notions.

An ordered alphabet is a set of symbols with an ordering on its symbols. For example, with an ordering is an ordered alphabet, written as . A word over is a finite sequence of symbols belonging to . A word is a scattered subword or simply called a subword of a word over if and only if there exist , for and words (possibly empty) over , such that . The number of occurrences of a word as a subword of is denoted by . For example, in the word over the ordered binary alphabet , the number of ’s is , the number of ’s is , and the number of subwords ’s is . In fact, the word as a subword of is shown with the symbols and of shown in bold in .

The set of all words over an alphabet , including the empty word with no symbols, is denoted by . Unless stated otherwise, we consider only a binary alphabet .

*Definition 1. *[13] Let . The core of , denoted by , is the unique word of with the smallest possible length, such that A word is called a core word if and only if .

Clearly, a nonempty binary word is a core word if and only if starts with and ends with .

In [14], a simple graph, called Parikh word representable graph (PWRG), was defined corresponding to a word over an ordered alphabet. Restricting our attention to binary words, we recall now this PWRG.

*Definition 2. *[14] For a binary word of length over , we define a simple graph , called Parikh word representable graph (PWRG), with labeled vertices representing the positions of the consecutive letters of , such that for each occurrence of the subword in , there is an edge between the vertices in , corresponding to the positions of and in . We say that the binary word represents the graph and a graph is Parikh word representable if there exists a binary word that represents .

It is to be noted that of a binary word over is a bipartite graph [14] with as many vertices as the length of and as many edges as the number of occurrences of the subword in . Figure 1 shows the PWRG of a binary word over the ordered binary alphabet . The graph has 7 vertices and 9 edges. Note that the length of the word is 7, and there are 9 occurrences of the subword in .

In this study, we deal with only binary core words and the corresponding PWRGs. Also, we note that for a nonempty binary core word of the form , where and is nonnegative for each , , the number of edges in the corresponding PWRG *G*() isNote that in the word , , which is a power of , indicates that there are vertices labeled in the graph with each of these joined to all the vertices that correspond to the subsequent *b*’s in the word .

#### 3. Distance-Based Topological Indices

We consider only simple graphs, and for notions related to graphs, we refer to [25]. Let be a connected graph with vertex set and edge set . The distance between the vertices and of , denoted by , is defined as the length of a shortest path between and in . The degree of a vertex of , which is the number of edges incident at , is denoted by . For a given vertex in a connected graph , the eccentricity is defined as the maximum distance between and any other vertex in .

*Definition 3. *[26] The Harary index of a connected graph is defined as the sum of the reciprocals of distances between all pairs of vertices of , i.e.,The Harary index [26] of a connected graph is a topological index which has been extensively investigated (for example, [27–29]).

Theorem 1. *The Harary index of the PWRG G(), for , , for is given by*

*Proof. *We consider pairs of vertices in the PWRG *G*() corresponding to the word , with , where the label of appears before the label of in . There are now four cases to be considered. We will refer to a pair of such vertices with(i)Both and labeled (ii) labeled and labeled (iii) labeled and labeled (iv)Both and labeled They are given as a pair of type 1, 2, 3, and 4, respectively. There are pairs of vertices of type 1 and of type 4, and the distance between each such pair is 2. Here, is the binomial representing the number of ways of choosing objects from objects). There are pairs of vertices of type 2 with distance 1 and pairs of vertices of type 3 with distance 3, since . Hence,which yields the required result.

Theorem 2. *The Harary index of a with for the word for is bounded byand above by**The bounds are attained on and , respectively.*

*Proof. *Since is connected, [25]. Also, [6]. Hence, from Theorem 1, the Harary index of iswhich is the Harary index of the andwhich is the Harary index of the .

*Definition 4. *[30] The eccentric connectivity index of a connected graph *G* with vertex set is defined as , where is the eccentricity of .

The total eccentricity index [31] of the graph *G* is .

The topological index, namely, eccentric connectivity index, was introduced in [30] and has been widely investigated for different classes of graphs (for example, [32–35] and references therein).

Theorem 3. *The eccentric connectivity index of the , for , is given bywhere be the number of ’s succeeding the last in .*

*Proof. *Let be the corresponding to . Then, the vertices representing all ’s preceding the first and all ’s succeeding the last are of eccentricity two, whereas the eccentricity of each of the remaining vertices is three. The vertices and in are adjacent if and only if represents and represents , such that the position of in is greater than the position of in . This implies that the contribution to the eccentric connectivity index from the vertices in represents(i)’s in the first block is , as each vertex corresponding to has degree (ii)’s succeeding the last is (where is the number of ’s succeeding the last ) as each vertex corresponding to such has degree and(iii)The remaining ’s and ’s in is , since the sum of the degrees of all vertices in is Therefore,Now, if and for , then , and is of eccentricity one and degree and each is of eccentricity two and degree one. Therefore,Similarly, if and , and is of eccentricity one and degree , while each is of eccentricity two and degree one. Thus, . Again, if and , then , and both vertices have eccentricity one and degree one and so . Hence the result.

*Remark 1. *It can be seen that the total eccentricity index of the , for , is given bywhere is the number of ’s succeeding the last in .

Theorem 4. *The eccentric connectivity index of a with for the word for is bounded above by and below by where**The upper bound is attained on when , on when and on when , while the lower bound is attained on .*

*Proof. *Since , using Theorem 3, the eccentric connectivity index will be a maximum if is as large as possible, while and are as small as possible. Here, is the number of ’s succeeding the last in . It is known [10] that for a binary word when . The word has the maximum number of subwords , and so the eccentric connectivity index of the corresponding to this word is maximum but only when . We note that and , and the word is a core word by the hypothesis. When , it can be verified that this word fails to provide the maximum eccentric connectivity index for the corresponding due to the fact that all the vertices in the of have only eccentricity 2. When , which is the largest number nearer to the maximum , the word has subwords , while the vertices in the corresponding to the first and the next in this word have eccentricity 3 and degrees and , respectively. The eccentric connectivity index of the corresponding to this word is maximum when but only when . When and , it can be verified that the word fails to provide the maximum eccentric connectivity index for the corresponding . On the other hand, the word has the minimum value 1 for and and has as many *a*’s as possible to the left and as many *b*’s as possible to the right of the word, thus providing maximum degrees for the vertices in the corresponding to the *a*’s and *b*’s in which have eccentricity 3. In fact, more formally, for , , we can show thatIn order to maximize this expression with the constraint , we have to minimize the negative terms, and so we have to take and , while for . Note that we cannot choose as there are number of *a*’s. Hence, it may be observed that for given values of and , the maximum value of is attained on one of the three words , or whose corresponding PWRGs have their eccentric connectivity indices as , respectively. Note that when , while the expression is the difference . Hence, the maximum value is attained on when , on when , and on , when and .

On the other hand, for , is minimum when is minimum, and this happens for with minimum when . Hence, the minimum value of is attained on .

Theorem 5. *The total eccentricity index of a with for the word for is bounded above by and below by . This upper bound is attained on , for any word , where . In particular, it is achieved on . The lower bound is achieved on .*

*Proof. *If is the number of ’s following the last in , it is clear that the maximum value of is attained when and the minimum is attained when . Hence the result.

Yet another topological index, called eccentricity connectivity coindex [36, 37] of a connected graph, is defined as the eccentricity sum of all nonadjacent vertex pairs in the graph. We consider this index here for PWRGs.

*Definition 5. *[36, 37] The eccentric connectivity coindex of a connected graph with edge set is defined aswhere is the eccentricity of the vertex of .

Theorem 6. *The eccentric connectivity coindex of the , for for is given bywhere is the number of ’s succeeding the last in .*

*Proof. *It has been shown [36, 37] that which can be written as , where is the number of vertices in the graph and is the eccentricity of the vertex . If and , then the vertices corresponding to the first block ’s and ’s succeeding the last are of eccentricity two, and the remaining vertices are of eccentricity three.

Therefore,Now, if for and , then the vertex corresponding to is of eccentricity one and the remaining vertices are of eccentricity two.

Therefore, .

Now, if , then the vertex corresponding to is of eccentricity one and the remaining vertices are of eccentricity two. Then, .

If , then.

#### 4. An Illustration

Bipartite graphs have been used in investigating structural features in the areas of molecular biology and chemistry (for example, [38, 39]). We consider here a complete bipartite graph , with the bipartition of the vertices such that and . The graph is a corresponding to the word over the alphabet .

First, we observe the following facts relating to .(i)For , and , we have , (ii)In the graph , there are unordered pairs of vertices , unordered pairs of vertices , and unordered pairs of vertices (iii)The degree of each vertex is , and the degree of each vertex is .

We now illustrate the computation of the topological indices considered in the earlier sections, both directly from the definition and from the formulae in Theorems 1, 3, and Remark 1.

The Harary index of , by direct computation from the definition, is

The same value is obtained from the formula for the Harary index, namely, , since .

The eccentric connectivity index of by direct computation from the definition, is

The same value is obtained from the formula for the eccentric connectivity index, namely, where is the number of *b*’s succeeding the last and is the number of *a*’s prior to the first in , so that .

The total eccentricity index of , by direct computation from the definition, is

The same value is obtained from the formula for the total eccentricity index, namely, , where .

The eccentric connectivity coindex of , by direct computation (using the modified expression for the eccentric connectivity coindex given in the proof of Theorem 6), iswhere is the number of vertices in the graph , so that

The same value is obtained from the formula for the eccentric connectivity coindex, namely,

#### 5. Conclusion

The distance-based topological indices considered in this study have been extensively investigated by researchers for different classes of graphs, and so we were motivated to study these indices for a recently introduced special class of graphs, called PWRGs. An advantage of this study is that this provides a link between two different areas of research, namely, word combinatorics and graph theory. Specifically, we have obtained expressions for evaluating certain distance-based topological indices for PWRGs [14] of binary core words and established bounds on their values when the vertex set is fixed. It will be of interest to study bounds on these indices when the number of edges is fixed.

#### Data Availability

The data used to support the findings of this study are included within the article.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

The authors would like to thank the reviewers for their very useful comments which helped to revise the study and improve the presentation of the study.