ArticleslgStudy

science

GrGen

GrGen is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GrGen rather than just read about it. In short: GrGen.NET is a software development tool that offers programming languages (domain-specific languages) that are optimized for the processing of graph structured data. The core of the languages consists of modular graph rewrite rules, which are built on declarative graph pattern matching and rewriting; they are supplemented by many of the constructs that are used in imperative and object-oriented programming, and are…

GrGen — main illustration
GrGen — illustration

Key takeaways

  • GrGen belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GrGen to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GrGen from memory before moving on to harder problems.

Reference excerpt

GrGen.NET is a software development tool that offers programming languages (domain-specific languages) that are optimized for the processing of graph structured data. The core of the languages consists of modular graph rewrite rules, which are built on declarative graph pattern matching and rewriting; they are supplemented by many of the constructs that are used in imperative and object-oriented programming, and are completed with language devices known from database query languages. The Graph Rewrite GENerator compiles the languages into efficient CLI assemblies (via C#-Code in an intermediate step), which can be integrated via an API into code written in any .NET-language. GrGen can be executed under Windows and Linux (Mono needed) and is open source available under LGPL v3. For rapid prototyping and debugging, an interactive shell and a (VCG-)graph viewer are included in the package. With its languages and its visual and stepwise debugging, GrGen allows one to develop at the natural level of abstraction of graph-based representations, such as those employed in engineering, model transformation, computational linguistics, or compiler construction (as intermediate representation). GrGen increases productivity for those kinds of tasks far beyond what can be achieved by programming in a traditional programming language (also because of its built-in ORM-mapper); due to many implemented performance optimizations it still allows one to achieve high-performance solutions. Its authors claim that the system offers the highest combined speed of development and execution available for the algorithmic processing of graph-based representations (based on their performance regarding diverse tasks posed at different editions of the Transformation Tool Contest (/GraBaTs)).

Specification sample Below is an example containing a graph model and rule specifications from the GrGen.NET-solution to the AntWorld-case Archived 2011-08-10 at the Wayback Machine posed at Grabats 08 Deprecated link archived 2012-11-29 at archive.today. Graph model:

node class GridNode { food:int; pheromones:int; } node class GridCornerNode extends GridNode; node class AntHill extends GridNode { foodCountdown:int = 10; } node class Ant { hasFood:boolean; }

edge class GridEdge connect GridNode[1] -> GridNode[1]; edge class PathToHill extends GridEdge; edge class AntPosition;

Rewrite rules:

rule TakeFood(curAnt:Ant) { curAnt -:AntPosition-> n:GridNode\AntHill; if { !curAnt.hasFood && n.food > 0; } modify { eval { curAnt.hasFood = true; n.food = n.food - 1; } } }

rule SearchAlongPheromones(curAnt:Ant) { curAnt -oldPos:AntPosition-> old:GridNode <-:PathToHill- new:GridNode; if { new.pheromones > 9; } modify { delete(oldPos); curAnt -:AntPosition-> new; } }

test ReachedEndOfWorld(curAnt:Ant) : (GridNode) { curAnt -:AntPosition-> n:GridNode\AntHill; negative { n <-:PathToHill-; } return (n); }

External links Homepage of the GrGen.NET-project GrGen.NET User Manual Short introduction into GrGen.NET 1.4 (outdated)

Conference papers GrGen: A Fast SPO-Based Graph Rewriting Tool/[1] - ICGT 06 Generation of Sierpinski Triangles: A Case Study for Graph Transformation Tools - AGTIVE 07 Graph Rewriting for Hardware Dependent Program Optimizations - AGTIVE 07 A First Experimental Evaluation of Search Plan Driven Graph Pattern Matching - AGTIVE 07 Customizing GrGen.NET for Model Transformation Archived 2011-06-10 at the Wayback Machine - GraMoT 08 Graph Rewrite Rules with Structural Recursion - ICGT/GCM 08

See also Graph transformation / rewriting Domain Specific Language (DSL) Source Code Generation

Illustrations

GrGen illustration
GrGen: Debugging of a sequence generating a Koch-snowflake (the rules on the left, GrShell with highlighted current rule below, yComp with highlighted match in the host graph on the right)
Debugging of a sequence generating a Koch-snowflake (the rules on the left, GrShell with highlighted current rule below, yComp with highlighted match in the host graph on the right)
GrGen: Execution of the replace step
Execution of the replace step

Worked examples

Example 1 — a first encounter with GrGen

Start with the simplest possible case. Write down what GrGen claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GrGen before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GrGen ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GrGen

In research
GrGen appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GrGen in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GrGen is common in secondary-school and first-year university syllabi. It links to neighbouring topics Domain-specific programming languages, Graph rewriting, so understanding it makes those chapters shorter.
In everyday life
Look for GrGen outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study GrGen in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GrGen means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GrGen out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GrGen in simple terms?

GrGen.NET is a software development tool that offers programming languages (domain-specific languages) that are optimized for the processing of graph structured data. The core of the languages consists of modular graph rewrite rules, which are built on declarative graph pattern matching and rewriti…

Why does GrGen matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GrGen?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GrGen.

Tags

  • Domain-specific programming languages
  • Graph rewriting

Keep exploring