Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Graph rewriting

From Wikipedia, the free encyclopedia
Creating a new graph from an existing graph

Incomputer science,graph transformation, orgraph rewriting, concerns the technique of creating a newgraph out of an original graph algorithmically. It has numerous applications, ranging fromsoftware engineering (software construction and alsosoftware verification) tolayout algorithms 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 graphrewriting system usually consists of a set of graph rewrite rules of the formLR{\displaystyle L\rightarrow R}, withL{\displaystyle L} being called pattern graph (or left-hand side) andR{\displaystyle R} 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 thesubgraph isomorphism problem) and by replacing the found occurrence by an instance of the replacement graph. Rewrite rules can be further regulated in the case oflabeled graphs, such as in string-regulated graph grammars.

Sometimesgraph grammar is used as a synonym forgraph rewriting system, especially in the context offormal 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

[edit]
Top: Example graph rewrite rule (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

[edit]

The algebraic approach to graph rewriting is based uponcategory theory. The algebraic approach is further divided into sub-approaches, the most common of which are thedouble-pushout (DPO) approach and thesingle-pushout (SPO) approach. Other sub-approaches include thesesqui-pushout and thepullback approach.

From the perspective of the DPO approach a graph rewriting rule is a pair ofmorphisms in the category of graphs andgraph homomorphisms between them:r=(LKR){\displaystyle r=(L\leftarrow K\rightarrow R)}, also writtenLKR{\displaystyle L\supseteq K\subseteq R}, whereKL{\displaystyle K\rightarrow L} isinjective. The graph K is calledinvariant or sometimes thegluing graph. Arewriting step orapplication of a rule r to ahost graph G is defined by twopushout diagrams both originating in the samemorphismk:KD{\displaystyle k\colon K\rightarrow D}, where D is acontext graph (this is where the namedouble-pushout comes from). Another graph morphismm:LG{\displaystyle m\colon L\rightarrow G} models an occurrence of L in G and is called amatch. Practical understanding of this is thatL{\displaystyle L} is a subgraph that is matched fromG{\displaystyle G} (seesubgraph isomorphism problem), and after a match is found,L{\displaystyle L} is replaced withR{\displaystyle R} in host graphG{\displaystyle G} whereK{\displaystyle K} serves as an interface, containing the nodes and edges which are preserved when applying the rule. The graphK{\displaystyle K} 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 graphG{\displaystyle G}.

In contrast a graph rewriting rule of the SPO approach is a single morphism in the category oflabeled multigraphs andpartial mappings that preserve the multigraph structure:r:LR{\displaystyle r\colon L\rightarrow R}. Thus a rewriting step is defined by a singlepushout 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 (thisdangling 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, calledmatrix graph grammars.[1]

Determinate graph rewriting

[edit]

Yet another approach to graph rewriting, known asdeterminate graph rewriting, came out oflogic anddatabase theory.[2] 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

[edit]

Another approach to graph rewriting isterm graph rewriting, which involves the processing or transformation of term graphs (also known asabstract 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'soperational 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 performautomated 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

[edit]

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

[edit]

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

[edit]

References

[edit]

Citations

[edit]
  1. ^Perez 2009 covers this approach in detail.
  2. ^"A Graph-Oriented Object Model for Database End-User Interfaces"(PDF).
  3. ^"TERMGRAPH".

Sources

[edit]
Imperative
Structured
Object-oriented
Declarative
Functional
Dataflow
Logic
Domain-
specific
language

(DSL)
Concurrent,
parallel
Metaprogramming
Separation
of concerns
Comparisons/Lists
Retrieved from "https://en.wikipedia.org/w/index.php?title=Graph_rewriting&oldid=1330545793"
Category:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp