L R
G:Host graph
a1:A
a2:A
b1:B b2:B b3:B
b4:B
b5:B
p1:A
p3:B
Rewriting rule
p2
l1 l2
l3
l4
l5
Figure 1: Deep exhaustive execution example.
again. In contrast, Algorithm 2 does not exits the
EXECUT E function, instead, it continues the cycle
matching the p
2
edge, and finds e.g. l
2
and so on.
4 RELATED WORK
Incremental pattern matching (Varr
´
o and Varr
´
o,
2004) is an online technique implemented in VIA-
TRA2 (Varr
´
o et al., 2006) to store parts of matches
and to reuse them in another rewriting rules within
the same transformation. Their approach uses sophis-
ticated data structures and algorithms to store matches
and to efficiently update the data structures during
the transformation. The drawback of this approach is
that it performs much computation at runtime, and the
overhead of maintaining these data structures in com-
plex cases may make the transformation even slower
compared to the non-optimized version. VIATRA2
uses a cost model to generate a search plan for the
execution of a rule. Cost calculation is based on the
creation of a search graph, which models the basic
operations of the matching as nodes, and the weight
of the connecting edges is derived from the number
of potential backtracks during matching an element.
The search plan is calculated by finding a minimum
directed spanning tree in the search graph.
The cost model of GrGen.NET (Geiß et al., 2006)
extends the solution of VIATRA2 by considering the
cost of performing a primitive step in the matching as
well. Furthermore, instead of optimization by search-
ing for a minimum directed spanning tree in the plan
graph, the solution searches for a minimum multi-
plicative directed spanning tree, minimizing thus, the
product of the costs instead of their sum, thus, they
can reach more accurate solutions.
The PROGRES (Z
¨
undorf, 1996) approach is sim-
ilar to that of VIATRA2 and GrGen.NET. However,
cost calculation does not take into account the statis-
tics of the current host graph or the properties of the
metamodel of the host graph, but uses the assump-
tions based on a typical domain the tool is planned to
be used on.
5 CONCLUSIONS
In this paper, we have presented an optimization tech-
nique for exhaustively executed rewriting rules. Deep
exhaustive execution accelerates the matching phase
of a single rule. It is based on the idea, that if the same
rule is executed repeatedly, in certain circumstances
the matching can be continued from a later point in
the algorithm without starting the complete process
anew. Although, we cannot present the measurement
results due to space limitations, depending on the type
of the host graph and the transformation rules we have
achieved even more than an order of magnitude de-
crease of the execution time. Our future research in-
terest includes elaborating more precise heuristics to
discover the applicability of the technique: deep ex-
haustive execution requires more sophisticated solu-
tions to evaluate the still valid parts of the match after
the rewriting phase.
REFERENCES
Ehrig, H., Ehrig, K., Prange, U., and Taentzer, G. (2006).
Fundamentals of Algebraic Graph Transformation
(Monographs in Theoretical Computer Science). An
EATCS Series. Springer-Verlag New York, Inc., Se-
caucus, NJ, USA.
Geiß, R., Batz, G. V., Grund, D., Hack, S., and Szalkowski,
A. (2006). Grgen: A fast spo-based graph rewriting
tool. In ICGT, pages 383–397.
OMG (2006). Object Constraint Language, version 2.0.
http://www.omg.org/technology/documents/formal/
ocl.htm.
Varr
´
o, G. and Varr
´
o, D. (2004). Graph transformation with
incremental updates. In Proc. GT-VMT 2004, Interna-
tional Workshop on Graph Transformation and Visual
Modelling Techniques, volume 109 of ENTCS, pages
71–83. Elsevier.
Varr
´
o, G., Varr
´
o, D., and Friedl, K. (2006). Adaptive
graph pattern matching for model transformations us-
ing model-sensitive search plans. In Karsai, G. and
Taentzer, G., editors, GraMot 2005, International
Workshop on Graph and Model Transformations, vol-
ume 152 of ENTCS, pages 191–205. Elsevier.
Z
¨
undorf, A. (1996). Graph pattern matching in progres. In
Selected papers from the 5th International Workshop
on Graph Gramars and Their Application to Com-
puter Science, pages 454–468, London, UK. Springer-
Verlag.
PERFORMANCE OPTIMIZATION OF EXHAUSTIVE RULES IN GRAPH REWRITING SYSTEMS
295