Labelled graph rules in P systems
 370 Downloads
Abstract
P systems with graph productions were introduced by Freund in 2004. It was shown that such a variant of P system can generate any recursively enumerable language of weakly connected graphs. In this paper, we consider such P systems where the input is any connected graph and each graph production is labelled over an alphabet. We name the system as Process Guided P System where the computation is guided by a string over the set of labels. The set of all strings over the label alphabet which results in the halting computation of the system forms a guiding language of the system. We compare such guiding languages with Chomsky hierarchy. Two direct applications of this variant are also given.
Keywords
Graph production Guiding language Recursively enumerable language Spanning tree Chemical graph1 Introduction
P systems are parallel/distributed computing models which compute any data like strings, multi sets, graphs, etc. Some wellknown work on P systems with string objects can be found in [1]. The computation proceeds in a parallel manner using the indicated rules in all the membranes on the given input. The halting configuration is well defined for each variant where the output can be viewed either in one of the elementary membranes or in the environment. Two important classes of P systems that use catalyst along with the given data structure are shown to be computationally universal [1]. Another approach to view the evolution that generates languages by means of P systems with active membranes is defined in [1]. In this model, the evolution is shown to be computationally universal. In [2], the authors have defined a variant of P system with graph productions on weakly connected graphs. They also have shown that such systems with prioritized rules can generate recursively enumerable languages of weakly connected graphs working in a single membrane.
P systems are effectively used for solving some wellknown theory NPhard problems in Graph theory. Recently, the authors in [3] used kernal P system to solve graph coloring problem. In [4], the authors have a predefined strategy to control the application of the rules of the system. They define a language which controls the graph transformation. In [5], the membrane structure is described as a tree and the authors have found a P system that contains its data structure as a graph that may not have their membrane structure as a tree. Defining a strategy language or a control language for graph rewriting is called a graphbased programming language [6].
The concepts of control strings in P systems were first introduced by Ajeesh Ramanujan [7, 8]. This model processes multiset of objects and the evolution is based on the labels of the rules associated with them. In [9], the authors have defined a P system, processing, isotonic arrays in a controlled manner, predefined by strings over the labels of the rules, (i.e.), the rules are labelled and the strings over the labels indicate the sequence of applications of the rules. The study of control languages was extended to Tissue Psystems in [10]. The concept of Szilard and control languages of a particular type of finite splicing systems was studied in [11].
In this paper, we define a P system with graph productions. Such a system will rewrite any connected graph. The graph productions in all the membranes are labelled. The processing or computation will be guided by a string over the labels of the graph productions for a possible predefined halting configuration. So, we call the system as Process Guided P System with Graph productions (PGPSG). We study some interesting theoretical properties of this system. We also give two interesting applications of the system. The first application is the extraction of a spanning tree of a given connected graph using a contextfree language guidance. In the second application, a chemical reaction is modeled by a P system where the guiding language is a regular language.
This paper is divided into five sections. Section 2 introduces the necessary preliminaries. The definition of P system with graph productions is given. Then, we continue to define Process Guided P System with Graph productions (PGPSG). We illustrate the working of this model with some examples in this section. Interesting theoretical results are given in Sect. 3. Section 4 deals with the two applications of our model. The last section presents some concluding remarks.
2 Definitions and examples
We refer the reader to [1] and [12] for basic notions, notations and results about formal language theory and membrane computing, respectively. For an alphabet V, we denote by \(V^{*}\) the set of all strings over V, including the empty string, denoted with \(\lambda \); \(V^{*}\setminus \{\lambda \}\) is denoted by \(V^{+}\).
A graph G over \((V_n, E_e)\) is a triple \(G = (N(G), n(G), E(G))\), where \(V_n\) and \(E_e\) are alphabets for labelling the nodes and edges, respectively. N(G) is a finite set of nodes and \(E(G) \subseteq (N(G) \times E_e \times N(G))\) is a finite set of edges of G. Let \(n(G) : N(G) \rightarrow V_n\) be a labelling function for nodes in N(G). Any triple (s, r, t) with \(s, t \in V_n\), \(s\ne t\), and \(r\in E_e\) can be interpreted as an edge between nodes labelled s and t and the edge is labelled by r.
The graphs considered in this paper are finite, undirected, with no multiple edges and self loops. A graph \(G = (N(G), n(G), E(G))\) is called connected if and only if between any two distinct nodes \(h, k \in N(G)\) of G there is a path between h and k. Then, two possibilities arise, i.e., either an edge \((h, e, k) \in E(G)\) or there exists a sequence of edges in E(G) of the form \((h, e_1, k_1), (k_1, e_2, k_2), \dots , (k_m, e_{m+1}, k)\) joining h and k.
 1.
Node addition \(A[X, \lambda , \lambda ; Y, e, U]\) or \(A[\lambda , \lambda , X; U, e, Y]\) : Add a new node with label U and connect it to an already existing node with label X by a new edge labelled by e. Also change the label of the already existing node from X to Y.
 2.
Deleting a node \(D[Y, e, U; X, \lambda , \lambda ]\) or \(D[U, e, Y; \lambda , \lambda , X]\) : Delete a node labelled by U which is incident with exactly one edge (Y, e, U) and change the label of the remaining node from Y to X.
 3.
Node label change \(C[X, \lambda , \lambda ; Y,\lambda , \lambda ]\) : Change the label of a node from X to Y; usually this production is written for short as C[X, Y].
 4.
Edge addition \(A[X, \lambda , Z; Y, e, U]\) : Add a new edge labelled by e between two different nodes labelled by X and Z, where X and Z are not already adjacent, at the same time changing the labels of the nodes from X and Z to Y and U (in order to avoid multiple edges, this graph production can only be applied to nodes which are not already connected by such an edge labelled by e).
 5.
Deleting an edge \(D[Y, e, U; X, \lambda , Z]\) : Delete an existing edge labelled by e between two different nodes labelled by Y and U, at the same time changing the labels of the nodes from Y and U to X and Z (this graph production can only be applied; if after the deletion of this edge labelled by e the resulting graph is still connected).
 6.
Edge label change C[X, d, Z; Y, e, U] : Change the label of an edge, between two different nodes labelled by X and Z, respectively, from d to e at the same time changing the labels of the nodes from X and Z to Y and U.
2.1 P systems with local graph productions
We first define P systems with local graph productions as defined in [2].
Definition 1

\(V_n\), \(E_e\) are the alphabets for the nodes and edges, respectively;

\(T_n\), \(T_e\) are the terminal alphabets for the nodes and edges, respectively;

\(\mu \) is a membrane structure with n membranes labelled in a onetoone manner with \(1, 2, \dots , n\);

\(g_1, \dots , g_n\) are set of connected graphs over \((V_n, E_e)\) associated with the regions enclosed by the membranes \(1, 2, \dots , n\) of \(\mu \);

\(R_1, \dots , R_n\) are finite sets of rules associated with the (regions enclosed by the) membranes \(1, 2, \dots , n\): which are of the form (p, tar), where p is a local graph production over \((V_n, E_e)\) and \(tar \in \{in, out, here \}\) is the target assigned to p;

\(\rho _1, \dots , \rho _n\) are partial order relations over \(R_1, \dots , R_n\);

\(i_0 \in \{1, 2, \dots , n \}\) is the label of the output membrane.
Starting from the initial configuration, the system passes from one configuration to another one, by nondeterministically choosing a rule from \(R_i\) (if possible), for each of the underlying connected graphs in every region. These rules are applied in parallel to these graphs, which are modified according to the graph productions p and shift according to the assigned target.
A sequence of transitions is called a computation; it is successful if and only if it halts (i.e., no rule can be applied to any of the connected graphs in any region). The result of a successful computation then is the set of all graphs over \((T_n, T_e)\) present in the designated output membrane \(i_0\).
2.2 Process Guided P Systems with graph productions
We now introduce Process Guided P Systems with graph productions and we denote it as PGPSG.
Definition 2
Let \(R = \bigcup _{i=1}^{n}R_i\). Here, we assign a label to every rule in R where the labels are chosen from H or the label can be \(\lambda \) (empty label). Define a labelling function \(f : R \rightarrow H \cup \{\lambda \}\) that assigns a label to each rule in R. The rules are labelled such that more than one rule may have the same label, but the same rule in different membranes cannot be assigned different labels. We extend the labelling for a label sequence \(S = l_1~ l_2~ \dots ~l_k \in R^{*}\) as \(f(l_1~ l_2~ \dots ~ l_k) = f(l_1) f(l_2 \dots l_k\)). A transition \(C {\mathop {\Rightarrow }\limits ^{b}}C^{'}\) between two successive configurations uses only rules with the same label b and rules labelled with \(\lambda \). If at least one rule has a label \(b\in H\), then the transition is called \(\lambda \)restricted transition. If we allow all rules with \(\lambda \) label, then the transition is called \(\lambda \)unrestricted transition (or \(\lambda \)transition). S is called the regulating/guiding string.
The working of \(\varPi \) is as follows: A regulating string of input symbols (over H) is said to be accepted if all its symbols are consumed and \(\varPi \) reaches a configuration in the set F. We call such a \(\varPi \) to be working in accepting mode. The set of all regulating strings accepted in this way by computations in a PGPSG \(\varPi \) is denoted by \(LPG_{\lambda }PSG(\varPi )\). The subscript indicates the fact that \(\lambda \)steps (all rules applied in one step can have \(\lambda \) label) are permitted. When only steps where at least one rule with a nonempty label is used, the guiding language is denoted by \(LPGPSG(\varPi )\). The family of languages \(LPGPSG(\varPi )\) associated with PGPSG with at most m membranes working in accepting mode is denoted by \(LPGPSG_m\). In the \(\lambda \)unrestricted case, the corresponding language family is denoted by \(LPG_{\lambda }PSG_m\).
In the following examples, we construct PGPSG which can generate cycles, complete graphs and complete bipartite graphs with regular and contextsensitive guiding languages.
Example 1
The working of PSPSG \(\varPi _1\) is as follows: In region 1, starting with a single node labelled by S, apply rule ‘1’, followed by rule ‘2’ once. The resulting graph contains three nodes labelled by X, y, B and two edges (X, e, y) and (y, e, B) and is sent to region 2. In region 2, apply rule ‘3’, \((n3)\) times followed by the termination rule ‘4’ once to obtain the graph with n nodes (each node labelled by y) and n edges (each edge labelled by e) which is indeed a cycle of length n \((n \ge 3)\) in F. So the system accepts the regular language for the given final configuration.
Example 2
There exists a PGPSG that halts on a complete graph with n vertices \((n \ge 2)\) and accepts the guiding contextsensitive language
\(L =\Big \{a^{1 + 2 + \dots + (n1)}~ \big ~ n \ge 2,~ n = \left V(G)\right \Big \}\). The construction of PGPSG \(\varPi _2\) with one membrane is as follows:
The PGPSG \(\varPi _2\) constructed above works as follows: In the initial configuration, \(\varPi _2\) contains a single node labelled by a nonterminal S. By repeated application of rule ‘1’, \((n2)\) times, followed by rule ‘2’ once, we obtain the connected graph with n nodes and \((n1)\) edges where each node is labelled by x and each edge is labelled by e. Finally, applying rule ‘3’, \((1 + 2 + \dots + (n2))\) times for all possible pairs of nodes (x, x), we get the resultant complete graph. Each guided string accepted by \(\varPi _2\) corresponds to a complete graph in F.
Example 3
There exists a PGPSG that halts on a complete bipartite graph with \((m + n)\) vertices (\(m \ge 1, n \ge 1\)) and accepts the contextsensitive language \(L = \Big \{a^{mn+1}~ \big ~ m = \left N_1\right ,~ n = \left N_2\right ,~ m \ne n \Big \}\cup \Big \{a^{mn+1}~ \big ~ m = \left N_1\right ,~n = \left N_2\right ,~ m = n \Big \}\).
Let \(K_{m, n}\) \((m\ge 1, n\ge 1)\) be a complete bipartite graph on \((m + n)\) vertices, whose vertex set is partitioned into sets \(N_1\) with m nodes and \(N_2\) with n nodes. Now, we construct a PGPSG \(\varPi _3\) such that it accepts the contextsensitive language L and halts on a complete bipartite graph.
The working of PGPSG \(\varPi _3\) is as follows: In region 1, starting with a single node labelled by S in partition \(N_1\), apply rule ‘1’, \((n1)\) times , followed by rule ‘2’, once. Then, n nodes in partition \(N_2\) are produced, the first \((n1)\) nodes are labelled by y and the \(n\mathrm{{th}}\) node is labelled by Y. At the same time, the node S in \(N_1\) is renamed as x and it is connected with each node in \(N_2\) by an edge labelled by e. Now, apply rule ‘3’, \((m1)\) times followed by rule ‘4’, once. The remaining \((m1)\) nodes in \(N_1\) are produced and are labelled by x. The node Y in \(N_2\) is renamed by y and it is connected with each node in \(N_1\) by an edge labelled by e. The resultant graph is expelled to region 2. In region 2, apply rule ‘5’ to all possible pairs of nodes (x, y), x in \(N_1\) and y in \(N_2\) by an edge labelled by e. We obtain a complete bipartite graph \(K_{m, n}\). Each guided string accepted by \(\varPi _3\) corresponds to a complete bipartite graph in F.
3 Theoretical results
 Notation:

For any family \(\mathcal {K}\) of languages, \(\mathcal {K} \setminus \{ \lambda \}\) means the family of \(\lambda \)free languages.
Theorem 1
\(REG \setminus \{ \lambda \} \subseteq LPGPSG_{1}\)
Proof
Let \(L \in (REG \setminus \{ \lambda \}\) and \(D = (Q,~\varSigma ,~\delta ,~ p,~F_D)\) be a deterministic finite automaton accepting L. Let m be the number of states in D. Rename the states as \(q_i, 1 \le i \le m\), such that \(q_1 = p\) and the transition rules are changed accordingly. Let \( D^{'} = (Q^{'},~\varSigma ,~\delta ^{'},~q_1,~F_D^{'})\) be the modified DFA. Using \( D^{'}\) we construct a PGPSG \(\varPi _4\) with one membrane accepting \(L(D^{'})\) as follows:
\(\varPi _4 = \Big (\{Q^{'}\}, \{\phi \}, \{x\}, \{e\}, [_1]_1, g_1, R_1, 1, \varSigma , F \Big )\), where \(g_1\) contains a single node labelled by \(q_1\), \(R_1 = \Big \{1)~ a: A[q_i,\lambda , \lambda ;x, e, q_j],here~\big /~ (q_i, a, q_j) \in \delta {'}~\Big \} \cup \Big \{~2)~ a: A[S,\lambda , \lambda ;x, e, x],here~\big /~~(q_i, a, q_f) \in \delta {'}~,~q_f \in F^{'}_D \Big \}\) and the set of final configuration F is a set of all linear graphs with nodes with symbols of a string over \(\varSigma \) from left to right.
The PGPSG \(\varPi _4\) constructed above works as follows: The PGPSG \(\varPi _4\) starts with a single node labelled with \(q_1\), where \(q_1\) corresponds to the start symbol of the DFA in the membrane. When the system uses rule 1, it simulates the application of the rule \((q_i, a, q_j) \in \delta {'}\) by the DFA, that is, if the current symbol is a and the system contains a path graph with one of whose node is labelled by \(q_i\), then the current input symbol a is consumed, the label of the node \(q_i\) is renamed with a terminal symbol x and a new node with label \(q_j\) is created and is connected to x by an edge e (note that, at any instance, PGPSG contains only a path graph with only one node labelled by \(q_j\) and all other nodes are labelled by x and each edge is labelled by e). The system accepts the input string when the input is completely read and the corresponding configuration in F is reached. The membrane contains a path graph which is from F. \(\square \)
Theorem 2
\(LPGPSG_{\star } \setminus REG \ne \emptyset \)
Proof
The working of PGPSG \(\varPi _5\) is as follows: In the initial configuration, \(\varPi _5\) contains a single node labelled by a nonterminal S in region 1 whereas region 2 is empty. Now, we have a possibility to apply either rule 1 or rule 2. Suppose in the first step we apply rule 1, ‘\(n1\)’ (\(n\ge 1\)) times, it generates a path graph with n nodes, each node being labelled by B except the \(n\mathrm{{th}}\) node, which is labelled by S and each edge is labelled by e. By applying rule 2 once, the resultant path graph is expelled to region 2, where each node is labelled by B and each edge is labelled by e and the corresponding guided string is \(a^{n}\). Now in region 2, rule 3 is applied ‘n’ times to reach a configuration in F. The corresponding guided string is \(a^{n}b^{n}\). \(\square \)
Remark 1
\((REG\setminus \{ \lambda \}) \subset LPGPSG_{\star }\).
We proceed further to see whether \((CF\setminus \{ \lambda \}) \subseteq LPGPSG_{\star }\) which we prove in the following theorem.
Theorem 3
\((CF \setminus \{\lambda \}) \subseteq LPGPSG_{2}\)
Proof
Example 4
Remark 2
Hence, we have the following theorem.
Theorem 4
\( LPGPSG_{\star } \setminus CF\ne \emptyset \)
Remark 3
Hence, we conclude that \((CF \setminus \{\lambda \}) \subset LPGPSG_{\star }\)
Theorem 5
\(CS \setminus LPGPSG_{\star } \ne \emptyset \)
Proof
Consider the context sensitive language \(L = \{ {a^{2}}^{n}~ /~ n \ge 0 \}\). Since L is over a one letter alphabet and we intend to use no \(\lambda \)rule, all the rules in the PGPSG must be an arule. Note that each arule can insert (or delete or rename) exactly one node (or edge). Suppose we assume that there exits a PGPSG \(\varPi _7\) with m membranes that accepts L and halts on a configuration in F, where F is the set of final configurations which consists of paths of length n, \(n\ge 1\) in which each node is labelled by x and each edge is labelled by e. First, we show the nonexistence of such a system for \(m = 1\). The argument for m membrane P system will be identical to this. The reason is that in both situations we need infinite number of rules in the membrane system to build L. Let \(g_1, g_2, \dots , g_n\) be the graphs in the initial configuration of \(\varPi _7\). We recall that the successful halting computation means that the system must halt as well as the graphs remaining in the output membrane with each node and edge are labelled by terminals.
 1.
In order to accept a guiding string a, whose length is one, the system must go up to one step (transition). Therefore, each graph \(g_1, g_2, \dots , g_n\) in \(\varPi _7\) must contain at most one node (or edge) labelled by a nonterminal. To reach the successful halting computation, we must apply one or more insert (or delete or rename) rule to replace each node (or edge) labelled with nonterminal by a terminal. Note that, we have introduced at least one new rule to accept the regulated string a.
 2.
By (1) above, we know that each graph \(g_1, g_2, \dots , g_n\) contains at most one node (or edge) labelled by a nonterminal. To accept a guiding string \(a^2\), the system must go up to two steps (transitions). In order to do this, at least to one of the graphs \(g_1, g_2, \dots , g_n\), we need to apply the insert (or delete or rename) rule, which is a new rule. This rule may be recursive (can be repeated any number of times) or nonrecursive (applied only once). If the rule is recursive, then it also accepts the strings \(a^3, a^5, a^6,\)...\( \notin L\). Suppose, it is nonrecursive, we can apply it once, followed by an existing rule as mentioned in step 1, to halt the computation. Hence, to accept \(a^2\), we have introduced a new rule.
 3.
Similarly, in order to accept \(a^4\), the system must go up to 4 steps. At least for one of the graphs \(g_1, g_2, \dots , g_n\), we need to apply the rules in a way that there is no recursion. In all the possible cases, if any of the rule is recursive, it leads to the generation of a guiding string not in L. Therefore, the only possibility is nonrecursive rules. In all the cases, we can see that at least one new rule is required to accept \(a^4\).
Now we give the argumentative proof similar to the above to show that there does not exist any PGPSG to accept L. Suppose we assume that there is one such PGPSG \(\varPi _7\) with m membranes. If at least in any one of the m membrane contain a recursive arule then, it leads to an infinite loop or the system accepts a string not in L. On the other hand, if the system contains only nonrecursive arules, then the number of arules must be infinite, which is a contradiction. Hence the theorem. \(\square \)
In the following result, we show that any \(LPGPSG_{\star }\) will be a contextsensitive language.
Theorem 6
\(LPGPSG_{\star } \subsetneqq CS\)
Proof
We show how PGPSG will be recognized by a linear bounded automaton (LBA). In order to do this, we simulate a computation of a PGPSG by remembering the number of nodes and the corresponding edges in the graphs, after the acceptance of each symbol in the guiding string. We then show that the total number of nodes and edges in the graphs is bounded by the length of the guiding string.
Consider a guiding language L of a PGPSG \(\varPi _8\) with m membranes and let r be the total number of rules in these m membranes. Let \(w = a_1a_2 \dots a_l\), \(l \ge 1\) be a guiding string in L. Let \(g_1, g_2, \dots , g_n\) be the graphs in the m membranes of \(\varPi _8\) in the initial configuration . We build a multitrack nondeterministic LBA B which simulates \(\varPi _8\). In order for B to simulate \(\varPi _8\), it has to keep track of the labels of nodes and edges in the graphs after accepting each symbol in the guiding string. So B has a track assigned to every rule of \(\varPi _8\), a track for each nonterminalnodemembrane pair \((g_i^{A_k}, j)\), with \(1\le k \le N\) and \(1\le i \le n\), where N is the total number of nonterminal nodes in the system and \(j \in \{1, 2,\dots , m\}\), a track for each terminalnodemembrane pair \((g_i^{C_k}, j)\) with \(1\le k \le T\) and \(1\le i \le n\), where T is the total number of terminal nodes in the system and \(j \in \{1, 2,\dots , m\}\) and tracks for each triple \((X, Y, i), (X^{'},Y^{'},i) \in R \times R \times \{1, 2,\dots , n\}\) where \(R = V_n \cup E_e \cup T_n \cup T_e\).
 1.
the number of nonterminalnodes of a graph \(g_i\) in membrane j,
 2.
the number of terminal nodes of a graph \(g_i\) in membrane j,
 3.
the number of edges whose end vertices are labelled with X and Y of graph \(g_i\),
A single step of the computation of B is as follows: Based on the current configuration and the next symbol to be generated, B chooses a set of rules that are to be applied in the next step, by writing an integer on the track corresponding to the rules which indicates the number of times that particular rule is applied. Then, for each pair \((g_i^{A_k}, j)\) and \((g_i^{C_k}, j)\), B examines the chosen rule set and writes the number of nodes labelled by a nonterminal and terminal of a graph \(g_i\) in membrane j. For each triple (X, Y, i), B records the number of edges between the nodes labelled with X and Y of a graph \(g_i\), and for each triple \((X^{'}, Y^{'}, i)\), B identifies a symbol from \(E_e \cup T_e\). At any computation step, the deletion or insertion of nodes in the current graph can be updated using in the pairs \((g_i^{A_k}, j)\) and \((g_i^{A_k}, j)\). We can see that in any step of the computation, the tracks contain integers bounded by the number of symbols (labels of nodes and edges) inside \(\varPi _8\).
The number of symbols (labels of nodes and edges) in the graphs in a configuration C during a computation step is bounded by S(i), where S(i) is the number of symbols assigned to the triple \((X^{'},Y^{'},i)\). Then, the space used by B to record the configurations and to calculate the configuration change of \(\varPi _8\) is bounded by \(t \times \mathrm{log}_b (S(i))\), where b denotes the base of the track alphabet and t denotes the number of tracks used. Finally, B checks whether any more rules can be applied. If not, and also if it reaches the configuration in F (set of final configurations), it accepts the guiding string w, otherwise it rejects. So the number of symbols (labels of nodes and edges) in the graphs present in the system is bounded by the input length and hence the accepted language is a contextsensitive language. \(\square \)
The system PGPSG is not computationally complete as it was shown in Theorem 6. In the following, we show that if \(\lambda \)labelled rules are allowed in the system, then the guiding languages can be RE.
Theorem 7
\(LPG_{\lambda }PSG_{\star } = RE\)
Proof
The inclusion \(LPG_{\lambda }PSG_{\star } \subseteq RE\) follows from ChurchTuring hypothesis. For the proof of the inclusion \(RE \subseteq LPG_{\lambda }PSG_{\star }\), it is enough to prove that \(RE \subseteq LPG_{\lambda }PSG_1\), since \(LPG_{\lambda }PSG_1 \subseteq LPG_{\lambda }PSG_{\star }\).

The transition \(\delta (q, a) = (p, b, R)\) is simulated by the graph production
\(A[(q, a), \lambda , \lambda ;(q, a), a, (p, b) ],here\) .

The transition \(\delta (q, a) = (p, b, L)\) is simulated by the graph production
\(A[\lambda , \lambda , (q, a);(p, b), a, (q, a)],here\) .
 1.
For a symbol \(a_i \in H\), the rule \(A[(q_0, 0), \lambda , \lambda ;(q_0, 0), 0, (q_i, 1) ],here\), labelled with \(a_i\) is used to introduce the symbol \((q_i,1)\), it is the symbol used in the first transition for generating the encoding in Step 2.
 2.Perform the computation \(e(w)=e(a_iu) = e(a_i)e(u)\), \(u \in H^{*}\), for some \(a_i \in H\). The simulation of \(e(a_iu)\) is performed by the following transitions.The transitions of the subprogram can be simulated by the graph productions as shown in the beginning of the proof, and these rules are assigned with label \(\lambda \).$$\begin{aligned}&\delta (q_i, 1) = (q_{i1}, 1, R)~,\\&\delta (q_{i1}, 1) = (q_{i2}, 1, R)~,\\&~~~\dots \dots \dots \dots ~,\\&\delta (q_2, 1) = (q_1, 1, R),\\&\delta (q_1, 1) = (q_0, 0, R) \end{aligned}$$
 3.
Repeat steps 1 and 2 nondeterministically until the last symbol of the regulated string w is read/processed.
 4.
The output graph of the system is in F, which is the final configuration set. We can now simulate the working of the Turing machine M in recognizing the string e(w). If the Turing machine halts in state \(q_f\) where the corresponding node in linear graph in F will be \((q_f,0)\), then \(w \in L\), else the machine goes into an infinite loop.
\(\delta (q_0, 0) = (q_f, 0, R)\)
4 Applications
This section illustrates two direct applications of PGPSG. A spanning tree is extracted from a given connected graph as input to a PGPSG with a contextsensitive guiding language. In the second application, some interesting chemical reactions are modeled via PGPSG.
4.1 Spanning tree
In the following theorem, we show how the PGPSG with one membrane and a contextsensitive language as a guiding language extracts a spanning tree.
Theorem 8
There exists a contextsensitive language L such that PGPSG accepts L and halts at a spanning tree. .
Proof
In this proof, to a given input, the system adds neither new nodes nor new edges. Only the renaming and deletion operations are applied on nodes and edges. The working of PGPSG \(\varPi _9\) is as follows: In the initial configuration, the connected graph G is in region 1. In region 1, we apply the only possible lowest priority rule ‘3’ once, rename one of the node of G as x. Now, apply \((n1)\) times the higher priority rule ‘1’, rename all the nodes labelled by N as x and the corresponding edges are renamed by 1. Then, apply \(m(n1)\) times the second priority rule ‘2’, delete all the edges labelled by 0 and halt the computation. The resulting graph is a spanning tree with all nodes labelled by x and the edges labelled by 1 (see Fig. 5). Each regulated string accepted by \(\varPi _9\) corresponds to a spanning tree of graph G in F. So the system accepts the contextsensitive language for the given final configuration. \(\square \)
4.2 Chemical graphs
Chemical graphs are just graphbased descriptions of molecules, with nodes representing the atoms ( each one of them labelled by the type (i.e.,) the name of the corresponding element ), and edges representing the bonds, with a nonnegative weight describing the order of the bond (0 for a nonexistent bond, 1 for a single bond, 2 for a double bond, and 3 for a triple bond).
Definition 3
[13] A chemical graph is a weighted graph \((V, E, \psi )\), with (V, E) an simple undirected graph where all whose nodes are labelled by means of chemical elements, and \(\psi : E \rightarrow N\) a weight function. The valence of a node in a chemical graph is the total weight of the edges incident to it.

Each carbon molecule represented as a node labelled by c.

Each hydrogen molecule represented as a node labelled by h.

The bond between any of these two molecules represented by an edge labelled by 1.
Remark 4
The PGPSG always halts on a connected graph, whose nodes are labelled by a terminal symbol. But chemical compounds are usually represented either by an uppercase alphabet or by an uppercase alphabet followed by lower case alphabet. For example, sodium, carbon, calcium and oxygen are represented by Na, C, Ca and O. Hence, we represent these chemical compounds by \(n_{a}\), c, \(c_{a}\) and o.
Remark 5
Suppose, there is a double bond existing between two molecules then we represent this by an edge labelled by 2. In general, if a k bond exists between two molecules, then we represent this by an edge labelled by k. Also, an edgelabelled 0 indicates that there is no bond between two molecules but there is −ve (negative) and +ve (positive) charge in the molecules.
is generated for (\(n1\)) times. This repetitive process requires additional membrane. Finally, it generates one H.
Proposition 1
There exists a PGPSG that halts on a chemical graph denoted by the chemical formula \(\mathrm{C}_n\mathrm{H}_{2n+2}\), \((n \ge 1)\) and accepts the guiding regular language \(\Big \{a^{3n+4}~ \big ~ n\ge 1 \Big \}\).
Proof
Let \(\mathrm{C}_n\mathrm{H}_{2n+2}\), \(n\ge 1\) be a chemical graph with \(3n+2\) nodes. Now, we construct a PGPSG \(\varPi _{10}\), which accepts the regular language \(\Big \{a^{3n+4}~ \big ~ n\ge 1 \Big \}\) and halts on a chemical graph denoted by the chemical formula \(\mathrm{C}_n\mathrm{H}_{2n+2}\), \((n \ge 1)\).
The working of PGPSG \(\varPi _{10}\) is as follows: Starting with a single node labelled by S in region 1, a sequence of application of rules ‘1’, ‘2’ and ‘3’ in that order, rewrites the single node S as a graph with a node labelled by E connected to three distinct nodes, each labelled by h. The edge between each node h and node E is labelled by 1. The resulting graph is expelled to region 2. In region 2, rule ‘5’ is applied to relabel the node E by a label c and is connected to a new node labelled by B. Anedge (c, 1, B) is introduced between c and B and the resulting graph is sent back to region 1. Repeating this process \((n1)\) times leads to the chemical graph \(\mathrm{C}_n\mathrm{H}_{2n+2}\). To terminate this process, rule ‘4’ is applied instead of rule ‘5’. The output graph is retained in region 2. \(\square \)
4.3 Chemical reactions
Proposition 2
There exists a PGPSG that simulates the chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}\) (alkanol), \((n \ge 1)\) and \(~\mathrm{NH}_3\) (ammonia), which produces the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{ONH}_4~\) (ammonium alkoxide) as output when it halts for a guiding regular language \(\Big \{a^{3n+2}bde~\big ~ n\ge 1 \Big \}\).
Proof
The working of PGPSG \(\varPi _{11}\) is as follows: We divide the simulation of the reaction into two steps. In the first step, simulate the chemical graph corresponding to the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol) for any \((n \ge 1)\) and in the second step we simulate the reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol) and \(~\mathrm{NH}_3\) (ammonia).
The simulation of the chemical graph corresponding to the chemical compound is similar to that of the graph in \(\varPi _{10}\) and the resulting chemical graph corresponding to \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}\) is expelled to region 3.
In region 3, rule ‘7’ is applied to establish the edge (h, 1, n) between the nodes H and N. Next rule ‘8’ is applied to connect the nodes o and n with an edge (o, 0, n). Finally, the deletion rule ’9’ is applied to delete the edge (o, 1, h) between the nodes o and h. The computation halts and the desired output graph is retained in membrane 3. \(\square \)
Remark 6
 1.The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol), \((n \ge 1)\) and \(~\mathrm{PH}_3\) (phosphine), produces the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OPH}_4~\) (phosphonium alkoxide).$$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~ + ~\mathrm{PH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OPH}_4 \end{aligned}$$
 2.The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH}~\) (alkanol), \((n \ge 1)\) and \(~\mathrm{SiH}_3\) (silane), produces the chemical compound \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OSiH}_4~\) (silanium alkoxide).$$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OH} + \mathrm{SiH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{OSiH}_4 \end{aligned}$$
 3.The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~\), (alkanoic acid) \((n \ge 1)\) and \(~\mathrm{NH}_3\) (ammonia), produces \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COONH}_4~\) (ammonium alkanoate). That is$$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~ + ~\mathrm{NH}_3 ~\rightarrow ~ C_nH_{2n+1}COONH_4 \end{aligned}$$
 4.The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}\),(alkanoic acid) \((n \ge 1)\) and \(~\mathrm{PH}_3\) (phosphine), produces \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOPH}_4~\) (phosphonium alkanoate). That is$$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~ + ~\mathrm{PH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOPH}_4 \end{aligned}$$
 5.The chemical reaction between \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~\), (alkanoic acid) \((n \ge 1)\) and \(~\mathrm{SiH}_3\) (silane), produces \(\mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOSiH}_4~\) (silanium alkanoate). That is$$\begin{aligned} \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOH}~ + ~\mathrm{SiH}_3 ~\rightarrow ~ \mathrm{C}_n\mathrm{H}_{2n+1}\mathrm{COOSiH}_4 \end{aligned}$$
5 Concluding remarks
In this paper, we have defined PGPSG. The language accepted by such systems was called as guiding languages. These languages are compared with the Chomskian hierarchy. We have also established that RE languages can be guiding languages if \(\lambda \)labels are allowed. The paper also contains some examples of such systems which exclusively halts on path graphs, cycles, complete graphs and complete bipartite graphs with regular and contextsensitive languages as guiding languages. As an immediate application, a PGPSG which halts on a spanning tree of a given as input graph, is also given. The model is found to be suitable for discussing the steps involved in a chemical reaction. Designing of some chemical graphs is shown. This is the first study that primarily connects P systems and chemical graphs.
Notes
Acknowledgements
This work was funded by the Project No: SB/S4/MS865/14, Department of Science and Technology, Government of India.
References
 1.Păun, Gh., Rozenberg, G., Salomaa, A. (eds.): The Oxford Handbook of Membrane Computing. Oxford University Press, Oxford (2010)Google Scholar
 2.Freund, R., Oswald, M.: P systems with local graph productions. New Gener. Comput. 22, 365–375 (2004)CrossRefzbMATHGoogle Scholar
 3.Khaira, T., Yamina, M.: Colouring graph by the Kernel P system. Int. J. Reason. Intell. Syst. 7, 286–295 (2015)Google Scholar
 4.Fernández, M., Kirchner, H., Pinaud, B..: Strategic Port Graph Rewriting: An Interactive Modelling and Analysis Framework. Research Report, Inria, France (2016)Google Scholar
 5.Păun, Gh, Sakaibara, Y., Yokomori, T.: P systems on graphs of restricted forms. Publicationes Mathematicae Debrecen 60, 635–660 (2002)MathSciNetzbMATHGoogle Scholar
 6.Maribel, F., Hélène, K., Oliver, N.: A strategy language for graph rewriting. In: International Symposium on LogicBased Program Synthesis and Transformation, pp. 173–188 (2011)Google Scholar
 7.Ramanujan, A., Krithivasan, K..: Control words of transition P systems. In: Proceedings of Seventh International Conference on BioInspired Computing: Theories and Applications (BICTA 2012), Advances in Intelligent Systems and Computing, vol. 201, pp. 145–155 (2013)Google Scholar
 8.Ramanujan, A., Krithivasan, K.: Control languages associated with spiking neural P systems. Romanian J. Inf. Sci. Technol. 15(4), 301–318 (2012)Google Scholar
 9.Sureshkumar, W., Rama, R.: Chomsky hierarchy control on isotonic array P systems. Int. J. Pattern Recognit. Artif. Intell. 30(1650004), 1–20 (2016)MathSciNetGoogle Scholar
 10.Zhang, X., Liu, Y., Luo, B., Pan, L.: Computational power of tissue P systems for generating control languages. Inf. Sci. 278, 285–297 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
 11.Mahalingam, K., Paul, P., Mäkinen, E.: On derivation languages of a class of splicing systems. Acta Cybern. (2017, Accepted)Google Scholar
 12.Rozenberg, G., Salomaa, A. (eds.): Handbook of Formal Languages. Springer, Heidelberg, pp. 1–3 (1997)Google Scholar
 13.Rosselló, F., Valiente, G.: Chemical graphs, chemical reaction graphs, and chemical graph transformation. In: Proceedings of the International Workshop on GraphBased Tools (GraBaTs 2004) GraphBased Tools 2004–2005), Electronic Notes in Theoretical Computer Science, vol. 127, no. 1, pp. 157–166 (2005)Google Scholar