Abstract
Traditional spatial enabled grammars lack flexibility in specifying the spatial semantics of graphs. This paper describes a new graph grammar formalism called the multigranularity Coordinate Graph Grammar (mgCGG) for spatial graphs. Based on the Coordinate Graph Grammar (CGG), the mgCGG divides coordinates into two categories, physical coordinates and grammatical coordinates, where physical coordinates are the common coordinates in the real world, and grammatical coordinates describe the restrictions on the spatial semantics. In the derivation and reduction of the mgCGG, the spatial matching conditions between nodes are evaluated on the basis of the grammatical coordinates, which can be obtained by the specified granularities. By adjusting the granularities, both qualitative and quantitative analyses for spatial semantics can be obtained, including the transition states between them. In addition, a new redex searching algorithm with polynomial time complexity is designed for the mgCGG. A running example of drawing a flowchart is given to illustrate a practical application of the mgCGG. Through a detailed comparison with related spatial-enabled grammars, it is found that the mgCGG has good performance in four critical aspects—the semantics processing mechanism, fault-tolerance, redex searching algorithm, and practical application—providing a flexible yet uniform way to specify spatial graphs and building a bridge between nonspatial and spatial grammars.
Similar content being viewed by others
References
Aguinaga, S., Chiang, D., & Weninger, T. (2018). Learning hyperedge replacement grammars for graph generation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(3), 625–638.
Chen Q, Shi D, Feng G, Zhao X, Luo B (2015) On-line handwritten flowchart recognition based on logical structure and graph grammar. In International Conference on Information Science & Technology, 424–429.
Drewes, F., Kreowski, J., & Habel, A. (1997). Hyperedge replacement graph grammars. Handbook of Graph Grammars and Computing by Graph Transformation (Vol. 1, pp. 95–162). World scientific Publishing.
Fruchterman, T. M. J., & Reingold, E. M. (1991). Graph drawing by force-directed placement. Software: Practice and experience, 21(11), 1129–1164.
Guo M, Thost V, Li B, et al (2022) Data-efficient graph grammar learning for molecular generation. arXiv preprint arXiv:2203.08031.
Hou, F., Qi, Y., & Qin, H. (2012). Drawing-based procedural modeling of Chinese architectures. IEEE Transactions on Visualization and Computer Graphics, 18(1), 30–42.
Hublet, F. (2022). IDL-PMCFG, a grammar formalism for describing free word order languages. Journal of Logic, Language and Information, 31(3), 327–388.
Julcaaguilar F, Mouchère H, Viardgaudin C, Hirata N (2015) Top-down online handwritten mathematical expression parsing with graph grammar. In: BeroAmerican Congress on Pattern Recognition, pp 444–451.
Kamada, T., & Kawai, S. (1989). An algorithm for drawing general undirected graphs. Information Processing Letters, 31(1), 7–15.
Kong J, Ates KL, Zhang K, Gu Y (2008) Adaptive Mobile Interfaces through Grammar Induction. In Proceedings of 20th IEEE International Conference on Tools with Artificial Intelligence, pp 133–140.
Kong, J., Barkol, O., Bergman, R., Pnueli, A., Schein, S., Zhang, K., & Zhao, C. (2012). Web interface interpretation using graph grammars. IEEE Transactions on Systems Man & Cybernetics, 42(4), 590–602.
Kong, J., Zhang, K., & Zeng, X. Q. (2006). Spatial graph grammars for graphical user interfaces. ACM Transactions on Computer-Human Interaction, 13(2), 268–307.
Liu, Y. F., Zeng, X. Q., Zhang, K., et al. (2021). Coordinate graph grammar for the specification of spatial graphs. The Computer Journal, 64(5), 749–761.
Müller, P., Wonka, P., Haegler, S., Ulmer, A., & Gool, L. (2006). Procedural modeling of buildings. ACM T. Graphics, 25, 614–623.
Park S, Nie X, Zhu SC (2017) Attribute and-or grammar for joint parsing of human pose, parts and attributes. In IEEE Transactions on Pattern Analysis and Machine Intelligence, 1555–1569.
Rekers J, Schurr A (1996) A graph based framework for the implementation of visual environments. In IEEE Symposium on Visual Languages, pp 148–155.
Roudaki, A., Kong, J., & Zhang, K. (2016). Specification and discovery of web patterns: a graph grammar approach. Information Sciences, 328, 528–545.
Shi, Z., & Zeng, X. Q. (2016). Bidirectional transformation between BPMN and BPEL with graph grammar. Computers and Electrical Engineering, 51, 304–319.
Sikdar S, Hibshman J, Weninger T (2019). Modeling graphs with vertex replacement grammars. In Proceedings of IEEE International Conference on Data Mining (ICDM), 558–567.
Strug, B., et al. (2022). A survey of different graph structures used in modeling design, engineering and computer science problems. Graph-Based Modelling in Science Technology and art (pp. 243–275). Springer.
Tutenel, T., Smelik, R. M., Lopes, R., Kraker, K. J. D., & Bidarra, R. (2010). Generating consistent buildings: A semantic approach for integrating procedural techniques. IEEE Transactions on Computational Intelligence and AI in Games, 3(3), 274–288.
Wang XY, Liu YF, Li J, Zhang K (2018) Generating tractable designs by transforming shape grammars to graph grammars. In Proceedings of the 11th International Symposium on Visual Information Communication and Interaction, August, pp 41–48.
Wang, X. Y., Liu, Y. F., & Zhang, K. (2020). A graph grammar approach to the design and validation of floor plans. The Computer Journal, 63(1), 137–150.
Wang, X. Y., & Zhang, K. (2020). Generating layout designs from high-level specifications. Automation in Construction, 119(1), 103288.
Yang M, Jiang P (2022). Social Computational Design Method for Generating Product Shapes with GAN and Transformer Models. arXiv preprint arXiv:2202.10774.
Zeng, X. Q., Liu, Y. F., Shi, Z., Wang, Y. F., Zou, Y., Kong, J., & Zhang, K. (2018). Edge-based graph grammar: Theory and support system. Journal of Visual Languages and Sentient Systems, 4, 11–19.
Zhang, D. Q., Zhang, K., & Cao, J. (2001). A context-sensitive graph grammar formalism for the specification of visual languages. The Computer Journal, 44(3), 186–200.
Zhao, A., Xu, J., Konaković-Luković, M., et al. (2020). Robogrammar: Graph grammar for terrain-optimized robot design. ACM Transactions on Graphics (TOG), 39(6), 1–16.
Zhu, L., & Chen, K. (2021). Innovative design of hakka civil furniture product modeling based on shape grammar. Frontiers in Sustainable Development, 1(4), 92–99.
Acknowledgements
This work is supported by the National Natural Science Foundation of China under Grant No. 62002155.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Liu, Y., Yang, F. & Liu, J. Graph Grammar Formalism with Multigranularity for Spatial Graphs. J of Log Lang and Inf 32, 809–827 (2023). https://doi.org/10.1007/s10849-023-09406-0
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10849-023-09406-0