GrGen: A Fast SPO-Based Graph Rewriting Tool

  • Rubino Geiß
  • Gernot Veit Batz
  • Daniel Grund
  • Sebastian Hack
  • Adam Szalkowski
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4178)


Graph rewriting is a powerful technique that requires graph pattern matching, which is an NP-complete problem. We present GrGen, a generative programming system for graph rewriting, which applies heuristic optimizations. According to Varró’s benchmark it is at least one order of magnitude faster than any other tool known to us.

Our graph rewriting tool implements the well-founded single-pushout approach. We define the notion of search plans to represent different matching strategies and equip these search plans with a cost model, taking the present host graph into account. The task of selecting a good search plan is then viewed as an optimization problem.

For the ease of use, GrGen features an expressive specification language and generates program code with a convenient interface.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
    Garey, M.R., Johnson, D.S.: Computers and Intractability; A Guide to the Theory of NP-Completeness. W. H. Freeman & Co, New York (1990)Google Scholar
  3. 3.
    Schürr, A.: The PROGRESS Approach: Language and Environment. In: [24], vol. 2, pp. 487–550 (1999)Google Scholar
  4. 4.
    Ermel, C., Rudolf, M., Taentzer, G.: The AGG Approach: Language and Environment. In: [24], vol. 2, pp. 551–603 (1999)Google Scholar
  5. 5.
    Fujaba Developer Team: Fujaba-Homepage (2005),
  6. 6.
    Varró, G., Friedl, K., Varró, D.: Graph Transformations in Relational Databases. In: Proc. GraBaTs 2004: Intl. Workshop on Graph Based Tools. Elsevier, Amsterdam (2004)Google Scholar
  7. 7.
    Varró, G., Schürr, A., Varró, D.: Benchmarking for Graph Transformation. Technical report, Department of Computer Science and Information Theory, Budapest University of Technology and Economics (2005)Google Scholar
  8. 8.
    Batz, G.V.: Graphersetzung für eine Zwischendarstellung im Übersetzerbau. Master’s thesis, Universität Karlsruhe (2005)Google Scholar
  9. 9.
    Dörr, H.: Efficient Graph Rewriting and Its Implementation. LNCS, vol. 922. Springer, Heidelberg (1995)Google Scholar
  10. 10.
    Batz, G.V.: An Optimization Technique for Subgraph Matching Strategies. Technical Report 2006-7, Universität Karlsruhe, Fakultät für Informatik (2006)Google Scholar
  11. 11.
    Ehrig, H., Heckel, R., Korff, M., Löwe, M., Ribeiro, L., Wagner, A., Corradini, A.: Algebraic Approaches to Graph Transformation - Part II: Single Pushout Approach and Comparison with Double Pushout Approach. In: [24], vol. 1, pp. 247–312 (1999)Google Scholar
  12. 12.
    Corradini, A., Montanari, U., Rossi, F., Ehrig, H., Heckel, R., Löwe, M.: Algebraic Approaches to Graph Transformation - Part I: Basic concepts and double pushout approach. In: [24], vol. 1, pp. 163–245 (1999)Google Scholar
  13. 13.
    Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Fundamentals of Algebraic Graph Transformation. Monographs in Theoretical Computer Science. Springer, Heidelberg (2006)Google Scholar
  14. 14.
    Szalkowski, A.M.: Negative Anwendungsbedingungen für das suchprogrammbasierte Backend von GrGen, Studienarbeit, Universität Karlsruhe (2005)Google Scholar
  15. 15.
    Hack, S.: Graphersetzung für Optimierungen in der Codeerzeugung. Master’s thesis, Universität Karlsruhe (2003)Google Scholar
  16. 16.
    Grund, D.: Negative Anwendungsbedingungen für den Graphersetzer GRGEN, Studienarbeit, Universität Karlsruhe (2004)Google Scholar
  17. 17.
    Schürr, A.: Logic based programmed structure rewriting systems. Fundamenta Informaticae, Special Issues on Graph Transformations 26(3/4) (1996)Google Scholar
  18. 18.
    Zündorf, A.: Graph Pattern Matching in PROGRESS. In: Cuny, J., Engels, G., Ehrig, H., Rozenberg, G. (eds.) Graph Grammars 1994. LNCS, vol. 1073, pp. 454–468. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  19. 19.
    Rudolf, M.: Utilizing constraint satisfaction techniques for efficient graph pattern matching. In: Ehrig, H., Engels, G., Kreowski, H.-J., Rozenberg, G. (eds.) TAGT 1998. LNCS, vol. 1764, pp. 238–252. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  20. 20.
    Varró, G.: Graph transformation benchmarks page (2005),
  21. 21.
    Assmann, U.: Graph rewrite systems for program optimization. ACM Trans. Program. Lang. Syst. 22(4), 583–637 (2000)CrossRefGoogle Scholar
  22. 22.
    Varró, G., Varró, D., Friedl, K.: Adaptive graph pattern matching for model transformations using model-sensitive search plans. In: Karsai, G., Taentzer, G. (eds.) Proc. of Int. Workshop on Graph and Model Transformation (GraMoT 2005), Tallinn, Estonia. ENTCS, vol. 152, pp. 191–205. Elsevier, Amsterdam (2005)Google Scholar
  23. 23.
    Standard Performance Evaluation Corporation: All SPEC CPU2000 results published by SPEC page (2005),
  24. 24.
    Rozenberg, G. (ed.): Handbook of Graph Grammars and Computing by Graph Transformation. World Scientific, Singapore (1999)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Rubino Geiß
    • 1
  • Gernot Veit Batz
    • 1
  • Daniel Grund
    • 1
  • Sebastian Hack
    • 1
  • Adam Szalkowski
    • 1
  1. 1.Universität Karlsruhe (TH)KarlsruheGermany

Personalised recommendations