Journal of Mathematical Chemistry

, Volume 2, Issue 3, pp 267–277 | Cite as

How to compute the Wiener index of a graph

  • Bojan Mohar
  • Tomaž Pisanski


The Wiener index of a graphG is equal to the sum of distances between all pairs of vertices ofG. 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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A.V. Aho, J.E. Hopcroft and J.D. Unman,The Design and Analysis of Computer Algorithms (Addison-Wesley, Reading, MA, 1974).Google Scholar
  2. [2]
    M. Bersohn, A fast algorithm for calculation of the distance matrix of a molecule, J. Comput. Chem. 4 (1983)110.CrossRefGoogle Scholar
  3. [3]
    D. Bonchev, O. Mekenyan, G. Protić and N. Trinajstićf, J. Chromatogr. 176 (1979)149.CrossRefGoogle Scholar
  4. [4]
    J.A. Bandy and U.S.R. Marty,Graph Theory with Applications (North- Holland, New York, 1976).Google Scholar
  5. [5]
    E.R. Canfield, W.R. Robinson and D.H. Rouvray, Determination of the Wiener molecular branching index for the molecular tree, J. Comput. Chem. 6 (1985)598.CrossRefGoogle Scholar
  6. [6]
    A. Graovac and T. Pisanski, On the Wiener index of a graph, submitted for publication.Google Scholar
  7. [7]
    E.L. Lawler,Combinatorial Optimization: Networks and Matroids (Halt, Rinehart and Winston, New York, 1976).Google Scholar
  8. [8]
    I. Motos and A.T. Balaban, Topological indices: Intercorrelations, physical meaning, correlational ability, Rev. Roumanie Chim. 26 (1981)593.Google Scholar
  9. [9]
    W.R. Müller, K. Szymanski, J.V. Knop and N. Trinajstić, An algorithm for construction of the molecular distance matrix, J. Comput. Chem. 8 (1987)170.CrossRefGoogle Scholar
  10. [10]
    C.H. Papadiruitriou and K. Steiglitz,Combinatorial Optimization: Algorithms and Complexity (Premise-Hall, Englewood Cliffs, NJ, 1982).Google Scholar
  11. [11]
    D. Papazova, M. Dimov and D. Bonchev, J. Chromatogr. 188 (1980)297.CrossRefGoogle Scholar
  12. [12]
    D.H. Rouvray, The role of' graph-theoretical invariants in chemistry, Congr. Numer 55 (1986)253.Google Scholar
  13. [13]
    D.H. Rouvray, Should we have designs on topological indices? in:Chemical Applications of Topology and Graph Theory, ed. R.B. King (Elsevier, Amsterdam, 1983) pp. 159–177.Google Scholar
  14. [14]
    D.H. Rouvray, Predicting chemistry from topology, Sci. Amer. 254 (1986)40.CrossRefGoogle Scholar
  15. [15]
    D.H. Rouvray, The role of topological distance matrix in chemistry, in:Mathematics and Computational Concepts in Chemistry, ed. N. Trinajstić (Horwood, Chichester, UK, 1986) Ch. 25, pp. 295–306.Google Scholar
  16. [16]
    D.H. Rouvray and B.C. Crafford, South Afr. J. Sci 72 (1976)74.Google Scholar
  17. [17]
    D.H. Rouvray and W. Tatong, Z. Naturforsch. 41a (1986)1238.Google Scholar
  18. [18]
    LT Stiel and G. Thodos, Amer. Inst. Chem. Eng. 18 (1962)527.CrossRefGoogle Scholar
  19. [19]
    M.M. Syslo, N. Deo and J.S. Kowalik,Discrete Optimization Algorithms (Prentice-Hall, Englewood Cliffs, NJ, 1983).Google Scholar
  20. [20]
    N. Trinajstić,Chemical Graph Theory, Vol. II (CRC Press, Florida, 1983) Ch, 4.Google Scholar
  21. [21]
    H. Wiener, Structural determination of paraffin boiling points, J. Amer. Chem. Soc. 69 (1947)17.CrossRefGoogle Scholar
  22. [22]
    H. Wiener, I Chem. Phys. 15 (1947)766.Google Scholar

Copyright information

© J.C. Baltzer AO, Scientific Publishing Company 1988

Authors and Affiliations

  • Bojan Mohar
    • 1
    • 2
  • Tomaž Pisanski
    • 1
    • 2
  1. 1.Department of Ma theima ticsUniversity E.K. of LjubljanaLjubljanaYugoslavia
  2. 2.Department of Mathematics and StatisticsSimon Fraser UniversityBurnabyCanada

Personalised recommendations