Jump to content

Graph rewriting: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m top: fix capitalisation
References: fix ref
Line 78: Line 78:
* 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.
* 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], pp. 65–180.
* 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], pp. 65–180.
* Lobo, D. et al. (2011). ''Graph grammars with string-regulated rewriting''. [http://dx.doi.org/10.1016/j.tcs.2011.07.004 Theoretical Computer Science], 412(43), pp. 6101-6111.
* {{Cite journal| doi = 10.1016/j.tcs.2011.07.004| issn = 03043975| 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| accessdate = 2016-12-05| date = 2011-10-01 }}

[[Category:Graph rewriting]]
[[Category:Graph rewriting]]

Revision as of 15:36, 5 December 2016

In computer science, graph transformation, or graph rewriting, concerns the technique of creating a new graph out of an original graph algorithmically. It has numerous applications, ranging from software engineering (software construction and also software verification) to layout algorithms and picture generation.

Graph transformations can be used as a computation abstraction. The basic idea is that 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 , with being called pattern graph (or left-hand side) and 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 graphs, 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 languages; 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

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 (DPO) approach and the 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 morphisms in the category of graphs and graph homomorphisms between them: (or ) where 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 diagrams both originating in the same morphism , where D is a context graph (this is where the name double-pushout comes from). Another graph morphism models an occurrence of L in G and is called a match. Practical understanding of this is that is a subgraph that is matched from (see subgraph isomorphism problem), and after a match is found, is replaced with in host graph where serves as an interface, containing the nodes and edges which are preserved when applying the rule. The graph 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 .

In contrast a graph rewriting rule of the SPO approach is a single morphism in the category of labeled multigraphs and partial mappings that preserve the multigraph structure: . Thus a rewriting step is defined by a single 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.

There is also another algebraic-like approach to graph rewriting, based mainly on Boolean algebra and an algebra of matrices, called matrix graph grammars.[1][2]

Determinate graph rewriting

Yet another approach to graph rewriting, known as determinate graph rewriting, came out of logic and database theory. 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 [3] 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:

Implementations and applications

Example for graph rewrite rule (optimization from compiler construction: multiplication with 2 replaced by addition)

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.

See also

Notes

  1. ^ Perez 2009 covers this approach in detail.
  2. ^ This topic is expanded at mat2gra.info.
  3. ^ "TERMGRAPH".

References