Next Article in Journal
Grid Frequency and Amplitude Control Using DFIG Wind Turbines in a Smart Grid
Next Article in Special Issue
Weighted Wiener Indices of Molecular Graphs with Application to Alkenes and Alkadienes
Previous Article in Journal
The Variational Iteration Transform Method for Solving the Time-Fractional Fornberg–Whitham Equation and Comparison with Decomposition Transform Method
Previous Article in Special Issue
Chemical Graph Theory for Property Modeling in QSAR and QSPR—Charming QSAR & QSPR
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Linear Algorithms for the Hosoya Index and Hosoya Matrix of a Tree

Faculty of Natural Sciences and Mathematics, University of Maribor, SI-2000 Maribor, Slovenia
Mathematics 2021, 9(2), 142; https://doi.org/10.3390/math9020142
Submission received: 3 November 2020 / Revised: 28 December 2020 / Accepted: 8 January 2021 / Published: 11 January 2021
(This article belongs to the Special Issue Recent Advances in Chemical Graph Theory and Their Applications)

Abstract

:
The Hosoya index of a graph is defined as the total number of its independent edge sets. This index is an important example of topological indices, a molecular-graph based structure descriptor that is of significant interest in combinatorial chemistry. The Hosoya index inspires the introduction of a matrix associated with a molecular acyclic graph called the Hosoya matrix. We propose a simple linear-time algorithm, which does not require pre-processing, to compute the Hosoya index of an arbitrary tree. A similar approach allows us to show that the Hosoya matrix can be computed in constant time per entry of the matrix.

1. Introduction

In Haruo Hosoya’s seminal paper, a molecular-graph based structure descriptor is proposed that nowadays is known under the name Hosoya index [1]. It is well-known that several physicochemical properties of chemical structures are well correlated with the Hosoya index of the corresponding molecular graphs. In particular, it is used to predict, from the structure of molecules, some of their physico-chemical properties such as boiling points, entropies, heat of vaporization, and π -electron energy [1,2].
The mathematical investigations on the Hosoya index are often related to trees, see for example [3,4,5,6,7,8]. Note also that there is a strong connection between the energy of a tree and its Hosoya index [9]. It is established that the general problem of determining the Hosoya index is #P-complete even for planar graphs [10]. On the other hand, if the graph is known to be a tree, there are efficient solutions.
In [11], Zhang and co-authors proposed an algorithm that allows computation of the Hosoya index of a tree in linear time. The algorithm uses a relatively complex pre-processing which for a given tree computes the Prüfer code of the corresponding labeled tree. As noted already by the authors, another troublesome aspect of the proposed algorithm is its necessity of computation with fractions. Moreover, it was shown in [12] that the values of the characteristic polynomial of a tree can be computed in linear time, which implies that a computation of the Hosoya index of a tree can be done within the same time-bound; however, an explicit algorithm has not been presented.
It has been demonstrated that the Hosoya index can be computed efficiently for some graphs derived from trees. In particular, for an arbitrary tree T, a closed-form expression is presented for the Hosoya index of the fractal graphs R ( T ) and R T ( T ) [13].
Since a graph is entirely determined by specifying either its adjacency structure or its incidence structure, it is natural to state the specification of a graph in matrix form. By associating a matrix with a graph, one can also use selected graph invariants as molecular descriptors. This approach was initiated in a work by Randić, where a matrix based on another well-known molecular-graph structure descriptor, the Wiener index, is proposed [14]. Later, Randić used an analogous approach, based on the Hosoya index, for acyclic systems, which yields the concept of the Hosoya matrix [15].
The paper is organized as follows. In the next section, we give some definitions and concepts needed in this paper. In Section 3, we follow the idea presented in [12] to give a recursive expression for the Hosoya index of a tree. Using this result, we present a linear-time algorithm for computing the Hosoya index of a graph of this class. In Section 4, we apply the previous section’s approach to provide a recursive formula for an entry of the Hosoya matrix. The results allow the computation of the Hosoya matrix in constant time per entry of the matrix.

2. Preliminaries

Let G = ( V , E ) be a graph, possessing n vertices and m edges. The set of edges X E ( G ) is called a matching of G if any two edges of X have no vertex in common. A matching of G with k edges is called a k-matching of G.
A subset of vertices I V ( G ) is independent if no two vertices of I are adjacent. The number of distinct k-element independent vertex sets is denoted by n ( G , k ) . Note that n ( G , 0 ) = 1 and n ( G , n ) = n .
The Hosoya index of a graph G, denoted by Z ( G ) , is defined as the total number of matchings of G. Let m ( G , k ) be the number of k-matchings of G and set m ( G , 0 ) : = 1 . The Hosoya index can be formulated as
Z ( G ) : = k 0 m ( G , k ) .
Let G = ( V , E ) be a graph and V V ( G ) . Then G V denotes the graph obtained from G by removing vertices of V . If V = { v } , i.e., V is composed of a single vertex, we will write G v instead of G { v } . Analogously, if and E E ( G ) , then G E denotes the graph obtained from G by removing vertices of E . If E = { e } , we will write G e instead of G { e } .
A tree is a connected graph without cycles. If u , v are vertices of a tree T, then T admits exactly one path between u and v. We shall denote this path by P u v .
Let T be a tree with the vertex set V ( T ) = { 1 , 2 , , n } . The Hosoya matrix of a tree T is the n × n matrix H ( T ) , where ( i , j ) -entry of H ( T ) is the Hosoya index of the graph obtained from T by removing the edges of the path P i j [15]. More formally, if i , j { 1 , 2 , , n } , then
H i , j ( T ) = Z ( T E ( P i j ) ) , i j 0 , i = j .
Let v be a vertex of a graph G. Then N G ( v ) or simply N ( v ) denote the set of vertices adjacent to v in G.
A rooted tree is a tree in which one vertex is distinguished from the others and called the root. If r is a root of a tree T, then T r denotes the corresponding rooted tree. Let v r be a vertex of T r . As already stated, P r v denotes the path between r and v in T r . If u is a vertex of P r v adjacent to v, then u is a parent of v and v is a child of u. If u is a parent of v and w parent of u, then w is a grandparent of v. Note that every vertex of a rooted tree admits at most one parent and grandparent. A vertex z is a descendant of v if v is in the path from z to r. A vertex v of a tree T, and all its descendants induce a subgraph of T r denoted by T v r . It is clear that T v r is a tree. Note that T v r can be seen as a rooted subtree of T r with the root v.
If v is a vertex of T r , then C r ( v ) denotes the set of children of v. If v r , let p r ( v ) denote the parent of v. If C r ( v ) = , then v is a leaf of T r .

3. Hosoya Index

3.1. Recursive Formula for Computing the Hosoya Index

The results of this subsection are obtained by using an approach similar to the work of Mohar where the characteristic polynomial of a tree is studied [12].
The following three results are well-known [1,16].
Proposition 1.
Let u v be an edge of a graph G. Then
Z ( G ) = Z ( G u v ) + Z ( G { u , v } ) .
Proposition 2.
Let G be a graph composed of two disjoint components G 1 and G 2 . Then
Z ( G ) = Z ( G 1 ) Z ( G 2 ) .
Proposition 3.
Let v be a vertex of a graph G. Then
Z ( G ) = Z ( G v ) + u N ( v ) Z ( G { u , v } ) .
We also need the following
Proposition 4.
Let v and u be vertices of a tree T. Then
(i)
Z ( T v ) = w C v ( v ) Z ( T w v ) .
(ii) If v is the parent of u in T v , then
Z ( T { u , v } ) = Z ( T v ) Z ( T u v u ) Z ( T u v ) = Z ( T u v u ) w C v ( v ) Z ( T w v ) Z ( T u v ) ,
where
Z ( T u v u ) = 1 , u is a leaf x C v ( u ) Z ( T x v ) , otherwise .
Proof. 
(i) If T is a single vertex, the claim immediately follows. Otherwise, note that N T ( v ) = C v ( v ) . It follows that T v is composed of connected components T w v , for all w C v ( v ) . Proposition 2 now yields the assertion.
(ii) We can see that T { v , u } is composed of two sets of connected components: one corresponds to components of T v with the exception of T u v , while the other corresponds to T u v u . Let us denote the first set of connected components by ( T v ) \ T u v . By (i), we have
Z ( ( T v ) \ T u v ) = w C v ( v ) \ { u } Z ( T w v ) w C v ( v ) Z ( T w v ) Z ( T u ) = Z ( T v ) Z ( T u v ) .
From Proposition 2 now it follows that
Z ( T { u , v } ) = Z ( ( T v ) \ T u v ) Z ( T u v u ) = Z ( T v ) Z ( T u v u ) Z ( T u v ) .
If u is a leaf, then T { v , u } is the graph composed of connected components T w v , for all w C v ( v ) \ { u } . Since Z ( T u v u ) = 1 , the case is settled.
If u is not a leaf, then T { v , u } is the graph composed of connected components T w v and T x v , for all w C v ( v ) \ { u } and x C v ( u ) . From Proposition 2 and (i) then it follows
Z ( T { u , v } ) = x C v ( u ) Z ( T x v ) w C v ( v ) Z ( T w v ) Z ( T u v ) .
This assertion concludes the proof. □
Theorem 1.
Let v and r be (not necessarily distinct) vertices of a tree T. Then
Z ( T v r ) = 1 , v is a leaf w C r ( v ) Z ( T w r ) + u C r ( v ) Z ( T u r u ) w C r ( v ) Z ( T w r ) Z ( T u r ) , otherwise
where
Z ( T u r u ) = 1 , u is a leaf of T r x C r ( u ) Z ( T x r ) , otherwise .
Proof. 
If v is a leaf, then T v r is a single vertex and the case is settled.
If v is not a leaf, then note that N T v r ( v ) = C r ( v ) . By Proposition 3, we have Z ( T v r ) = Z ( T v r v ) + u C r ( v ) Z ( T v r { u , v } ) . Proposition 4 now completes the proof. □

3.2. Algorithm for Computing the Hosoya Index

Let v be a vertex of a nonempty tree T. The data structure of the rooted tree T v is given by Algorithm 1, where C v and p v represent the list of children of v and the parent of v in T v , respectively.
Algorithm 1. Rooted(T, v, C, p)
1. C v := the list comprised of all vertices of N ( v ) ;
2. For all w N ( v ) do
 begin
   2.1 Remove v from N ( w ) ;
   2.2 Rooted(T, w, C);
   2.3 p w : = v ;
 end;
end.
Let v be a vertex of T and w N ( v ) . If N ( w ) is represented by a (doubly connected) adjacency list, then we may remove v from N ( w ) in constant time. It is easy to see now that the time complexity of Rooted is linear.
Algorithm 2 computes the Hosoya index Z v of a tree T with respect to a root v. Before the algorithm is applied, the algorithm Rooted is called for the vertex v. Thus, for every vertex u in T v , the rooted tree is represented by the list of children C u .
Algorithm 2. Hosoya(v, C, Z, Z ¯ )
1. Z ¯ v : = 1 ;
2. if | C v | = 0 then begin Z v : = 1 ; EXIT; end;
3. for all w C v do
  Hosoya(w, C, Z, Z ¯ );
4. for all w C v do
   Z ¯ v : = Z ¯ v · Z w ;
5. Z v : = Z ¯ v ;
6. for all u C v do
  begin
  6.1 z u : = 1 ;
  6.2 if | C u | > 0 then
   6.2.1 for all x C u do
       z u : = z u · Z x ;
  6.3 Z v : = Z v + z u · Z ¯ v / Z u ;
end;
end.
Theorem 2.
Let T be tree of order n. Then algorithm Hosoya computes the Hosoya index of T in O ( n ) time and space.
Proof. 
The validity of the algorithm follows from Theorem 1. The algorithm computes vectors Z and Z ¯ , such that the entry Z v (resp. Z ¯ v ) represents Z ( T ) (resp. Z ( T v ) ) . The algorithm also maintains the variable z u , which for u C v ( u ) represents the value of x C v ( u ) Z ( T x v ) .
If v is a leaf in T, then | C v | = 0 and Z v is set to one. Otherwise, the algorithm is recursively called for each child of v in Step 3. Note that the call of the algorithm for a vertex w computes the Hosoya index of the corresponding subtree T w v . Thus, after Step 3 is executed, the Hosoya index is already computed for all subtrees of v. Next, w C v ( v ) Z ( T w v ) is computed in Step 4. This gives the initial value of Z v assigned in Step 5, while the sum u C v ( v ) Z ( T u v u ) w C v ( v ) Z ( T w v ) Z ( T u v ) is computed in Step 6. Steps 6.1 and 6.2 compute the value of Z ( T u v u ) . If u is a leaf, then | C u | = 0 and the value of z u remains equal to one. Otherwise, the value of z u is equal to x C v ( u ) Z ( T x v ) after Step 6.2 is executed. In Step 6.3, the value of z u is multiplied by Z ¯ v and divided by Z u ; thus, the value added to Z v in this step is equal to Z ( T u v u ) / Z u w C v ( v ) Z ( T w v ) . This assertion completes the proof of the correctness of the algorithm.
For the time complexity first note that the time complexity of a single recursive call neglecting recursive calls (in Step 3) and neglecting the Steps 4 and 6 is clearly constant. Since the number of recursive calls of the algorithm equals the number of vertices of the tree, we have to show that the total number of operations executed in Steps 4 and 6 is linear in the number of vertices. This number can bounded above by the number of entries of the vector Z used by the algorithm. In Step 4, the values of Z w , w C v are used, while in Step 6.2.1, for u C v , the entries Z x , x C u are used. Since every vertex v of a rooted tree admits at most one parent and grandparent, the corresponding entry Z v is used at most three times: twice when Hosoya is called for the parent of v (Steps 4 and 6.3) and once when Hosoya is called for the grandparent of v (Step 6.2.1).
It follows that the total number of operations executed in Steps 4 and 6 is bounded above with some constant multiplied by the number of vertices of T.
Since the space complexity of the algorithm is clearly linear, the proof is complete. □
Note that the parameter p of the algorithm Rooted as well as the parameter Z ¯ of the algorithm Hosoya are not used for the computation of the Hosoya index. These parameters will be needed in the next section.

3.3. Example

As an example of the execution of the algorithm Hosoya observe the three T with the vertex set { 1 , 2 , , 11 } depicted in Figure 1. We demonstrate the algorithm for the root 4. Note that before the algorithm is applied, the algorithm Rooted is called for the vertex 4.
Since 4 is not a leaf, the algorithm is recursively called for the vertices 3, 8, and 11 (the neighbors of 4) in Step 3. The recursion stops when a leaf is reached and the corresponding entry of the vector Z is set to one. We therefore obtain Z 1 = Z 5 = Z 6 = Z 7 = Z 9 = Z 10 = 1 . For the vertex 2 we then obtain Z ¯ 2 = Z 1 · Z 5 = 1 · 1 = 1 in Step 4. Since C 1 and C 5 are both empty, Step 6.2.1 is never executed and z u remains equal to one. The final value Z 2 = 3 is therefore obtained in Step 6.3, where for the vertices 1 and 5 the value one is added to the current value of Z 2 . Analogously, for the vertex 3 we obtain Z ¯ 3 = Z 2 · Z 6 = 3 · 1 = 3 in Step 4. Since C 2 = { 1 , 5 } , we have z u = Z 1 · Z 5 = 1 · 1 = 1 for u = 2 and z u = 1 for u = 6 in Step 6.2. Finally, for u = 2 and u = 6 we add z u · Z ¯ 3 / Z 2 = 1 · 3 / 3 = 1 and z u · Z ¯ 3 / Z 6 = 1 · 3 / 3 = 3 to Z 3 in Step 6.3. These operations give Z 3 = 7 . The other values are obtained in an analogous manner. Thus, we obtain Z 8 = 2 , Z 11 = 3 , and Z 4 = 95 . The Hosoya index of a (sub)tree T v 4 (resp. the value of Z ( T v 4 v ) ) is shown at the upper left-hand side (resp. the right hand side) of the vertex v in Figure 1.
An intuitive explanation of the algorithm Hosoya for a tree T rooted at r is as follows.
  • All the entries of the vector Z that correspond to leaves of T r are set to one.
  • If v is a vertex of T r such that the Hosoya indices are already computed for all descendants of v, the computation of Z v goes as follows:
    (a)
    we multiply the Hosoya indices of all children of v and get the value of Z ( T v r v ) which is also the initial value of Z v ;
    (b)
    for every child u of v we multiply the Hosoya indices of all children of u and the Hosoya indices of all children of v with the exception of u. The obtained product is added to the current value of Z v .
Consider again the rooted tree T 4 in Figure 1 and suppose that the Hosoya indices are already computed for all descendants of 4. For Step a., we obtain the initial value of Z 4 , which equals Z 3 · Z 8 · Z 11 = 7 · 2 · 3 = 42 . For Step b., we have
Z 4 = 42 + Z 2 · Z 6 · Z 8 · Z 11 + Z 3 · Z 7 · Z 11 + Z 3 · Z 8 · Z 9 · Z 10 = 95 .

4. Hosoya Matrix

We will show that the Hosoya matrix of a tree of order n can be computed in O ( n 2 ) time.

4.1. Recursive Formula for Computing the Hosoya Matrix

Proposition 5.
If u v is an edge of a tree T, then
Z ( T u v ) = Z ( T V ( T u v ) ) Z ( T u v )
= Z ( T ) Z ( T v ) Z ( T u v u ) T u v .
Proof. 
Note first that T u v is composed of two connected components: T V ( T u ) and T u v . Proposition 2 yields
Z ( T u v ) = Z ( T V ( T u v ) ) Z ( T u v ) .
By Proposition 1, we have
Z ( T u v ) = Z ( T ) Z ( T { u , v } ) .
The assertion now follows immediately from Proposition 4. □
Theorem 3.
If P = v 1 , v 2 , , v k is a path in a tree T, then
Z ( T E ( P ) ) = ( Z ( T v k 1 v 1 ) Z ( T v k 1 v 1 v k 1 ) Z ( T v k v 1 v k ) Z ( T v k v 1 ) ) i = 1 k 2 Z ( T v i v 1 v i v i + 1 ) Z ( T v i + 1 v 1 ) .
Proof. 
If k = 2 , then this is Proposition 5.
If k > 2 , we first show that T E ( P ) is composed of connected components: T V ( T v 2 ) , T v 2 v 1 V ( T v 3 v 1 ) , , T v k 2 v 1 V ( T v k 1 v 1 ) , and the graph T v k 1 v 1 v k 1 v k . We use induction on k. If k = 3 , then T v 1 v 1 E ( P ) = T v 1 { v 1 v 2 , v 2 v 3 } is a graph composed of components: T V ( T v 2 v 1 ) and T v 2 v 1 v 1 v 2 . Let us assume that the proposition holds for all paths of length less than k, and let P = v 1 , v 2 , , v k 1 and P = v 1 , v 2 , , v k . By the induction hypothesis, T E ( P ) is composed of components T V ( T v 2 v 1 ) , T v 2 v 1 V ( T v 3 v 1 ) , , T v k 3 v 1 V ( T v k 2 v 1 ) , and T v k 2 v 1 v k 2 v k 1 . Since T v k 2 v 1 v k 2 v k 1 is composed of two connected components, T v k 2 v 1 V ( T v k 1 v 1 ) and T v k 1 v 1 , and since the edge v k 1 v k belongs to the tree T v k 1 v 1 , the assertion easily follows.
By Proposition 5, we have
Z ( T v i v 1 V ( T v i + 1 v 1 ) ) = Z ( T v i v 1 v i v i + 1 ) Z ( T v i + 1 v 1 )
and
Z ( T v k 1 v 1 v k 1 v k ) = Z ( T v k 1 v 1 ) Z ( T v k 1 v 1 v k 1 ) Z ( T v k v 1 v k ) Z ( T v k v 1 ) .
Since T E ( P ) is composed of connected components: T V ( T v 2 ) , T v 2 v 1 V ( T v 3 v 1 ) , , T v k 2 v 1 V ( T v k 1 v 1 ) , and the graph T v k 1 v 1 v k 1 v k , Proposition 2 completes the proof. □
Corollary 1.
Let P = v 1 , v 2 , , v k be a path in a tree T. If
Z k : = Z ( T v k 1 v 1 ) Z ( T v k 1 v 1 v k 1 ) Z ( T v k v 1 v k ) Z ( T v k v 1 )
and
P k : = 1 , k = 2 Z k 1 Z ( T v k 1 v 1 ) P k 1 , k 3 ,
then
Z ( T E ( P ) ) = Z k P k .
Proof. 
By Theorem 3, we have to show that P k = i = 1 k 2 Z ( T v i v 1 v i v i + 1 ) Z ( T v i + 1 v 1 ) . We use induction on k. If k = 2 , then P k = 1 and the assertion is trivial. Let k 3 and assume that the claim holds for k 1 . By Proposition 5,
Z ( T v k 2 v 1 v k 2 v k 1 ) = Z ( T v k 2 v 1 ) Z ( T v k 2 v 1 v k 2 ) Z ( T v k 1 v 1 v k 1 ) Z ( T v k 1 v 1 ) = Z k 1 .
It follows
P k = Z k 1 Z ( T v k 1 v 1 ) P k 1 = Z ( T v k 2 v 1 v k 2 v k 1 ) Z ( T v k 1 v 1 ) P k 1 .
Since by the induction hypothesis we have
P k 1 = i = 1 k 3 Z ( T v i v 1 v i v i + 1 ) Z ( T v i + 1 v 1 ) ,
the assertion follows. □

4.2. Algorithm for Computing the Hosoya Matrix

Algorithm 3 computes the entries of the r-th row of the Hosoya matrix for the tree T. In other words, the algorithm for the rooted tree T r computes the value H r , v for every v V ( T ) . If v is a vertex of T r , the list C v represents the children of v, while p v represent the parent of v. Vectors Z and Z ¯ for entries Z v and Z ¯ represent Z ( T v ) and Z ( T v v ) in T r , respectively.
Algorithm 3. Row(v, r, C, p, Z, Z ¯ , H )
1. if v = r then
begin
  1.1 P k : = 1 ;
  1.2 Z k : = Z v ;
  1.3 H r , v : = 0 ;
end
2. else
begin
  2.1 P k : = P k · Z k Z p v ;
  2.2 Z k : = Z p v Z ¯ p v Z ¯ v Z v ;
  2.3 H r , v : = Z k · P k ;
end;
3. for all w C v do
  Row(w, r, C, p, Z, Z ¯ , H );
end.
Proposition 6.
Let r { 1 , 2 , , n } be a vertex of a tree T. Then algorithm Row computes the r-th row of the Hosoya matrix of T in linear time.
Proof. 
The correctness of the algorithm is based on Corollary 1. Note that p v and C v represent the parent of v and the children of v, respectively. The algorithm maintains variables Z k and P k representing the values Z k and P k of Corollary 1, respectively. We first consider the following two cases.
A. If v = r , the correctness easily follows. The algorithm sets the values of P k and Z k to one and Z v , respectively.
B. If r is the parent of v, the value of P k remains equal to one after Step 2.1 is executed, since Z k is set to Z ( T r ) in case A. The new value of Z k is established in Step 2.2., while Step 2.3 provides the correct value of H r , v .
Since in the above cases the correct value of P k is computed, the correctness for other cases follows from Corollary 1.
For the time complexity, note that the number of recursive calls of the algorithm equals the number of vertices of T r . Since the time complexity of a single call of the algorithm (neglecting the recursive calls) is constant, the assertion follows. □
Algorithm 4 computes the Hosoya matrix H for the tree T with the vertex set V ( T ) = { 1 , 2 , , n } .
Algorithm 4. Hosoya matrix(T, H )
1. for i : = 1 ton do
  begin
  1.1 Rooted(T, i, C, p);
  1.2 Hosoya(i, Z, C, Z ¯ );
  1.3 Row(i, i, C, p, Z, Z ¯ , H );
  end;
end.
Theorem 4.
Let T be tree of order n. Then algorithm Hosoya matrix computes the Hosoya matrix of T in O ( n 2 ) time and space.
Proof. 
For every vertex i V ( T ) = { 1 , 2 , , n } , the algorithm creates the rooted tree T i in Step 1.1. The needed values Z ( T v ) and Z ( T v v ) are then computed for every vertex v of T i in Step 1.2. Finally, all entries of the i-th row of the Hosoya matrix are computed in Step 1.3.
Since the time complexity of the algorithms Rooted, Hosoya, and Row is linear, the time and space bound of the algorithm Hosoya matrix easily follow. □

4.3. Example

Observe again the three T with the vertex set { 1 , 2 , , 11 } depicted in Figure 1. We demonstrate the execution of the algorithm Row for the vertex 4 in the sequel. Note that before the algorithm is applied, the algorithm Hosoya, which computes the vectors Z and Z ¯ , is called for the vertex 4.
  • v = 4 : P k = 1 , Z k = Z 4 = 96 , H 4 , 4 = 0 .
  • v = 3 : P k = 1 · 95 95 = 1 , Z k = 95 42 · 3 7 = 77 , H 4 , 3 = 77 .
  • v = 2 : P k = 1 · 77 7 = 11 , Z k = 7 3 · 1 3 = 6 , H 4 , 2 = 66 .
  • v = 1 : P k = 11 · 6 3 = 22 , Z k = 3 1 · 1 1 = 2 , H 4 , 1 = 44 .
  • v = 5 : P k = 11 · 6 3 = 22 , Z k = 3 1 · 1 1 = 2 , Z 4 , 5 = 44 .
  • v = 6 : P k = 1 · 77 7 = 11 , Z k = 7 3 · 1 1 = 4 , H 4 , 6 = 44 .
  • v = 8 : P k = 1 · 95 95 = 1 , Z k = 95 42 · 1 2 = 74 , H 4 , 8 = 74 .
  • v = 7 : P k = 1 · 74 2 = 37 , Z k = 2 1 · 1 1 = 1 , H 4 , 7 = 37 .
  • v = 11 : P k = 1 · 95 95 = 1 , Z k = 95 42 · 1 3 = 81 , H 4 , 11 = 81 .
  • v = 9 : P k = 1 · 81 3 = 27 , Z k = 3 1 · 1 1 = 2 , H 4 , 9 = 54 .
  • v = 10 : P k = 1 · 81 3 = 27 , Z k = 3 1 · 1 1 = 2 , H 4 , 10 = 54 .

5. Conclusions

Quantitative structure–property and structure–activity relationships of molecular compounds are frequently modeled using the molecular topological features of these compounds. In that regard, topological indices are crucial for investigating chemical compounds to grasp chemical structures’ fundamental topology.
In this paper, we have obtained efficient algorithms for computing the Hosoya index and the Hosoya matrix on an arbitrary acyclic graph. Both algorithms are optimal in the sense that the running time of an algorithm is constant per a fundamental essential item of the input: a vertex (for the computation of the Hosoya index) and an entry of the matrix (for the computation of the Hosoya matrix). The complexity of the presented algorithm for computing the Hosoya index of a tree is within the same time bound as some previously presented procedures. That said, the algorithm presented in this paper is much simpler than its predecessor given in [11] and does not require pre-processing.
It is worth noticing that both presented algorithms exploit the recursive nature of a tree. Thus, a similar approach could be applied for computing the Hosoya index and the Hosoya matrix of tree-like graphs, e.g., cactus graphs, and of graphs derived from trees. Moreover, the presented concepts could initiate studies of efficient methods of computation for other topological indices, especially the ones that are closely connected to the Hosoya index, particularly the Merrifield–Simons index [17,18], the energy of a graph [3], and the matching energy of a graph [19].

Funding

This work was supported by the Slovenian Research Agency under the grants P1-0297, J1-9109, J1-2452, and J1-1693.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The author declares no conflict of interest.

References

  1. Hosoya, H. A newly proposed quantity characterizing the topological nature of structural isomers of saturated hydrocarbons. Bull. Chem. Soc. Jpn. 1971, 44, 2332–2339. [Google Scholar] [CrossRef] [Green Version]
  2. Hosoya, H. The topological index Z before and after 1971. Internet Electron. J. Mol. Des. 2002, 1, 428–442. [Google Scholar] [CrossRef] [Green Version]
  3. Andriantiana, E.O.D. Energy, Hosoya index and Merrifield-Simmons index of trees with prescribed degree sequence. Discret. Appl. Math. 2013, 161, 724–741. [Google Scholar] [CrossRef]
  4. Hua, H. On maximal energy and hosoya index of trees without perfect matching. Bull. Aust. Math. Soc. 2010, 81, 47–57. [Google Scholar] [CrossRef] [Green Version]
  5. Kazemi, R.; Behtoei, A. Hosoya index of tree structures. Trans. Comb. 2020, 9, 161–169. [Google Scholar]
  6. Tian, W.; Zhao, F.; Sun, Z.; Mei, X.; Chen, G. Orderings of a class of trees with respect to the Merrifield–Simmons index and the Hosoya index. J. Comb. Optim. 2019, 38, 1286–1295. [Google Scholar] [CrossRef]
  7. Chen, X.; Zhang, J.; Sun, W. On the Hosoya index of a family of deterministic recursive trees. J. Phys. A Stat. Mech. Appl. 2017, 465, 449–453. [Google Scholar] [CrossRef]
  8. Xiao, C.; Chen, H. Kekulé structures of square–hexagonal chains and the Hosoya index of caterpillar trees. Discret. Math. 2016, 339, 506–510. [Google Scholar] [CrossRef]
  9. Heuberger, C.; Wagner, S.G. Chemical Trees Minimizing Energy and Hosoya Index. J. Math. Chem. 2009, 46, 214–230. [Google Scholar] [CrossRef] [Green Version]
  10. Jerrum, M. Two-dimensional monomer-dimer systems are computationally intractable. J. Stat. Phys. 1987, 48, 121–134. [Google Scholar] [CrossRef]
  11. Zhang, J.; Chen, X.; Sun, W. A Linear-Time Algorithm for the Hosoya Index of an Arbitrary Tree. MATCH Commun. Math. Comput. Chem. 2016, 75, 703–714. [Google Scholar]
  12. Mohar, B. Computing the characteristic polynomial of a tree. J. Math. Chem. 1989, 3, 403–406. [Google Scholar] [CrossRef]
  13. Liu, J.-B.; Zhao, J.; Min, J.; Cao, J. The Hosoya index of graphs formed by a fractal graph. Fractals 2019, 27, 1950135. [Google Scholar] [CrossRef]
  14. Randić, M. Novel molecular descriptor for structure–property studies. Chem. Phys. Lett. 1993, 211, 478–483. [Google Scholar] [CrossRef]
  15. Randić, M. Hosoya matrix—A source of new molecular descriptors. Croat. Chem. Acta 1994, 67, 415–429. [Google Scholar]
  16. Gutman, I.; Plavšić, D.; Šoškić, M.; Landeka, I.; Graovac, A. On the Calculation of the Path Numbers 1Z, 2Z and the Hosoya Z Index. Croat. Chem. Acta 1997, 70, 941–954. [Google Scholar]
  17. Wagner, S.; Gutman, I. Maxima and minima of the Hosoya index and the Merrifeld-Simmons index. Acta. Appl. Math. 2010, 112, 323–346. [Google Scholar] [CrossRef]
  18. Huang, Y.; Shi, L.; Xu, X. The Hosoya index and the Merrifield–Simmons index. J. Math. Chem. 2018, 56, 3136–3146. [Google Scholar] [CrossRef] [Green Version]
  19. Chen, H.; Deng, H. Extremal bipartite graphs of given connectivity with respect to matching energy. Discret. Appl. Math. 2018, 239, 200–205. [Google Scholar] [CrossRef]
Figure 1. Hosoya indices in T 4 .
Figure 1. Hosoya indices in T 4 .
Mathematics 09 00142 g001
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Vesel, A. Linear Algorithms for the Hosoya Index and Hosoya Matrix of a Tree. Mathematics 2021, 9, 142. https://doi.org/10.3390/math9020142

AMA Style

Vesel A. Linear Algorithms for the Hosoya Index and Hosoya Matrix of a Tree. Mathematics. 2021; 9(2):142. https://doi.org/10.3390/math9020142

Chicago/Turabian Style

Vesel, Aleksander. 2021. "Linear Algorithms for the Hosoya Index and Hosoya Matrix of a Tree" Mathematics 9, no. 2: 142. https://doi.org/10.3390/math9020142

APA Style

Vesel, A. (2021). Linear Algorithms for the Hosoya Index and Hosoya Matrix of a Tree. Mathematics, 9(2), 142. https://doi.org/10.3390/math9020142

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop