Logic of Programs 1983: Logics of Programs pp 421-441 | Cite as

Deriving efficient graph algorithms (summary)

  • John H. Reif
  • William L. Scherlis
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 164)


Ten years ago Hopcroft and Tarjan discovered a class of very fast algorithms for solving graph problems such as biconnectivity and strong connectivity. While these depth-first-search algorithms are complex and can be difficult to understand, the problems they solve have simple combinatorial definitions that can themselves be considered algorithms, though they might be very inefficient or even infinitary. We demonstrate here how the efficient algorithms can be systematically derived using program transformation steps from the initial definitions. This is the first occasion that these efficient graph algorithms have been systematically derived.

There are several justifications for this work. First, the derivations illustrate several high-level principles of program derivation and suggest methods by which these principles can be realized as sequences of program transformation steps. Second, we believe that the evolutionary approach used in this paper offers more natural explanations of the algorithms than the usual a posteriori proofs that appear in textbooks. Third, these examples illustrate how external domain-specific knowledge can enter into the program derivation process. Finally, we believe that future programming tools will be semantically based and are likely to have their foundations in a logic of program derivation. By working through complex examples such as those presented here, we make steps towards a conceptual and formal basis for these tools.


Undirected Graph Defense Advance Research Project Agency Tree Edge Biconnected Component Articulation Edge 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [AHU74]
    Aho, A. V., J. E. Hopcroft, and J. D. Ullman, The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
  2. [AHU83]
    Aho, A. V., J. E. Hopcroft, and J. D. Ullman, Data Structures and Algorithms. Addison-Wesley, 1983.Google Scholar
  3. [Barstow80]
    Barstow, D. R., The roles of knowledge and deduction in algorithm design. Yale Research Report178, April 1980.Google Scholar
  4. [Bauer81]
    Bauer, F. L., et al., Programming in a wide spectrum language: a collection of examples. Science of Computer Programming, Vol. 1, pp. 73–114, 1981.Google Scholar
  5. [Bird80]
    Bird, R. S., Tabulation techniques for recursive programs. Computing Surveys, Vol. 12, No. 4, pp. 403–417, 1980.Google Scholar
  6. [Boyer75]
    Boyer, R. S. and J. S. Moore, Proving theorems about LISP functions. Journal of the ACM, Vol. 22, No. 1, 1975.Google Scholar
  7. [Burstall77]
    Burstall, R. M. and J. Darlington, A transformation system for developing recursive programs. Journal of the ACM, Vol. 24, No. 1, pp. 44–67, 1977.Google Scholar
  8. [Clark78]
    Clark, K., Negation as failure. In: Logic and Databases. Gallaire, H., and J. Minker, eds., Plenum, 1978.Google Scholar
  9. [Clark80]
    Clark, K. and J. Darlington, Algorithm classification through synthesis. Computer Journal, Vol. 23, No. 1, 1980.Google Scholar
  10. [Gordon79]
    Gordon, M. J., Milner, A. J., and C. P. Wadsworth, Edinburgh LCF. Springer-Verlag Lecture Notes in Computer Science, 1979.Google Scholar
  11. [Green78]
    Green C. C. and D. R. Barstow, On program synthesis knowledge. Artificial Intelligence, Vol. 10, p. 241, 1978.Google Scholar
  12. [Knuth74]
    Knuth D. E., Structured programming with goto statements. Computing Surveys, Vol. 6, No. 4, pp. 261–301, 1974.Google Scholar
  13. [Manna79]
    Manna Z. and R. Waldinger, Synthesis: dreams ⇒ programs. IEEE Transactions on Software Engineering, Vol. SE-5, No. 4, July 1979.Google Scholar
  14. [Manna81]
    Manna Z. and R. Waldinger, Deductive synthesis of the unification algorithm. Science of Computer Programming, Vol. 1, pp. 5–48, 1981.Google Scholar
  15. [Paige81]
    Paige, R. and S. Koenig, Finite differencing of computable expressions. ACM Transactions on Programming Languages and Systems, Vol. 4, No. 3, pp. 402–454, 1982.Google Scholar
  16. [Reiter78]
    Reiter, R., On closed world data bases. In: Logic and Databases. Gallaire, H., and J. Minker, eds., Plenum, 1978.Google Scholar
  17. [Scherlis80]
    Scherlis, W. L., Expression procedures and program derivation. Ph. D. thesis, Stanford University, 1980.Google Scholar
  18. [Scherlis81]
    Scherlis, W. L., Program improvement by internal specialization. Eighth Symposium on Principles of Programming Languages, pp. 41–49, 1981.Google Scholar
  19. [Tarjan72]
    Tarjan, R. E., Depth first search and linear graph algorithms. SIAM Journal of Computing, Vol. 1, No. 2, pp. 146–160, 1972.Google Scholar
  20. [Tarjan73]
    Tarjan, R. E., Testing flow graph reducibility. Fifth ACM Symposium on the Theory of Computing, pp. 96–107, 1973.Google Scholar
  21. [Tarjan77]
    Tarjan, R. E., Complexity of combinatorial algorithms. Stanford Computer Science Report, 1977.Google Scholar
  22. [Wand80]
    Wand M., Continuation-based program transformation strategies. Journal of the ACM, Vol. 27, No. 1, pp. 164–180, 1980.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1984

Authors and Affiliations

  • John H. Reif
    • 1
  • William L. Scherlis
    • 2
  1. 1.Aiken Computation LaboratoryHarvard UniversityUSA
  2. 2.Department of Computer ScienceCarnegie-Mellon UniversityUSA

Personalised recommendations