Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Graph rewriting
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Creating a new graph from an existing graph}} In [[computer science]], '''graph transformation''', or '''graph rewriting''', concerns the technique of creating a new [[graph (discrete mathematics)|graph]] out of an original graph algorithmically. It has numerous applications, ranging from [[software engineering]] ([[software construction]] and also [[Formal verification|software verification]]) to [[layout algorithm]]s and picture generation. Graph transformations can be used as a computation abstraction. The basic idea is that if the state of a computation can be represented as a graph, further steps in that computation can then be represented as transformation rules on that graph. Such rules consist of an original graph, which is to be matched to a subgraph in the complete state, and a replacing graph, which will replace the matched subgraph. Formally, a graph [[rewriting]] system usually consists of a set of graph rewrite rules of the form <math>L \rightarrow R</math>, with <math>L</math> being called pattern graph (or left-hand side) and <math>R</math> being called replacement graph (or right-hand side of the rule). A graph rewrite rule is applied to the host graph by searching for an occurrence of the pattern graph ([[pattern matching]], thus solving the [[subgraph isomorphism problem]]) and by replacing the found occurrence by an instance of the replacement graph. Rewrite rules can be further regulated in the case of [[labeled graph]]s, such as in string-regulated graph grammars. Sometimes '''graph grammar''' is used as a synonym for ''graph rewriting system'', especially in the context of [[formal language]]s; the different wording is used to emphasize the goal of constructions, like the enumeration of all graphs from some starting graph, i.e. the generation of a graph language – instead of simply transforming a given state (host graph) into a new state. ==Graph rewriting approaches== [[File:GraphRewriteExample color.png|thumb|''Top:'' Example graph rewrite rule ([[Program optimization#Assembly level|optimization]] from compiler construction: multiplication with 2 replaced by addition). ''Bottom:'' Application of the rule to optimize "y=x*2" into "y=x+x".]] ===Algebraic approach=== The algebraic approach to graph rewriting is based upon [[category theory]]. The algebraic approach is further divided into sub-approaches, the most common of which are the ''[[Double pushout graph rewriting|double-pushout (DPO) approach]]'' and the ''[[Single pushout graph rewriting|single-pushout (SPO) approach]]''. Other sub-approaches include the ''sesqui-pushout'' and the ''pullback approach''. From the perspective of the DPO approach a graph rewriting rule is a pair of [[morphism]]s in the category of graphs and [[graph homomorphism]]s between them: <math>r = (L \leftarrow K \rightarrow R)</math>, also written <math>L \supseteq K \subseteq R</math>, where <math>K \rightarrow L</math> is [[injective]]. The graph K is called ''invariant'' or sometimes the ''gluing graph''. A ''[[rewriting]] step'' or ''application'' of a rule r to a ''host graph'' G is defined by two [[pushout (category theory)|pushout]] diagrams both originating in the same [[morphism]] <math>k\colon K\rightarrow D</math>, where D is a ''context graph'' (this is where the name ''double''-pushout comes from). Another graph morphism <math>m\colon L\rightarrow G</math> models an occurrence of L in G and is called a ''[[Pattern matching|match]]''. Practical understanding of this is that <math>L</math> is a subgraph that is matched from <math>G</math> (see [[subgraph isomorphism problem]]), and after a match is found, <math>L</math> is replaced with <math>R</math> in host graph <math>G</math> where <math>K</math> serves as an interface, containing the nodes and edges which are preserved when applying the rule. The graph <math>K</math> is needed to attach the pattern being matched to its context: if it is empty, the match can only designate a whole connected component of the graph <math>G</math>. In contrast a graph rewriting rule of the SPO approach is a single morphism in the category of [[labeled multigraph]]s and ''partial mappings'' that preserve the multigraph structure: <math>r\colon L\rightarrow R</math>. Thus a rewriting step is defined by a single [[Pushout (category theory)|pushout]] diagram. Practical understanding of this is similar to the DPO approach. The difference is, that there is no interface between the host graph G and the graph G' being the result of the rewriting step. From the practical perspective, the key distinction between DPO and SPO is how they deal with the deletion of nodes with adjacent edges, in particular, how they avoid that such deletions may leave behind "dangling edges". The DPO approach only deletes a node when the rule specifies the deletion of all adjacent edges as well (this ''dangling condition'' can be checked for a given match), whereas the SPO approach simply disposes the adjacent edges, without requiring an explicit specification. There is also another algebraic-like approach to graph rewriting, based mainly on Boolean algebra and an algebra of matrices, called ''matrix graph grammars''.<ref>{{harvnb|Perez|2009}} covers this approach in detail.</ref> ===Determinate graph rewriting=== Yet another approach to graph rewriting, known as ''determinate'' graph rewriting, came out of [[logic]] and [[database theory]].<ref>{{cite web |url=https://www.cs.indiana.edu/~vgucht/p24-gyssens.pdf |title=A Graph-Oriented Object Model for Database End-User Interfaces}}</ref> In this approach, graphs are treated as database instances, and rewriting operations as a mechanism for defining queries and views; therefore, all rewriting is required to yield unique results ([[up to isomorphism]]), and this is achieved by applying any rewriting rule concurrently throughout the graph, wherever it applies, in such a way that the result is indeed uniquely defined. ===Term graph rewriting=== Another approach to graph rewriting is [[term graph]] rewriting, which involves the processing or transformation of term graphs (also known as ''abstract semantic graphs'') by a set of syntactic rewrite rules. Term graphs are a prominent topic in programming language research since term graph rewriting rules are capable of formally expressing a compiler's [[operational semantics]]. Term graphs are also used as abstract machines capable of modelling chemical and biological computations as well as graphical calculi such as concurrency models. Term graphs can perform [[automated verification]] and logical programming since they are well-suited to representing quantified statements in first order logic. Symbolic programming software is another application for term graphs, which are capable of representing and performing computation with abstract algebraic structures such as groups, fields and rings. The TERMGRAPH conference<ref>{{cite web |url=http://www.termgraph.org.uk/ |title=TERMGRAPH}}</ref> focuses entirely on research into term graph rewriting and its applications. ==Classes of graph grammar and graph rewriting system== Graph rewriting systems naturally group into classes according to the kind of representation of graphs that are used and how the rewrites are expressed. The term graph grammar, otherwise equivalent to graph rewriting system or graph replacement system, is most often used in classifications. Some common types are: * [[Attributed graph grammar]]s, typically formalised using either the [[single-pushout approach]] or the [[double-pushout approach]] to characterising replacements, mentioned in the above section on the algebraic approach to graph rewriting. * Hypergraph grammars, including as more restrictive subclasses [[port graph grammar]]s, [[linear graph grammar]]s and [[interaction net]]s. ==Implementations and applications== Graphs are an expressive, visual and mathematically precise formalism for modelling of objects (entities) linked by relations; objects are represented by nodes and relations between them by edges. Nodes and edges are commonly typed and attributed. Computations are described in this model by changes in the relations between the entities or by attribute changes of the graph elements. They are encoded in graph rewrite/graph transformation rules and executed by graph rewrite systems/graph transformation tools. * Tools that are application domain neutral: ** [https://web.archive.org/web/20110217171142/http://user.cs.tu-berlin.de/~gragra/agg/ AGG], the attributed graph grammar system ([[Java (programming language)|Java]]). ** [https://uoycs-plasma.github.io/GP2/ GP 2] is a visual rule-based graph programming language designed to facilitate formal reasoning over graph programs. ** [http://homepages.laas.fr/khalil/GMTE/ GMTE] {{Webarchive|url=https://web.archive.org/web/20180313184934/http://homepages.laas.fr/khalil/GMTE/ |date=2018-03-13 }}, the Graph Matching and Transformation Engine for [[graph matching]] and transformation. It is an implementation of an extension of Messmer’s algorithm using [[C++]]. ** [[GrGen|GrGen.NET]], the graph rewrite generator, a graph transformation tool emitting [[C Sharp (programming language)|C#]]-code or .NET-assemblies. ** [http://groove.cs.utwente.nl/ GROOVE], a Java-based tool set for editing graphs and graph transformation rules, exploring the state spaces of graph grammars, and model checking those state spaces; can also be used as a graph transformation engine. ** [https://github.com/Verites/verigraph/ Verigraph], a software specification and verification system based on graph rewriting ([[Haskell (programming language)|Haskell]]). * Tools that solve [[software engineering]] tasks (mainly [[Model-driven architecture|MDA]]) with graph rewriting: ** [http://emoflon.org/ eMoflon], an EMF-compliant model-transformation tool with support for [[Story-driven modeling|Story-Driven Modeling]] and Triple Graph Grammars. ** {{usurped|1=[https://web.archive.org/web/20160422081445/http://www.emorf.org/ EMorF]}} a graph rewriting system based on [[Eclipse Modeling Framework|EMF]], supporting in-place and model-to-model [[model transformation|transformation]]. ** [http://www.fujaba.de/ Fujaba] uses Story driven modelling, a graph rewrite language based on PROGRES. ** [[Graph Database|Graph databases]] often support dynamic rewriting of graphs. ** [[GReAT]]. ** [http://tinkerpop.apache.org/gremlin.html Gremlin], a graph-based programming language (see [https://github.com/tinkerpop/gremlin/wiki/Graph-Rewriting Graph Rewriting]). ** [https://www.eclipse.org/henshin/ Henshin], a graph rewriting system based on [[Eclipse Modeling Framework|EMF]], supporting in-place and model-to-model [[model transformation|transformation]], [[critical pair (logic)|critical pair analysis]], and [[model checking]]. ** [http://www.se.rwth-aachen.de/tikiwiki/tiki-index.php%3Fpage=Research%3A+Progres.html PROGRES], an integrated environment and very high level language for PROgrammed Graph REwriting Systems. ** [[VIATRA]]. * Mechanical engineering tools ** [http://www.graphsynth.com GraphSynth] is an interpreter and UI environment for creating unrestricted graph grammars as well as testing and searching the resultant language variant. It saves graphs and graph grammar rules as [[XML]] files and is written in [[C Sharp (programming language)|C#]]. ** [https://archive.today/20150317152250/https://www.soley-technology.com/en/pr-soley-studio Soley Studio], is an [[integrated development environment]] for graph transformation systems. Its main application focus is data analytics in the field of engineering. * Biology applications ** [https://grogra.de/ Functional-structural plant modeling with a graph grammar based language] ** [https://dx.doi.org/10.1016/j.tcs.2011.07.004 Multicellular development modeling with string-regulated graph grammars] ** [https://kappalanguage.org/ Kappa] is a rule-based language for modeling systems of interacting agents, primarily motivated by molecular systems biology. * Artificial Intelligence/Natural Language Processing ** [[OpenCog]] provides a basic pattern matcher (on [[hypergraph]]s) which is used to implement various AI algorithms. ** [http://wiki.opencog.org/w/RelEx RelEx] is an English-language parser that employs graph re-writing to convert a [[link grammar|link parse]] into a [[dependency grammar|dependency parse]]. * Computer programming language ** The [[Clean programming language]] is implemented using graph rewriting. ==See also== *[[Graph theory]] *[[Shape grammar]] *[[Formal grammar]] *[[Abstract rewriting]] — a generalization of graph rewriting == References == === Citations === {{Reflist}} === Sources === {{refbegin}} * {{citation |first=Grzegorz |last=Rozenberg |title=Handbook of Graph Grammars and Computing by Graph Transformations |publisher=World Scientific Publishing |volume=1–3 |year=1997 |isbn=9810228848 |url=http://www.informatik.uni-trier.de/~ley/db/conf/gg/handbook1997.html |access-date=2012-07-11 |archive-date=2013-10-04 |archive-url=https://web.archive.org/web/20131004120515/http://www.informatik.uni-trier.de/~ley/db/conf/gg/handbook1997.html |url-status=dead }}. * {{citation |first=P.P.|last=Perez|title=Matrix Graph Grammars: An Algebraic Approach to Graph Dynamics |publisher= [[VDM Verlag]] |year=2009 |isbn=978-3-639-21255-6 }}. * Heckel, R. (2006). ''Graph transformation in a nutshell''. [http://www.elsevier.com/locate/entcs Electronic Notes in Theoretical Computer Science] 148 (1 SPEC. ISS.), pp. 187–198. * König, Barbara (2004). ''Analysis and Verification of Systems with Dynamically Evolving Structure''. [http://www.fmi.uni-stuttgart.de/szs/publications/koenigba/habilschrift.pdf Habilitation thesis, Universität Stuttgart] {{Webarchive|url=https://web.archive.org/web/20070625130924/http://www.fmi.uni-stuttgart.de/szs/publications/koenigba/habilschrift.pdf |date=2007-06-25 }}, pp. 65–180. * {{cite journal | doi = 10.1016/j.tcs.2011.07.004 | issn = 0304-3975 | volume = 412 | issue = 43 | pages = 6101–6111 | last1 = Lobo | first1 = Daniel | last2 = Vico | first2 = Francisco J. | last3 = Dassow | first3 = Jürgen |title = Graph grammars with string-regulated rewriting |journal = Theoretical Computer Science |date = 2011-10-01 | doi-access = free | hdl = 10630/6716 | hdl-access = free }} * {{cite book | url=https://www.worldscientific.com/worldscibooks/10.1142/3303 | isbn=978-981-02-2884-2 | editor=Grzegorz Rozenberg | editor-link=Grzegorz Rozenberg | title=Foundations | location= | publisher=World Scientific | series=Handbook of Graph Grammars and Computing by Graph Transformation | volume=1 | date=Feb 1997 | doi=10.1142/3303 }} * {{cite book | url=https://www.worldscientific.com/worldscibooks/10.1142/4180 | isbn=978-981-02-4020-2 | editor1=Hartmut Ehrig | editor1-link=Hartmut Ehrig | editor2=Gregor Engels | editor3=Hans-Jörg Kreowski | editor3-link=Hans-Jörg Kreowski | editor4=Grzegorz Rozenberg | title=Applications, Languages and Tools | location= | publisher=World Scientific | series=Handbook of Graph Grammars and Computing by Graph Transformation | volume=2 | date=Oct 1999 | doi=10.1142/4180 }} * {{cite book | doi=10.1142/4181 | url=https://www.worldscientific.com/worldscibooks/10.1142/4181 | isbn=978-981-02-4021-9 | editor1=Hartmut Ehrig | editor2=Hans-Jörg Kreowski | editor3=Ugo Montanari | editor4=Grzegorz Rozenberg | title=Concurrency, Parallelism, and Distribution | publisher=World Scientific | series=Handbook of Graph Grammars and Computing by Graph Transformation | volume=3 | date=Aug 1999 }} {{refend}} [[Category:Graph rewriting| ]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Harvnb
(
edit
)
Template:Refbegin
(
edit
)
Template:Refend
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Usurped
(
edit
)
Template:Webarchive
(
edit
)