The distance matrix D = D(G) of a graph G with N vertices is the square N X N symmetric matrix whose elements are defined as-
The elements are calculated in the shortest possible distance. With this matrix Wiener index of a chemical structure can be calculated with the following formula
The calculated Wiener indices for some small molecules including cyclic, acyclic, aromatic, multiple bonds and hetero atoms are given below:
Wiener indices of some common chemical molecules.