On sequential and parallel node-rewriting graph grammars, II

On sequential and parallel node-rewriting graph grammars, II

COMPUTER VISION, GRAPHICS, AND IMAGE PROCESSING 23, 295-312 On Sequential and Parallel Node-Rewriting Graph Grammars, II D. JANSSENS Departm...

837KB Sizes 29 Downloads 114 Views

COMPUTER

VISION,

GRAPHICS,

AND

IMAGE

PROCESSING

23,

295-312

On Sequential and Parallel Node-Rewriting Graph Grammars, II D.

JANSSENS

Department of Mathematics, University of Antwerp, I/IA, B-2610 Wilrijk, Belgium

G.

ROZENBERG

Institute of Applied Mathematics and Computer Science, University of Leiden, The Netherlands AND

R.

VERFUEDT

Research Assistant of the National Fund for Scientific Research (Belgium), Department of Mathematics, University of Antwerp, UIA, B-2610 Wilrijk, Belgium Received July 12, 1982 The paper directly continues research initiated by the authors (D. Janssens, G. Rozenberg, and R. Verraedt, On Sequential and parallel node-rewriting graph grammars, Computer Graphics and Image Processing 18, 1982, 279-304). Several new aspects of the relationship between a connection relation mechanism and a stencil mechanism used for specifying embeddings in graph grammars are considered.

INTRODUCTION

In [l] research comparing two embedding mechanisms used in graph grammars (a connection relation mechanism introduced in [2] and a stencil mechanism introduced in [3] was initiated. In particular (to make a comparison of the two mechanisms possible) the use of a connection relation was modified for parallel graph-rewriting systems and the use of stencils was modified for sequential graph-rewriting systems. This resulted in introducing several basic classes of graph grammars and languages. The present paper continues, and in a sense completes, research started in [ 11. We now investigate several new aspects of the relationship between the connection relation mechanism and the stencil mechanism. In Section 1 we consider the inclusion relationship between the classes of languages generated by the various classes of graph grammars considered in [l] in the case where the use of nonterminal labels is not allowed. In Section 2 we investigate two issues concerning NLC, grammars: (1) their length sets, and (2) the relationship between determinism and functionality of a NLC, grammar. Since both issues were investigated in [4] for PGOL systems (which are very similar to edSc, grammars) such an investigation sheds additional light on the relationship between the stencil and the connection relation mechanism. In SC* grammars the embedding is established separately for each pair of neighboring daughter graphs while in NLC, grammars the embedding is established for the pair (a daughter graph, all neighbors of the daughter graph). Thus, informally, one could say that in a SCr grammar one uses a “pairwise” embedding 295 0734-189X/83

$3.00

Copyright 0 1983 by Academic Press. Inc. All rights of reproduction xn any form reserved

JANSSENS, ROZENBERG,

296

AND VERRAEDT

mechanism while in a NLC, grammar one uses a “one-against-the-rest” embedding mechanism. To get a better understanding of the differences between SC, and NLC, grammars, in Section 3 we interchange the above outlined axioms. That is, we consider NLC grammars using a pairwise embedding mechanism and SC grammars using a one-against-the-rest embedding mechanism. This paper directly continues Ref. [l] so we use the terminology and notation introduced there. In addition we use the following conventions: (1) N denotes the set of nonnegative integers. (2) Let A and B be sets and let f be a function from A into B. f is a total function if f(a) is defined for each a E A. (3) Let A be a set, let n E N, m * 0 and let f be a function from A into A. Then by f” we denote the function f 0 f 0 . . . 0 f (m times). (4) Let f be an injective function. Then by f- ’ we denote the inverse function off. (5) Let C be a finite nonempty set and let H E G,. H is a complete graph if {x, y} E E, for each x, y E I’, with x * y. (6) Let C be a finite nonempty set, let H E G,, and let u E V,. The degree ofu in H, denoted by deg,(v), is the number #{x

E VHl{u, x} E EH}.

The degree of H, denoted by deg( H), equals

I. GRAMMARS

WITHOUT

NONTERMINALS

In [l] a comparison is made between several classes of grammars using the connection relation mechanism (introduced in [2]) and several classes of grammars based on the stencil mechanism (introduced in [3]). In this section the language-generating power of these classes of grammars is compared in the case where the use of nonterminal labels is not allowed (in language theory grammars not using nonterminal symbols are often referred to as “pure” grammars). DEFINITION 1. Let G be a graph grammar (of any of the types defined in Ref. [ 11). Let C be the set of node labels of G and let A be the set of terminal node labels. G is called a pure graph grammar if C = A. q In specifying a pure grammar we will omit A. If X denotes a class of graph grammars (e.g., NLC) then pure X grammars will be denoted by adding a capital Z (e.g., ZedNLC).’ THEOREM

Proof

1.

C(ZNLC,)

\ C(ZSC,) f 0.

Consider the ZNLC,

grammar G = (C, P, Z) where

‘Z stands for the Dutch work “zuiver,” which means “pure.”

NODE-REWRITING

GRAPH

GRAMMARS

297

It is easily seen that

L(G)=

{“,L’,

+

hbbbbbbb . -

.).

-

.

To see that L(G) @ C(ZSC,) assume that there exists a ZSC, grammar (C, & e, z) with L(G) = L(G). Since b *

a 2

G=

b *

is the element with a minimal number of nodes in L(G), we have

We clearly must have

or (b, !) (this and the node productions applied can only be of the form (a, bl) follows from the fact that no element of L(G) has more than four nodes). Hence there is a stencil of the form b, or in Fe. Furthermore

bs

c=h,

it is impossible that

because this implies that both ‘2

and : ? are in Fe and hence

298

JANSSENS, ROZENBERG,

a contradiction.

AND VERRAEDT

It follows that b bob +--4--4--j.

b

I

b .

bt

4

c

b

and hence Fe contains either b,

I 4.

I

or

4

l .

b,

This, however, implies that

a contradiction.

0

The proofs of the following two results are analogous. THEOREM 2.

f?(ZedNLC,)

THEOREM 3.

E(ZeNLCJ

THEOREM 4.

kT(ZSC,) \ C(ZNLC,)

Proof:

\ C(ZedSC,) f 0. 0 \ C(ZeSC,) f 0. •I f 0.

Consider the ZSC, grammar G = (C, P,, P,, Z) where C = {a, b, c} P, = ((a,

‘-‘),(b,:

:))

It is easily seen that

and that L(G) 4 l?(ZNLC,).

Cl

The proofs of the following two results are analogous. THEOREM 5.

C(ZedSC,,) \ l?(ZedNLCJ

f 0. 0

THEOREM 6.

C (ZeSC,) \ f (ZeNLCJ

THEOREM 7.

C (ZNLC) \ C(ZSC) * 0.

* 0. q

NODE-REWRITING

Proof:

GRAPH

GRAMMARS

299

Consider the ZNLC grammar G = (C, P, 2) where IX = {a, b, c} P= C,

a,-,

(( =

{(b,

h

c)>,

h C,

h h C , > a, -? I( =

c2

0

and

It is easily seen that

To see that L(G) 4 !?(ZSC) assume that c = (C, p,, Fe, z) is a ZSC grammar such that L(c) = L(G). Then the axiom Zof Gmust be

since it is the element with the smallest number of nodes. It is then easily seen that we must have a production

in p, and a stencil 4 cs . -

4 .

ct -

or

4 4

in Fe. Hence c .

a contradiction.

b z

b .

: E L(G),

0

The proofs of the following two results are analogous. THEOREM 8.

C(ZedNLC) \ !?(ZedSC) * 0. 0

THEOREM 9.

C(ZeNLC) \ e(ZeSC) * 0. 0

THEOREM 10. Proof.

!?(ZSC) \ QZNLC)

* 0.

Consider the ZSC grammar G = (C, P,, P,, Z) where E = (a, b, c} P, = {(a,

S z)}

300

JANSSENS, ROZENBERG,

AND VERRAEDT

and z=“-k It is easily seen that L(G)=

{+f}

and it is obvious that L(G) e C(ZNLC):

we must have

by applying a production a, f f , which is impossible because of the way the ( ) embedding edges are established in an NLC grammar. 0 The proofs of the following two results are analogous. THEOREM 11.

e(ZedSC) \ C(ZedNLC)

THEOREM 12.

e(ZeSC)\QZeNLC)

* 0. 0 f 0. Cl

THEOREM 13. There exists a ZedNLC grammar G such that the set of edge-labeled undirected graphs underlying L(G) is not in l’?(ZeNLC).

ProoJ

It is easy to construct a ZedNLC grammar G such that L(G)={k+-.++

‘).

However, it is obvious that b -,-

a 7

bb 7

b

b . I

4 C(ZeNLC).

0

7

The proofs of the following results are analogous. THEOREM 14. There exists a ZeNLC grammar G such that the set of undirected graphs without edge labels underlying L(G) is not in e(ZNLC). •I THEOREM 15. There exists a ZedNLC, grammar G such that the set of edge-labeled graphs underlying L(G) is not in c(ZeNLC,). •I THEOREM 16. There exists a ZeNLCr grammar G such that the set of undirected graphs without edge labels underlying L(G) is not in c(ZNLC,,). [7

Theorems analogous to Theorems 13, 14, 15, and 16 also hold in the case of SC grammars. The following diagram (see Fig. 1) summarizes the results of this section. If A and B are two classes of languages then we write A -+ B if A 2 B and A *B if bothA\B f 0 andB\A f 0.

NODE-REWRITING

GRAPH

&edSCp)

a! (ZedNLCp)

T

T

C(ZeNLCp)

301

GRAMMARS

,e--+-+ZeSCp)

.CC(Z”JLCp) Lc(ZSC,) C(ZedNjC)

;:

f(ZejdSC)

t(ZeNLC)

L(ZeSC) l-+---l

LczN,

C(ZSC)

FIGURE 1

2. LENGTH

SETS, DETERMINISM,

AND FUNCTIONALITY

In this section we discuss two issues concerning NLC, grammars: (1) length sets, and (2) the relationship between the determinism and the functionality of a system. Both issues were investigated for propagating graph OL systems (which are very similar to edSCp grammars) in [4] and, consequently, comparing the results of this section with the corresponding results in [4] sheds some light on the relationship between the stencil- and the connection-relation mechanism. DEFINITION 2. Let G be a NLC, grammar. (1) The node length set of G is the set {x~NlthereexistsaH~L(G)suchthatx=

#V,}.

(2) The edge Zength set of G is the set (x E NlthereexistsaHE

L(G)suchthatx

= #EH}.

(3) A subset A of N is a NLC, node length set if there exists a NLC,, grammar G such that the node length set of G equals A. (4) A subset A of WI is a NLC, edge length set if there exists a NLC, grammar G such that the edge length set of G equals A. •I In [4] it is shown that a subset of N is a POL length set if and only if it is a PGOL node size set and that each ETOL length set is a PGOL edge size set. For NLC, grammars we have the following.

302

JANSSENS, ROZENBERG,

AND VERRAEDT

THEOREM 17. Euely NLC, node length set is an EOL length set and every EOL length set is an NLC, node length set.

Proof.

Obvious. 0

THEOREM 18. There exists an ETOL length set that is an NLC, edge length set but that is not an EOL length set.

Proof

It is well known (see [5]) that the set A = (2”3mln, m 2 0}

is an ETOL length set but not an EOL length set. It is easily seen that the edge length set of the following NLC, grammar equals A. G = (C, A, P, Z)

where C = A = {X’, Y’, X, Y} P=

{(X,“>C)>(Y, ( (

x,yc,

Lc), H

xl,TT,C)

H

Y,X~,C) yI,tY,c

c = {(X, Y), (Jc Y’), (X’, y), (x

1 1) Y’N

and

z=“. Hence the theorem holds. •I In [4] the notions of “determinism” and “functionality” are introduced for PGOL systems. Determinism describes a restriction on the set of productions: for each left-hand side there exists precisely one production with this left-hand side. Functionality describes a restriction on the behavior of the system: each graph H (already derived) directly derives at most one graph. Investigating the relationship between determinism and functionality provides an insight into the role that restrictions on productions play in determining the behavior of a system. In [4] it is shown that a PGOL system can be functional without being deterministic (while determinism always implies functionality). We will now investigate this issue within the framework of NLC,, grammars. DEFINITION 3. Let G = (C, A, P, Z) be a NLC, grammar. (1) G is deterministic if for each f E C there exists at most one production (I, D, C) E P with I= f. (2) G is functional if for each H such that Z L H, H * fl and H s g implies G G G that g is isomorphic to E Cl

NODE-REWRITING

GRAPH

GRAMMARS

303

It is easily seen that if a NLC, system is deterministic then it is functional. However, the following two examples show that the converse does not have to be true. EXAMPLE 1. Let G, = (C,, Ai, P,, 2,) where C, = A, = {a, b)

P, =

{(b,:,0),(b,:,0))

and 2, = :.

Clearly G, is functional but not deterministic.

0

Note that, although G, is not deterministic, the nondeterminism is present only for labels which do not appear in graphs derived in the system. Clearly one can restrict oneself to NLC, grammars in which such a situation cannot occur. EXAMPLE 2. Let G, = (X2, AZ, P2, 2,) where C2 = A2 = {a}

and z,=

:.

Clearly G, is functional but not deterministic.

El

Note that in G, the nondeterminism is present only because P2 contains productions that differ only by their connection relations. Since NLC, grammars in which all productions have the same connection relation generate the whole class of NLC, languages (see Theorem 2 in Ref. [l]) one can restrict one’s attention to NLC, grammars using one “global” connection relation only. The above considerations lead us to the following subclass of the class of NLC, grammars. DEFINITION 4. A NLC, grammar G = (C, A, P, Z) is a restricted NLC, grammar if (1) for each I E C there exists a graph H and a node x E VH such that 2 A H G and q+,(x) = 1 and (2) for each pair of productions (I,, D,, C,), (I,, D2, C,) E P we have C, = C,. q

We will demonstrate now that within the class of restricted NLC, grammars determinism and functionality coincide. First we need the following graph-theoretical result.

304

JANSSENS, ROZENBERG,

AND VERRAEDT

-1. Let H, p be graphs over C. Let M, K and M, K be subgraphs of H and H, respectively, such that V, and V, are disjoint, V, and V,- are disjoint, LEMMA

v, u v, = v,

and

v,-uv,-=

v,-.

Furthermore assume that for each x E VM and y E V, with {x, y} E En and for each z E V, with qK(z) = qK(y) we have (x, z} E En and that for each {x, y} E EC with x E Vc and y E V,- we have {x, z} E Ei&r each z E V,- with (PK(z) = (PK(y). Let f be an isomorphism from M onto M such that for each x E V, and 1 E C we have that x is a neighbor of every I-labelled node of K if and only if f (x) is a neighbor of every I-labelled node of K. Let g be an isomorphism from H onto g. Then there exists an isomorphism from K onto K. (The situation is illustrated by Fig. 2). Proof

Let x E V,. We define the sequence (x~)~ E N as follows:

(1) Xl = g(x), (2) if xi E V, then xi+, = (gof-‘)(x,),

if xi E Vkthenx;+,

= x,.

Let x E V, and let n be the smallest integer such that there exists an integer m > n with x, = x,. Then x, = (gofy(x,)

= (g”f-‘)+‘(x,).

Since g is bijective this implies that n f 1 and f-‘(x,-J

=f-‘(X,-l).

Since f is bijective this implies that x,- , = x,- , in contradiction with the minimality of n. Hence x,, x, E Vi and n f m implies that x, * x,. It follows that for

H

FIGURE2

NODE-REWRITING

GRAPH

305

GRAMMARS

each x E V, there exists an index i such that xi E Vg. Let rx = min{i(xi

G Vk}

and let g(x) = x,~. We will show that g is an isomorphism from K onto K. Since both f and g are bijective it is obvious that #V, = #Vk. Hence to show that g is bijective it is sufficient to show that g is injective. Assume that it is not injective. Let x, y E V, with x * y be such that g(x) = g(y). Let

and k, = min{ily,

E {x1, XZ,...,

X,>}.

Note that k, 5 rX and k, I ry. We consider four cases: (a) k, * 1 and k, f 1. Let xk x = y,. Since k,” * 1 we have j += 1 and hence xk,

=

(g”f-‘)bkr-,)

=

(g’f-‘)(+I)

=y,.

However, xk,-, z y,-, because k, is minimal, a contradiction because f and g are bijective. (b) k, = 1 and k, * 1. Let x, = yj. Since k, * 1 we have j * 1 and hence

Xl = g(x) = (S?r’)(Y,-I>. Since g is bijective this implies x = f- ‘( yj- 1) and hence x E VM, a contradiction. (c) k, == 1 and k, = 1. This case is analogous to case (b). (d) k, = k, = 1. Either x, = yi withj f 1 or x1 = y,. The first case is analogous to case (b) and the second case implies Xl = g(x) = &T(Y) = Yl, a contradiction since x * y and g is bijective. Hence we conclude that g is bijective. We now prove that {x, y} E EK if and only if (g(x), g(y)} E EL. This will show that g is an isomorphism from K into K. We first prove that for each i 2 1 we have {x, y} E EK if and only if {x,, y,} E Ei. (1) For i = 1 the statement holds because g is an isomorphism. (2) Assume that i * 1 and the statement holds for 1,2,. . . , i - 1. We consider four cases. (2a) i * 1 (mod rX) and i = 1 (mod rY). Then xi = (g”f-‘h-,)

and

Yi = (g”f-‘ICYi-1).

306

JANSSENS, ROZENBERG,

AND VERRAJXDT

Clearly {xi, yi} E E,- if and only if {xi-, , yi- ,} E EC because both g and f are isomorphisms. Hence the statement follows easily from the induction hypothesis. (2b) i = 1 (mod rX) and i f 1 (mod r,).Let {x, y} E EK. By induction {xi-,, yi-,} E Ei. Henceyj-, is a neighbor (m M) of g(x) (in K). Because x and g(x) have the same label, it follows from the assumptions in the statement of the lemma that {x, f- ‘( yip r)} E EH- Because g is an isomorphism, we have

Hence {xi, y,} E E,- if {x, y} reverse the above reasoning. (2~) i * 1 (mod rX) and i (2d) i = 1 (mod rX) and statement follows easily from

E EK. To show the “only if” part we only have to = 1 (mod rv). This case is analogous to case (b). i = 1 (mod rr). Then xi = g(x), yi = g(y) and the the fact that g is an isomorphism.

Finally let (x, y} E E,. Let q be the least common multiple of rX and rv. Then = g(x), y = g(y) and it follows from the above that (x, y} E E, if and only if &h g(& E, 0 THEOREM

19. Let G be a restricted NLC, grammar. If G is functional then G is

deterministic. Prooj Assume that G = (C,C, P, Z) is a restricted NLC, grammar which is functional but not deterministic. Then there exist graphs A, H, p, a node u E I’,, and productions (I, D,, C), (I, D2, C) in P such that D, is not isomorphic to D2, fi * H, Z? * N, in the construction of the derivation step k 7 H the produc-

tion (I,‘D,, C) iz applied to 0, and in the construction of k * fl the production (I, D,, C) is applied to u. Furthermore assume that for x E I$ \“( u}, the production applied to x in H * H equals the production applied to x in fi = E Let b be replaced by D, in tCheconstruction of & * H and let u be replace: by Dz in the construction of fi * E Then there exist isgmorphisms g from H onto H(because G is functional) and f?rom H \ D, onto g\ o2 such that f and g satisfy the conditions ofLemmal(wherewesetM=H\D,,K=D,,M=H\D,,andR=D,).Hence it follows that D, is isomorphic to D,, a contradiction. This proves the theorem. q 3. INTERCHANGING

THE BASIC AXIOMS

An important “methodological” difference between the embedding mechanism of SCr, grammars on the one hand and NLC, grammars on the other hand is that in SC, grammars the embedding is constructed “pairwise.” Let H * Kand let IY,j3, y be the daughter graphs of nodes a, b, c of H. If G is a SCr ‘grammar then the construction of edges between (Y and j3 is independent of the construction of edges between j3 and y. If G is a NLC, grammar then the embedding is specified by the embedding functions which are associated with the (node) productions and therefore the construction of edges between a and /3 is not independent from the construction of edges between j3 and y. The first part of this section will consist of investigating the systems obtained by introducing into NLC grammars the concept of a pairwise construction of the

NODE-REWRITING

GRAPH

307

GRAMMARS

embedding as used in SC grammars. In the second part of this section we will study sequential systems obtained by combining the SC mechanism with the idea of a specification for the embedding originating from NLC grammars. In both parts the generation of undirected node-labeled graphs is considered. DEFINITION 5. A pairwise NLC, grammar, abbreviated 2-NLC, grammar, is a system

where C, A, and 2 are defined as in the case of a NLC grammar, P,, is a set of pairs of the form (I, D) where 1 E C and D E G,; P, is called the set of node productions, and P, is a set of subsets of C X C; P, is called the set of edge productions. •I DEFINITION 6. Let G = (C, A, P,, P,, 2) be a 2-NLC, grammar. (1) Let H, g E G,. Then H directly derives H in G, denoted H * H, if there exist total functions 7rn and 7refrom V, into P, and from EH into P, kch that the following holds. For each v E I$, let r,(v) = (I,, DO) and for each r E EH let n,(r) = C,.

(a) For each v E VH, qH(v) = I,. (b) There exists an isomorphism h from p onto the graph X in G, constructed as follows: for each v E V, let 5” be a graph isomorphic to DO such that for each w, UE V,withw*uwehaveVE v n VE= ” 0.Foreach

x E OE uV”VE” let An(x)

denote the node w of VH such that x E VEX.Then X = (V,, E&L

9x)

where

and

E,=

U E&u{{

DEv,

n, m}lr = {An(n),An(m))

E EH

(2) By f we denote the transitive closure of * and by 2 we denote the G G transitive andreflexive closure of =j . (3) The language

of G, denoteiby

L(G), is the set

HJZ:HandHE G

GA

0

308

JANSSENS, ROZENBERG,

AND VERRAEDT

Observe that in the above if x, y E VHLx * y, and r = {x, y} E E, then (a, b) E T~(,(T)means that each a-labeled node of D, is to be connected to each b-labeled node of DY and each b-labeled node of 0, is to be connected to each u-labeled node of DY. Hence in the sequel we assume that all elements of P, are symmetric relations. THEOREM 20.

C(ZNLC,)

c C(SC,).

Proof. It is easily seen that for every 2-NLC, grammar G one can construct a SC, grammar G such that L(G) = L(c). It suffices to construct a stencil for each possible combination of two node productions and one edge production. 0

The following result deals with the pure case (hence no nonterminal used)-such grammars are referred to as 2-ZNLC, grammars. THEOREM 21.

e(ZZNLC,)

labels are

5 C(ZSC,).

The proof of C(ZZNLC,) 5 f?(ZSC,) is analogous to that of Theorem 20. To show that the inclusion is strict consider the ZSC, grammar G = (1, P,,, P,, Z) where Proof.

c = {a, 6) P,={(a,’

‘))

and

z=“. Clearly,

L(G)= (+}. Assume that G = (C, p,, Fe, z) is a 2-ZNLC, grammar such that L(G) = L(G). It is easily seen that Z = “2, that the only production of & used in

( 1 hb

is a,--, and that the only element of Fe used in this derivation step contains (b, b). This clearly leads to a contradiction: the resulting graph would be b

b

h

b

X-0

NODE-REWRITING

GRAPH

GRAMMARS

309

In a derivation step of a SC grammar the embedding is specified by giving a stencil for each edge incident with the rewritten node. However, another way of specifying the embedding by stencils is to use only one stencil, which is applied between the daughter graph of the rewritten node on the one hand and the “neighborhood” on the other hand. By the “neighborhood” we mean the subgraph spanned by the neighbors of the rewritten node in the host graph (more precisely, the part of the host graph that remains after the rewritten node is omitted). DEFINITION 7. A one-stencil controlled graph grammar, abbreviated l-SC grammar, is a system

where C, A, P,,, P,, Z are defined exactly as in the case of a SCr grammar. 0 A derivation step in a l-SC grammar is defined as follows. DEFINITION 8. Let G = (C, A, P,, P,, Z) be a I-SC grammar. (1) Let H, H E G,. Then H direct& derives H in G, denoted H 2 H, if there exists a node u E I$,, a node production (I, D) E P,, a stencil S’in P,, and isomorphisms 0, from Source (S) onto D and 0, from Target (S) onto the subgraph N of H \ u spanned by the set

such that the following holds. (4 (~du) = 1. (b) H is isomorphic to the graph X constructed as follows. Let fi be a graph isomorphic to D such that I’,- n Vn = 0. Then

and (Pxw=

(P/7(-4 i

rpD(x)

ifx E V,\(u) ifx E Vh.

(2) By 2 we denote the transitive closure of j and by 2 we denote the G G transitive andreflexive closure of * . (3) The language of G, denotedby L(G)

THEOREM 22.

= (HIZ

C(NLC)\C(l-SC)

L(G), is the set :H

G

f 0.

and

HEG~

I

.O

310 Proof

JANSSENS,

ROZENBERG,

AND

VERRAFcD’I

Consider the grammar G = (C, A, P, Z) where C = A = {A)

and

z= :‘. Clearly L(G) is the set of all complete graphs over A. However L(G) 4 C( l-SC). To see this, assume that c is a l-SC grammar such that L(G) = L(G). Let K, = max( r( there exists a stencil S in P, with deg( S) = r }. Then it is easily seen that if H 2 H then G #{r(thereexistsanodexin

I/,-withdeg,-(x)

= r} I K,.

It follows easily that L(G) 4 C(l-SC). 0 THEOREM 23.

Proof.

c(l-SC)\e(NLC)

* 0.

Consider the set

It is shown in the proof of Theorem 5 in Ref. [l] that this language is not in C(NLC). However, the following (l-SC) grammar generates this language. Let G = (C, A, P,, P,, Z) where

c = {a, S} A = {a}

and

We now restrict outselves again to the case of pure grammars-the grammars will be referred to as l-ZSC grammars, -bEOREM

24.

e(ZNLC)

\ e( l-ZSC) * 0.

corresponding

NODE-REWRITING

proof.

GRAMMARS

311

The proof is analogous to that of Theorem 22. 0

THEOREM 25. Proof:

GRAPH

C(l-ZSC)\

C(ZNLC)

f 0.

Consider the I-ZSC grammar G = (C, P,,, P,, Z) where C = {a, 6)

and

z=“-“. Then

Assume G = (E:, P, Z) is a ZNLC easily seen that Z = z and that

grammar such that L(G) = L(G).

Then it is

by,y 6

h

It is obvious that the latter is impossible (because the embedding is only dependent on the labels). 0 IV. DISCUSSION

A basic difference between a string grammar and a graph grammar lies in the embedding mechanism; while it is trivial for the former, it is the most essential part for the latter grammars. One can say that the research concerning various embedding mechanisms forms a very essential part of graph grammar theory. Several embedding mechanisms were considered in graph grammar theory; among those, the stencil mechanism (used in parallel graph grammars) and the connection relation mechanism (used in sequential grammars) were quite extensively investigated. The aim in [1] and the present paper was to carry out a systematic comparison between these two embedding mechanisms. We hope that these two papers together provide some insight into the basic differences between (the use of) the two embedding mechanisms considered. Although we think that the two papers together complete in a sense the comparative study of the stencil and the connection relation mechanisms, several technical questions remain open (these questions were pointed out in appropriate places in the papers). A natural line of research to be carried on is an in-depth investigation of some classes of graph grammars (and languages) that arose naturally during research

JANSSENS, ROZENBERG,

312

AND VERRAEDT

carried out in [l] and this paper. In particular, an in-depth investigation of the class of NLC, grammars should naturally complement the theory of NLC grammars as presented in [2,6-81. Such an investigation is currently being carried on by us. ACKNOWLEDGMENTS

The second author gratefully acknowledges the financial support of NSF Grant MCS 79-038038 and the third author gratefully acknowledges the financial support by the Belgian Fund for Scientific Research (NFWO). REFERENCES 1. D. Janssens, G. Rozenberg, and R. Verraedt, On sequential and parallel node-rewriting graph grammars, Computer Graphics Image Processing 18, 1982, 279-304. 2. D. Janssens and G. Rozenberg, On the structure of node-label controlled graph languages, Inform. Sci. 20, 1980, 191-216. 3. K. C&k II and A. Lindenmayer, Graph OL-Systems and Recurrence Systems on Graphs, Proceedings, 8th Conference on Systems Science, Hawaii, January 1975. 4. K. C&k II and D. Wood, A mathematical investigation of propagating graph OL-systems. Inform. Contr.

43, 1979, 50-82.

5. J. Karhumaki, On Length Sets of L-Systems, Ph.D. thesis, Dept. of Mathematics, University of Turku, 1974. 6. D. Janssens and G. Rozenberg, Restrictions, extensions and variations of NLC grammars, Inform. Sci. 20, 1980, 217-244. 7. D. Janssens and G. Rozenberg, A characterization of context-free string languages by directed node-label controlled graph grammars, Acra Inform. 16, 1981, 63-85. 8. D. Janssens and G. Rozenberg, Decision problems for node-label controlled graph grammars, J. Comput. Syst. Sci. 22, 1981, 144177.