Boundary graph grammars with dynamic edge relabeling

Joost Engelfriet, George Leih, Emo Welzl
1990 Journal of computer and system sciences (Print)  
Most NLC-like graph grammars generate node-labeled graphs. As one of the exceptions, eNCE graph grammars generate graphs with edge labels as well. We investigate this type of graph grammar and show that the use of edge labels (together with the NCE feature) is responsible for some new properties. Especially boundary eNCE (B-eNCE) grammars are considered. First, although eNCE grammars have the context-sensitive feature of "blocking edges," we show that B-eNCE grammars do not. Second, we show the
more » ... existence of a Chomsky normal form and a Greibach normal form for B-eNCE grammars. Third, the boundary eNCE languages are characterized in terms of regular tree and string languages. Fourth, we prove that the class of (boundary) eNCE languages properly contains the closure of the class of (boundary) NLC languages under node relabelings. Analogous results are shown for linear eNCE grammars. '0 H" and finally using Emb to connect H, to the remainder of H. Moreover, an application condition can be associated to the production which determines whether the occurrence of H, in H may be replaced, depending on the context of this occurrence. For an overview of different types of graph grammar, see [Nag, EhrNagRoz, EhrNagRozRos]. We are interested in graph grammars which are context-free in the sense that (1) H, is a single-node graph without edges, and (2) productions have no application conditions. Moreover, we restrict ourselves to the natural case that (3) the embedding mechanism only establishes edges between nodes in H, and former neighbours of H, . Graph grammars of this type belong to the NLC family op graph grammars: NLC, dNLC, eNLC, NCE, etc., where NLC stands for node label controlled, NCE for neighbourhood controlled embedding, the d for directed, and the e for edge labeled (see, e.g., [JanRozl-JanRozS], and [JanRozVer]). Here we study an interesting variant that has not got much attention before: the eNCE graph grammars (see [Kaul, Kau2, Bra, EngLeil, Englei31). The two essential features of this variant are the following. First (the "e"), eNCE grammars generate undirected graphs with labeled edges and nodes (in contrast with ordinary NLC grammars which have no edge labels). These edge labels are manipulated by the grammar in an essential way, which is why we call it a grammar with dynamic edge relabeling. Second (the "NCE"), each node in H, can be treated separately by Emb in eNCE grammars (whereas all nodes in H, with the same label are treated identically in NLC grammars). These two features are formally expressed by the fact that Emb consists of tuples (x, A, p, 6), where x is a node in HZ, Is and p are edge labels, and b is a node label. Such a tuple causes Emb to establish a ,u-labeled edge between x and y if there was a E,-labeled edge between H, and y, and y has label b. In this paper and in [EngLeil 1, a companion paper, we claim that the eNCE grammar has many advantages over other grammars of the NLC family. Results which one would naturally expect of a type of graph grammar satisfying (1 t(3) often hold for eNCE and can be proved in a natural way, using the special features of the model (both the dynamic edge relabeling and the neighbourhood controlled embedding). In particular, the eNCE grammar is rather insensible to small changes in the model that one would expect to be harmless. Altogether, eNCE grammars are easy to work with. Unfortunately, the eNCE grammar has two properties which make it not as context-free as we would like it to be. First, like the NLC grammar, it is not confluent (cf. [Cou]): when two (neighbouring) nodes in a graph can be replaced, then the order in which they are replaced may influence the result. Second, it has the property of "blocking edges" (cf. [Nag]). To explain this, we have to give some more details of the eNCE grammar. As usual it has terminal and nonterminal node labels, but additionally it has final and nonfinal edge labels. Nonterminal nodes may be replaced, whereas nominal edge labels are meant to contain information to be used by the embedding relation. A generated graph is in the language of the grammar if it has terminal nodes and final edges only. A blocking edge is now a nominal edge that connects two terminal nodes. Thus, graphs containing such an BOUNDARY GRAPH GRAMMARS 309 edge, and all graphs derivable from it, are not in the language. These blocking edges therefore function as a kind of application condition: if a blocking edge will be generated by applying a production rc, then rc should in fact not be applied. This property can be used to generate "context-sensitive" languages, such as a graph language consisting of graphs with 2" nodes. The analogous situation in which no production is applicable to a nonterminal node does not give problems: an eNCE grammar can easily be reduced (cf. [Jef] ), just like a context-free string grammar. Our main object of investigation in this paper is the class of boundary eNCE (or B-eNCE) grammars: in such a grammar nonterminal nodes are not allowed to be adjacent. This boundary restriction guarantees context-freeness in addition to (l)-(3), in the sense that the two problems mentioned above for arbitrary eNCE grammars are avoided: boundary grammars are confluent and blocking edges need not occur. Moreover, it guarantees that only "tree-like" graphs are generated, which are often easier to handle than arbitrary graphs. The boundary restriction on NLC grammars is studied in [RozWell, RozWe12, RozWel31, resulting in some nice properties with respect to, e.g., normal forms, decidability, closure properties, and complexity of recognition. In our experience the B-eNCE grammar has all these nice properties too; we show, moreover, some additional results in this paper which cannot be shown for the boundary NLC grammar. These results suggest that boundary eNCE grammars are even nicer than boundary NLC grammars, a class of grammars which is commonly considered to be one of the most promising types of NLC-like graph grammars. One of the simplest natural restrictions on graph grammars is linearity: in the graphs generated by a linear grammar there is at most one nonterminal node. Thus linear eNCE (or LIN-eNCE) grammars form a natural subclass of the B-eNCE grammars. Since linear grammars generate "chain-like" graphs, they are even easier to handle than boundary grammars. In [EngLeil ] LIN-eNCE grammars form the main object of investigation. In this paper we treat linear grammars along with boundary grammars. As another, less important, special case we consider apex grammars, first studied in [EngLeiRozl, EngLeiRoz21. Before discussing the main results of this paper, we want to stress that they strongly depend on the special features of our model: analogous results are difficult to obtain (or cannot be obtained) for other graph grammar models. Hence, a general setup, as in [Jef], cannot be given. We now discuss the three main results of this paper. First, there exists a Chomsky normal form and a Greibach normal form for B-eNCE grammars (and for LIN-eNCE grammars). As far as we know, there is no other graph grammar model for which such normal forms have been shown. Only in [Nag], a Chomsky-like normal form has been found, with chain-productions still allowed, but, in the proof, blocking edges are used. For many other models, in particular for the boundary NLC grammar, the non-existence of a Chomsky and a Greibach normal form has been proved ([Well, HabKre, RozWell, EhrMaiRoz]). Second, B-eNCE languages can be characterized in an elegant way by means of regular tree and string languages. Each graph in a B-eNCE language can be
doi:10.1016/0022-0000(90)90002-3 fatcat:lzgx7lbhxfexvcua6qvkwjq3jm