Papers
Topics
Authors
Recent
Search
2000 character limit reached

Graph Extension Grammars (GEGs)

Updated 1 April 2026
  • Graph Extension Grammars are a formalism using graph algebras and regular tree grammars to specify and parse labeled, directed graphs with non-structural reentrancies.
  • They combine binary union and unary extension operations to enable arbitrary node-sharing, crucial for modeling phenomena in semantic representations such as AMR.
  • GEGs offer a tractable, polynomial-time parsing algorithm that employs memoization and profile matching to efficiently fuse graph components during derivation.

Graph Extension Grammars (GEGs) are a formalism introduced to address the expressive and computational requirements of generating and parsing languages of directed, node- and edge-labelled graphs, particularly supporting non-structural reentrancies as found in semantic representations such as Abstract Meaning Representation (AMR). A GEG consists of an algebra over graphs—incorporating specific graph operations—and a regular tree grammar that generates expressions over these operations. The resulting framework allows specification of sets of graphs with both rich structural constraints and tractable polynomial-time parsing (Björklund et al., 2021).

1. Formal Structure of Graph Extension Grammars

A GEG is fundamentally composed of two interlocked components: (i) a graph-extension algebra specifying operations over families of typed, labelled graphs, and (ii) a regular tree grammar generating terms over those operations. The graph domains are defined as follows:

Let Σn\Sigma_n be a finite set of node-labels and Σe\Sigma_e a finite set of edge-labels. For each nonnegative integer τ\tau, Gτ\mathbb{G}_\tau is the set of all finite, directed, node- & edge-labelled graphs G=(V,E,,port)G = (V, E, \ell, port) with port=τ|port| = \tau, where:

  • VV is a finite set of nodes,
  • EV×Σe×VE \subseteq V \times \Sigma_e \times V,
  •  ⁣:VΣn\ell \colon V \to \Sigma_n,
  • portVτport \in V^\tau is a sequence of Σe\Sigma_e0 (possibly repeating) nodes called the ports.

The union Σe\Sigma_e1 collects all such graphs, parameterized by type Σe\Sigma_e2.

Operations in the Signature

The signature Σe\Sigma_e3 comprises two key forms:

  • Binary union operations Σe\Sigma_e4, which yield disjoint unions (up to renaming) and concatenate ports.
  • Unary extension operations Σe\Sigma_e5 specified by tuples

Σe\Sigma_e6

where Σe\Sigma_e7 is a graph of type Σe\Sigma_e8; Σe\Sigma_e9 is a sequence of τ\tau0 dock-nodes; τ\tau1 is the set of "clonable" context nodes. These are subject to: - (R1) All edge sources in τ\tau2 are from τ\tau3, - (R2) Every non-port node in τ\tau4 is a target of some edge in τ\tau5.

Extension τ\tau6 is of type τ\tau7 where τ\tau8, τ\tau9. The operation Gτ\mathbb{G}_\tau0 acts nondeterministically by attaching new structure and enabling node-fusion as described below.

The algebra is completed by including the constant operator for the empty graph Gτ\mathbb{G}_\tau1 of type 0.

Algebraic Semantics

A graph-extension algebra is a many-sorted algebra

Gτ\mathbb{G}_\tau2

with Gτ\mathbb{G}_\tau3 and the above-specified operations, producing sets of graphs. Reachability is enforced: every node of every generated graph is reachable from some port-node.

2. Regular Tree Grammar Mechanism

A GEG employs a regular, many-sorted tree grammar Gτ\mathbb{G}_\tau4 with finitely many nonterminals Gτ\mathbb{G}_\tau5, each assigned a type Gτ\mathbb{G}_\tau6. Productions are of the form

Gτ\mathbb{G}_\tau7

where Gτ\mathbb{G}_\tau8 has type Gτ\mathbb{G}_\tau9. The generated tree language G=(V,E,,port)G = (V, E, \ell, port)0 encodes valid sequences of operations.

A full GEG is then

G=(V,E,,port)G = (V, E, \ell, port)1

with associated graph language

G=(V,E,,port)G = (V, E, \ell, port)2

obtained by recursively mapping derivation trees to their semantic value in the algebra.

Evaluation of G=(V,E,,port)G = (V, E, \ell, port)3 proceeds by induction:

  • Base: If G=(V,E,,port)G = (V, E, \ell, port)4, G=(V,E,,port)G = (V, E, \ell, port)5.
  • Union: If G=(V,E,,port)G = (V, E, \ell, port)6, then G=(V,E,,port)G = (V, E, \ell, port)7.
  • Extension: If G=(V,E,,port)G = (V, E, \ell, port)8 with G=(V,E,,port)G = (V, E, \ell, port)9 of type port=τ|port| = \tau0, then port=τ|port| = \tau1.

3. Non-Structural Reentrancy Modelling

GEGs natively support non-structural reentrancy, a key limitation of prior devices like hyperedge-replacement grammars where only context-free attachments are possible. Non-structural reentrancy refers to allowing nodes in a partially constructed graph to appear multiple times as targets of newly introduced edges, a necessity for capturing phenomena such as shared arguments or referents in AMR.

This is realized in the GEG formalism via the set port=τ|port| = \tau2 of clonable context-nodes within each unary extension operation port=τ|port| = \tau3. When port=τ|port| = \tau4 is applied:

  • Each port=τ|port| = \tau5 can be cloned an arbitrary number of times (non-deterministically).
  • Each clone is injectively merged ("fused") to a distinct node of port=τ|port| = \tau6 with the same node-label.
  • This process enables one or several new outgoing edges from operations to point to the same node(s) in port=τ|port| = \tau7, thus creating arbitrary non-structural reentrancies.

The use of port=τ|port| = \tau8 thus controls and enables the expressive generativity over non-structural reentrancies—an essential feature missing from many prior graph grammar formalisms.

4. Parsing Algorithms and Complexity

The challenge of parsing a given graph port=τ|port| = \tau9 with respect to a GEG VV0 is to decide whether VV1. This is determined via the existence of a derivation tree VV2 and an assignment of semantic values yielding exactly VV3. GEGs provide a polynomial-time parsing algorithm, summarized as follows:

  • The principal recursive routine VV4 tests whether the induced subgraph from port-sequence VV5 in VV6 is derivable by nonterminal VV7.
  • Results are memoized in a table VV8.
  • Union productions and extension rules are handled with explicit splitting or matching logic.
  • Matching for extension rules involves fusing dock-nodes to the graph at VV9 and considering all ways context-clones may merge, while preserving labels and the "clone only clonable" constraint.

Data Structures and Efficiency

Key data structures include:

  • Profiles EV×Σe×VE \subseteq V \times \Sigma_e \times V0 for nodes in EV×Σe×VE \subseteq V \times \Sigma_e \times V1,
  • Likewise, EV×Σe×VE \subseteq V \times \Sigma_e \times V2 for nodes in the operation's underlying graph, to efficiently check compatibility during matching and merging.

Complexity Summary

With EV×Σe×VE \subseteq V \times \Sigma_e \times V3 and EV×Σe×VE \subseteq V \times \Sigma_e \times V4, the algorithm executes in time EV×Σe×VE \subseteq V \times \Sigma_e \times V5, primarily determined by the combinatorics of ports and clones. Under additional unambiguity constraints on profiles, complexity can be reduced to EV×Σe×VE \subseteq V \times \Sigma_e \times V6 or even linear time, as per corollaries in the primary reference (Björklund et al., 2021).

Parsing Step Complexity Key Limitation/Optimization
Memo table computation EV×Σe×VE \subseteq V \times \Sigma_e \times V7
Union production handling EV×Σe×VE \subseteq V \times \Sigma_e \times V9 Constant number per nonterminal
Extension handling (naive)  ⁣:VΣn\ell \colon V \to \Sigma_n0 Filters via profile comparison
Overall (optimized)  ⁣:VΣn\ell \colon V \to \Sigma_n1 Profile constraints

5. Representative Example: Reentrant Graph Generation

Consider a minimal GEG showcasing non-structural reentrancy:

  • Node labels:  ⁣:VΣn\ell \colon V \to \Sigma_n2,
  • Edge labels:  ⁣:VΣn\ell \colon V \to \Sigma_n3,
  • Extension op  ⁣:VΣn\ell \colon V \to \Sigma_n4 of type  ⁣:VΣn\ell \colon V \to \Sigma_n5:
    •  ⁣:VΣn\ell \colon V \to \Sigma_n6,
    •  ⁣:VΣn\ell \colon V \to \Sigma_n7,  ⁣:VΣn\ell \colon V \to \Sigma_n8,  ⁣:VΣn\ell \colon V \to \Sigma_n9,
    • portVτport \in V^\tau0,
    • portVτport \in V^\tau1.
  • The regular tree grammar uses nonterminals portVτport \in V^\tau2 (type 1), portVτport \in V^\tau3 (type 1), portVτport \in V^\tau4 (type 0), with productions:
    • portVτport \in V^\tau5
    • portVτport \in V^\tau6
    • portVτport \in V^\tau7

In a derivation sequence, repeated applications of portVτport \in V^\tau8 followed by union yield a graph portVτport \in V^\tau9 (of type 1) with a "b"-node and two parallel Σe\Sigma_e00-edges targeting a single "a"-node. Here, the arbitrary cloning and merging induced by Σe\Sigma_e01 enables this reentrancy structure, directly modeling the non-structural scenario within the formalism (Björklund et al., 2021).

GEGs make several advances within the family of generative graph formalisms:

  • In comparison to hyperedge-replacement grammars, GEGs transcend the context-free model by enabling arbitrary (non-structural) node-sharing.
  • The extension mechanism is inspired in part by concepts such as adaptive star grammars (notably the "cloning" device) (Björklund et al., 2021).
  • The framework is directly motivated by requirements from natural language processing, particularly representations such as AMR, which routinely employ non-structural reentrancies.
  • The computational tractability of parsing distinguishes GEGs among more expressive, but intractable, grammar variants.

Connections to prior work include foundational treatments in graph grammar theory [Courcelle & Engelfriet, 2012], as well as device comparisons with weighted DAG automata for semantic graphs [Chiang et al., 2018].

7. References

  • Björklund, Henrik; Drewes, Frank; Jonsson, Peter: "Polynomial Graph Parsing with Non-Structural Reentrancies" (Björklund et al., 2021)
  • Courcelle, B.; Engelfriet, J.: Graph Structure and MSO Logic (2012).
  • Drewes, F.; et al.: Adaptive Star Grammars (2010).
  • Chiang, D.; et al.: Weighted DAG Automata for Semantic Graphs (2018).
Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Graph Extension Grammars (GEGs).