Table of Contents
Fetching ...

Random Graph Generation in Context-Free Graph Languages

Federico Vastarini, Detlef Plump

TL;DR

The paper addresses uniform random sampling of hypergraphs from context-free hypergraph languages specified by hyperedge replacement grammars (HRGs). It extends Mairson's CFG sampling approach to HRGs in CNF, introducing a preprocessing phase that builds counting matrices and a generation phase that, under non-ambiguity, yields uniformly distributed samples in $O(n^2)$ time. Key contributions include a CNF transformation framework for HRGs, a practical two-phase sampling algorithm, and a formal uniformity proof for $n$-unambiguous grammars, with implications for graph-based testing and domains like term graphs and molecule representations. This method enables controlled, uniform generation of structured graph inputs, supporting robust testing and cryptographic explorations in graph-structured domains.

Abstract

We present a method for generating random hypergraphs in context-free hypergraph languages. It is obtained by adapting Mairson's generation algorithm for context-free string grammars to the setting of hyperedge replacement grammars. Our main results are that for non-ambiguous hyperedge replacement grammars, the method generates hypergraphs uniformly at random and in quadratic time. We illustrate our approach by a running example of a hyperedge replacement grammar generating term graphs.

Random Graph Generation in Context-Free Graph Languages

TL;DR

The paper addresses uniform random sampling of hypergraphs from context-free hypergraph languages specified by hyperedge replacement grammars (HRGs). It extends Mairson's CFG sampling approach to HRGs in CNF, introducing a preprocessing phase that builds counting matrices and a generation phase that, under non-ambiguity, yields uniformly distributed samples in time. Key contributions include a CNF transformation framework for HRGs, a practical two-phase sampling algorithm, and a formal uniformity proof for -unambiguous grammars, with implications for graph-based testing and domains like term graphs and molecule representations. This method enables controlled, uniform generation of structured graph inputs, supporting robust testing and cryptographic explorations in graph-structured domains.

Abstract

We present a method for generating random hypergraphs in context-free hypergraph languages. It is obtained by adapting Mairson's generation algorithm for context-free string grammars to the setting of hyperedge replacement grammars. Our main results are that for non-ambiguous hyperedge replacement grammars, the method generates hypergraphs uniformly at random and in quadratic time. We illustrate our approach by a running example of a hyperedge replacement grammar generating term graphs.
Paper Structure (7 sections, 3 theorems, 3 equations, 7 figures, 1 table, 2 algorithms)

This paper contains 7 sections, 3 theorems, 3 equations, 7 figures, 1 table, 2 algorithms.

Key Result

Lemma 3.1

There exists an algorithm that for every hyperedge replacement grammar $G$ produces a grammar $G'$ in $\textit{CNF}$ such that $L(G) = L(G')$.

Figures (7)

  • Figure 1: A term graph
  • Figure 2: An ambiguous hyperedge replacement grammar for term graphs
  • Figure 3: A non-ambiguous hyperedge replacement grammar for term graphs
  • Figure 4: $\textit{CNF}$ of the grammar in Figure \ref{['fig:tggrammar']}
  • Figure 5: Starting grammar for the proof of CNF equivalence.
  • ...and 2 more figures

Theorems & Definitions (7)

  • Lemma 3.1
  • proof
  • proof
  • Theorem 4.1
  • proof
  • Theorem 4.2
  • proof