On the Floyd-Warshall Algorithm for Logic Programs

We explore the possibility of evaluating single-rule Datalog programs efficiently and with logarithmic work space by a natural extension of the Floyd–Warshall algorithm for transitive closure. We characterize exactly the single rule chain programs that can be so evaluated – they are rather modest generalizations of the transitive closure. The proof relies on an interesting language-theoretic concept, total ambiguity. Extensions to more general classes of programs, and more general algorithms, are discussed.