Simple rectangle-based functional programs for computing reflexive-transitive closures

  • Authors:
  • Rudolf Berghammer;Sebastian Fischer

  • Affiliations:
  • Institut für Informatik, Christian-Albrechts-Universität Kiel, Kiel, Germany;Institut für Informatik, Christian-Albrechts-Universität Kiel, Kiel, Germany

  • Venue:
  • RAMiCS'12 Proceedings of the 13th international conference on Relational and Algebraic Methods in Computer Science
  • Year:
  • 2012

Quantified Score

Hi-index 0.00

Visualization

Abstract

We show how to systematically derive simple purely functional algorithms for computing the reflexive-transitive closure of directed graphs. Directed graphs can be represented as binary relations and we develop our algorithms based on a relation-algebraic description of reflexive-transitive closures. This description employs the relation-algebraic notion of rectangles and instantiating the resulting algorithm with different kinds of rectangles leads to different algorithms for computing reflexive-transitive closures. Using data refinement, we then develop simple Haskell programs for two specific choices of rectangles and show that one of them has cubic runtime like an imperative implementation of Warshall's standard algorithm.