17 research outputs found
Rooted Graph Programs
We present an approach for programming with graph transformation rules in which programs can be as efficient as programs in imperative languages. The basic idea is to equip rules and host graphs with distinguished nodes, so-called roots, and to match roots in rules with roots in host graphs. This enables graph transformation rules to be matched in constant time, provided that host graphs have a bounded node degree (which in practice is often the case). Hence, for example, programs with a linear bound on the number of rule applications run in truly linear time. We demonstrate the feasibility of this approach with a case study in graph colouring
A Reference Interpreter for the Graph Programming Language GP 2
GP 2 is an experimental programming language for computing by graph
transformation. An initial interpreter for GP 2, written in the functional
language Haskell, provides a concise and simply structured reference
implementation. Despite its simplicity, the performance of the interpreter is
sufficient for the comparative investigation of a range of test programs. It
also provides a platform for the development of more sophisticated
implementations.Comment: In Proceedings GaM 2015, arXiv:1504.0244
Linear-Time Graph Algorithms in GP 2
GP 2 is an experimental programming language based on graph transformation rules which aims to facilitate program analysis and verification. However, implementing graph algorithms efficiently in a rule-based language is challenging because graph pattern matching is expensive. GP 2 mitigates this problem by providing rooted rules which, under mild conditions, can be matched in constant time. In this paper, we present linear-time GP 2 programs for three problems: tree recognition, binary directed acyclic graph (DAG) recognition, and topological sorting. In each case, we show the correctness of the program, prove its linear time complexity, and also give empirical evidence for the linear run time. For DAG recognition and topological sorting, the linear behaviour is achieved by implementing depth-first search strategies based on an encoding of stacks in graphs
GP 2: Efficient Implementation of a Graph Programming Language
The graph programming language GP (Graph Programs) 2 and its implementation is the subject of this thesis. The language allows programmers to write visual graph programs at a high level of abstraction, bringing the task of solving graph-based problems to an environment in which the user feels comfortable and secure. Implementing graph programs presents two main challenges. The first challenge is translating programs from a high-level source code representation to executable code, which involves bridging the gap from a non-deterministic program to deterministic machine code. The second challenge is overcoming the theoretically impractical complexity of applying graph transformation rules, the basic computation step of a graph program.
The work presented in this thesis addresses both of these challenges. We tackle the first challenge by implementing a compiler that translates GP 2 graph programs directly to C code. Implementation strategies concerning the storage and access of internal data structures are empirically compared to determine the most efficient approach for executing practical graph programs. The second challenge is met by extending the double-pushout approach to graph transformation with root nodes to support fast execution of graph transformation rules by restricting the search to the local neighbourhood of the root nodes in the host graph. We add this theoretical construct to the GP 2 language in order to support rooted graph transformation rules, and we identify a class of rooted rules that are applicable in constant time on certain classes of graphs. Finally, we combine theory and practice by writing rooted graph programs to solve two common graph algorithms, and demonstrate that their execution times are capable of matching the execution times of tailored C solutions
The Improved GP 2 Compiler
GP 2 is a rule-based programming language based on graph transformation rules
which aims to facilitate program analysis and verification. Writing efficient
programs in such a language is challenging because graph matching is expensive.
GP 2 addresses this problem by providing rooted rules which, under mild
conditions, can be matched in constant time. Recently, we implemented a number
of changes to Bak's GP 2-to-C compiler in order to speed up graph programs. One
key improvement is a new data structure for dynamic arrays called BigArray.
This is an array of pointers to arrays of entries, successively doubling in
size. To demonstrate the speed-up achievable with the new implementation, we
present a reduction program for recognising binary DAGs which previously ran in
quadratic time but now runs in linear time when compiled with the new compiler.Comment: 11 pages, 2020. arXiv admin note: substantial text overlap with
arXiv:2002.0291
A Fast Graph Program for Computing Minimum Spanning Trees
When using graph transformation rules to implement graph algorithms, a
challenge is to match the efficiency of programs in conventional languages. To
help overcome that challenge, the graph programming language GP 2 features
rooted rules which, under mild conditions, can match in constant time on
bounded degree graphs. In this paper, we present an efficient GP 2 program for
computing minimum spanning trees. We provide empirical performance results as
evidence for the program's subquadratic complexity on bounded degree graphs.
This is achieved using depth-first search as well as rooted graph
transformation. The program is based on Boruvka's algorithm for minimum
spanning trees. Our performance results show that the program's time complexity
is consistent with that of classical implementations of Boruvka's algorithm,
namely O(m log n), where m is the number of edges and n the number of nodes.Comment: In Proceedings GCM 2020, arXiv:2012.0118
Fast Rule-Based Graph Programs
Implementing graph algorithms efficiently in a rule-based language is
challenging because graph pattern matching is expensive. In this paper, we
present a number of linear-time implementations of graph algorithms in GP 2, an
experimental programming language based on graph transformation rules which
aims to facilitate program analysis and verification. We focus on two classes
of rule-based graph programs: graph reduction programs which check some graph
property, and programs using a depth-first search to test some property or
perform an operation such as producing a 2-colouring or a topological sorting.
Programs of the first type run in linear time without any constraints on input
graphs while programs of the second type require input graphs of bounded degree
to run in linear time. Essential for achieving the linear time complexity are
so-called rooted rules in GP 2, which, in many situations, can be matched in
constant time. For each of our programs, we prove both correctness and
complexity, and also give empirical evidence for their run time.Comment: 47 pages, 202