Exploring Graph Grammar rules: Locate Initial


We are now going into the details of the second Graph Grammar rule which locates the initial state at the beginning of the Graph Grammar. If you select "locateinitial" and click on "edit":  

 


LSH/RHS: Left Hand Side/Right Hand Side  

   

The LHS ==> RHS will be the mapping of the initial state to the same initial state tagged with the "current state" node.  

 

   

We see that the LHS of this rule is only composed of one state, the initial state. If we click on the RHS button:  

 

   

A "current state" object was linked to the initial state to start the FSA simulation with the right state.  


Condition

   

We need a condition to ensure that this rule is only executed once.  

 

   

line 2: Search the whole instance of the graph to find if a node of type "current state" was already created

line 3: Return false if the current state exists, true otherwise  


Action

   

No action needs to be specified.