# How to compute the Wiener index of a graph

- First Online:

- Received:
- Accepted:

DOI: 10.1007/BF01167206

- Cite this article as:
- Mohar, B. & Pisanski, T. J Math Chem (1988) 2: 267. doi:10.1007/BF01167206

- 40 Citations
- 226 Downloads

## Abstract

The Wiener index of a graph*G* is equal to the sum of distances between all pairs of vertices of*G*. It is known that the Wiener index of a molecular graph correlates with certain physical and chemical properties of a molecule. In the mathematical literature, many good algorithms can be found to compute the distances in a graph, and these can easily be adapted for the calculation of the Wiener index. An algorithm that calculates the Wiener index of a tree in linear time is given. It improves an algorithm of Canfield, Robinson and Rouvray. The question remains: is there an algorithm for general graphs that would calculate the Wiener index without calculating the distance matrix? Another algorithm that calculates this index for an arbitrary graph is given.