Linear-Time Graph Programs without Preconditions

📅 2025-03-26
🏛️ Electronic Proceedings in Theoretical Computer Science
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
Graph transformation algorithms in rule-based graph programming often fail to achieve linear-time complexity on arbitrary input graphs, typically requiring restrictive assumptions such as bounded node degree or graph connectivity. Method: This paper proposes a linear-time graph program construction method that imposes no prior assumptions on input graphs. It enhances the GP 2 compiler’s in-memory graph representation to support non-destructive rewriting, introduces a root-based rewriting mechanism to eliminate costly global graph matching, and establishes an empirical performance analysis framework. Results: The approach guarantees strict O(|V| + |E|) time complexity for three canonical tasks—cycle detection, connected component labeling, and breadth-first search—on arbitrary graphs, including disconnected, high-degree, and low-degree instances. Experimental validation confirms theoretical efficiency across diverse graph topologies.

Technology Category

Application Category

📝 Abstract
We report on a recent breakthrough in rule-based graph programming, which allows us to reach the time complexity of imperative linear-time algorithms. In general, achieving the complexity of graph algorithms in conventional languages using graph transformation rules is challenging due to the cost of graph matching. Previous work demonstrated that with rooted rules, certain algorithms can be executed in linear time using the graph programming language GP 2. However, for non-destructive algorithms that retain the structure of input graphs, achieving linear runtime required input graphs to be connected and of bounded node degree. In this paper, we overcome these preconditions by enhancing the graph data structure generated by the GP 2 compiler and exploiting the new structure in programs. We present three case studies, a cycle detection program, a program for numbering the connected components of a graph, and a breadth-first search program. Each of these programs runs in linear time on both connected and disconnected input graphs with arbitrary node degrees. We give empirical evidence for the linear time complexity by using timings for various classes of input graphs.
Problem

Research questions and friction points this paper is trying to address.

Achieving linear-time complexity in graph programs
Overcoming preconditions for non-destructive algorithms
Enhancing GP 2 compiler for arbitrary graphs
Innovation

Methods, ideas, or system contributions that make the work stand out.

Enhanced GP 2 compiler graph data structure
Linear-time rooted rule-based graph transformations
Handles disconnected graphs with arbitrary degrees
🔎 Similar Papers
No similar papers found.