Combining relation algebra and data refinement to develop rectangle-based functional programs for reflexive-transitive closures

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 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 running time like Warshall's standard algorithm. Finally, we apply our approach to other standard operations of relation algebra and present graph theoretic applications of our developments.

[1]  Gerald Penn,et al.  Efficient transitive closure of sparse matrices over closed semirings , 2006, Theor. Comput. Sci..

[2]  Maurisa Thompson Rectangles , 2014 .

[3]  John Launchbury,et al.  Structuring depth-first search algorithms in Haskell , 1995, POPL '95.

[4]  Sebastian Fischer,et al.  Implementing Relational Specifications in a Constraint Functional Logic Language , 2007, WFLP.

[5]  Gunther Schmidt,et al.  Relations and Graphs: Discrete Mathematics for Computer Scientists , 1993 .

[6]  Jesús N. Ravelo Two graph algorithms derived , 1999, Acta Informatica.

[7]  Bernhard Möller,et al.  Layered Graph Traversals and Hamiltonian Path Problems - An Algebraic Approach , 1998, MPC.

[8]  Gunther Schmidt,et al.  Relational Mathematics , 2010, Encyclopedia of Mathematics and its Applications.

[9]  L. M. Graves,et al.  What is a Functional , 1948 .

[10]  Rudolf Berghammer,et al.  A Functional, Successor List Based Version of Warshall's Algorithm with Applications , 2011, RAMiCS.

[11]  R. Bird Introduction to functional programming using Haskell, Second Edition , 1998 .

[12]  J. Michael Spivey,et al.  The Z notation - a reference manual , 1992, Prentice Hall International Series in Computer Science.

[13]  Rudolf Berghammer,et al.  Development of Several Reachability Algorithms for Directed Graphs , 1987, WG.

[14]  Yangjun Chen On the Evaluation of Large and Sparse Graph Reachability Queries , 2008, DEXA.

[15]  John Launchbury,et al.  Graph Algorithms with a Functional Flavous , 1995, Advanced Functional Programming.

[16]  Rudolf Berghammer,et al.  Relational depth-first-search with applications , 2001, Inf. Sci..

[17]  Jeremy Gibbons,et al.  An Initial-Algebra Approach to Directed Acyclic Graphs , 1995, MPC.

[18]  Gerald Penn,et al.  The Algebraic Structure of Transitive Closure and its Application to Attributed Type Signatures , 2000, Grammars.

[19]  Sebastian Fischer,et al.  Simple Rectangle-Based Functional Programs for Computing Reflexive-Transitive Closures , 2012, RAMICS.

[20]  Martin Russling Deriving a Class of Layer-Oriented Graph Algorithms , 1996, Sci. Comput. Program..

[21]  Tang Pu Sen,et al.  Haskell: The Craft of Functional Programming , 2013 .

[22]  Michael Hanus,et al.  The Integration of Functions into Logic Programming: From Theory to Practice , 1994, J. Log. Program..

[23]  V. Strassen Gaussian elimination is not optimal , 1969 .

[24]  Martin Erwig,et al.  Graph Algorithms = Iteration + Data Structures? The Structure of Graph Algorithms and a Corresponding Style of Programming , 1992, WG.

[25]  M. Hanus,et al.  Curry: An Integrated Functional Logic Language , 2003 .

[26]  Rudolf Berghammer,et al.  Deriving relational programs for computing kernels by reconstructing a proof of Richardson's theorem , 2000, Sci. Comput. Program..

[27]  Rudolf Berghammer,et al.  Automated Verification of Relational While-Programs , 2014, RAMICS.

[28]  Michael L. Fredman,et al.  New Bounds on the Complexity of the Shortest Path Problem , 1976, SIAM J. Comput..

[29]  Alfred Tarski,et al.  Relational selves as self-affirmational resources , 2008 .

[30]  Gunther Schmidt A Proposal for a Multilevel Relational Reference Language , 2004 .

[31]  Gunther Schmidt Rectangles, Fringes, and Inverses , 2008, RelMiCS.

[32]  Stephen Warshall,et al.  A Theorem on Boolean Matrices , 1962, JACM.

[33]  Richard S. Bird,et al.  On Computing Representatives , 1997, Inf. Process. Lett..

[34]  Wolfram Kahl Semigroupoid Interfaces for Relation-Algebraic Programming in Haskell , 2006, RelMiCS.

[35]  Roland Carl Backhouse,et al.  Fixed-Point Calculus , 1995, Inf. Process. Lett..

[36]  Georg Struth,et al.  On Automated Program Construction and Verification , 2010, MPC.

[37]  Nikita Danilenko Using Relations to Develop a Haskell Program for Computing Maximum Bipartite Matchings , 2012, RAMICS.

[38]  Martin Erwig,et al.  Functional programming with graphs , 1997, ICFP '97.

[39]  Martin Erwig,et al.  Inductive graphs and functional graph algorithms , 2001, J. Funct. Program..

[40]  Frank Neumann,et al.  RelView - An OBDD-Based Computer Algebra System for Relations , 2005, CASC.

[41]  A. Tarski,et al.  A Formalization Of Set Theory Without Variables , 1987 .

[42]  Gunther Schmidt,et al.  Relations and Graphs , 1993, EATCS Monographs on Theoretical Computer Science.

[43]  Rudolf Berghammer,et al.  Algorithms from Relational Specifications , 1997, Relational Methods in Computer Science.