The AGG Menu Guide

File
New GraGra - Create a new graph grammar.
Open - Load a graph grammar.
Save - Save the selected graph grammar in its current file.
Save As - Save the selected graph grammar in a  specified file.
Open (Base) - Load a base graph grammar (A graph grammar without layout informations).
Save As (Base) - Save the base graph grammar of the selected grammar.
Export / GXL - Convert the selected gragra to GXL, an XML-based file exchange format for graphs.
Export / GTXL - Convert the selected gragra to GTXL, an XML-based file exchange format for graphs and graph transformation systems.
Import / GGX - Import a graph  in AGG own GGX format.
Import / GXL - Import a graph  in GXL format.
Import / OMONDO XMI - Import an  OMONDO .ecore  diagram.
Close GraGra - Close the selected grammar.
Quit - Exit this application.

Please note: It is also possible to use the pop-up menus of a gragra / type graph / rule / NAC / atomic constraint / constraint to obtain their functionalities. Such a pop-up menu will appear after pressing the right mouse button when the cursor points to the corresponding node of the gragra tree.
Some espesial pop-up menus are described below:
GraGra Pop-up Menu
New / Type Graph Create a new type graph for the selected grammar.
New / Graph Create a new host graph for the selected grammar.
New / Rule Create a new rule for the selected grammar.
New / Atomic Constraint Create a new atomic graphical consistency constraint (GCC) for the gragra.
New / Constraint Create a new consistency condition (CC) (boolean formula) for the gragra. Constraints are build up over the GCCs of the gragra. When the host graph is checked, the variables will get value TRUE or FALSE :  The host graph satisfies a consistency condition,  if the result value of the formula is TRUE. To edit a constraint, please use its pop-up menu.
Add State of Host Graph Add a copy of the current host graph to the selected grammar.
Layering / Set Rule Layer A table of rule layers appiars to set a layer of each rule. These layers will be used during layered graph transformation.
Layering / Set Constraint Layer A table of consistency condition (formula) layers appiars to set a layer of each formula. These layers will be used during layered graph transformation. A consistency condition has to be satisfied on its layer only.
Layering / Set Trigger Rule for Layer For each layer one rule may be determined as trigger for this layer. The so-called trigger rule is applied as first and only once, all other rules are applied as long as possible. If the trigger rule is not applicable, the corresponding layer is not executed at all.
Layering / Sort Rules by Layer The rules will be sorted according the layers.
Layering / Sort Constraints by Layer The constraints will be sorted according the layers.
Layering / Disable Rule Layer All rules of a selected layer will be disabled.
Check Rule Applicability Check each rule whether it is applicable in the context of the current state of the host graph. Visually, the name of a non-applicable rule will be gray-colored in the grammar tree view.
Consistency / Check Atomics Check if atomic graphical consistency constraints are valid. An GCC is valid, if it is a total injective morphism.
Consistency / Check Constraints Check if the work graph satisfies the consistency conditions.
Consistency / Create Post Conditions Transform global consistency conditions into post-conditions for each rule. A so-constructed rule is applicable to a consistent graph if and only if the derived graph is consistent, too.
Close Close this gragra.
Save Save this grammar.
Save As Save this grammar into the specified file.
Export / GXL Convert the selected grammar to GXL, an XML-based file exchange format for graphs.
Export / GTXL Convert the selected grammar to GTXL, an XML-based file exchange format for graphs and graph transformation systems.
Reset Graph Only host graph of currently selected grammar will be loaded again.
Reload Currently selected grammar will be loaded again.

Type Graph Pop-up Menu
This menu describes the behavior of the type graph check and defines how the type graph is used.
disabled The type graph is ignored, thus all graphs can contain objects with types defined in the type set of the grammar. Multiplicities are also ignored.
enabled The type graph is basically used. Thus, all graphs may only contain objects with types defined in the type graph. But multiplicities are not checked.
enabled with max The type graph is basically used. Thus, all graphs can only contain objects with types defined in the type graph. Multiplicities in all graphs should satisfy the defined maximum constraints.
enabled with min and max The type graph is used. Thus, all graphs can only contain objects with types defined in the type graph. Multiplicities in all graphs must satisfy the defined maximum constraints and the host graph must satisfy the minimum constraints in addition.
Delete The type graph is destroyed. Afterwards, all graphs may contain objects with types defined in the type set of the grammar.

If the type graph check is set, the defined type graph is used during all changes of the grammar.

Editing Type Graph
A new type graph can be created by item New Type Graph of the pop-up menu of GraGra. An empty type graph will be loaded in the graph editor. Editing this graph is similar to editing the host graph of a grammar.
The multiplicity of a node type or of the source and target of an edge type can be set in a multiplicity dialog which is accessed by the pop-up menu Operations of nodes and edges when you are editing a type graph.
It is possible to enrich the type graph with an inheritance relation between nodes. Each node type can have more then one direct ancestor (parent) from which it inherits the attributes and edges. A parent node can be defined using item Set Parent of the pop-up menu Operations of nodes. After selecting the parent by clicking the left button on the appropriate node the inheritance edge appears. A parent node can be unset using item Unset Parent and clicking the left button on a parent node.
Please note: The multiplicity of a parent type also has an effect to the number of instances of child types in a graph. Since all child types can be seen as instances of that parent type, the sum of all instances of all child types is limited by the multiplicity set for the parent type. Similiar for edges inherited from a parent node, the overall number of incoming or outgoing is limited by the multiplicity set for the edge connected to the parent type.

Edit
Attributes - An attribute editor is opened for the selected graph object.
This editor allows:
- to define and set the attributes,
- to define and set the attribute context ( only for the objects of a rule ),
- to add a new attribute handler.
Please note: If you use a variable as value of an attribute, the variable is added to the attribute context automatically. Renaming or deleting this variable does not change the attribute context. You have to delete non-used variables from the context explicitly, otherwise an error can happen during next match completion or transformation.
Delete - Delete all selected graph object(s) and all dangling edges that would remain.
Copy - Duplicate selected graph object(s).
Using Copy you can get a fast copy of the selected graph objects into the same graph (panel) or into a graph (panel) you can see at the same time.
For that aim:
    - select the graph objects,
    - click Copy and finally
    - click on the background of the graph panel.
Using Copy in combination with Paste you can also get a copy of the selected graph objects into another graph (panel) you cannot see at the same time.
For that aim:
    - select the graph objects,
    - click Copy,
    - choose the favoured graph,
    - click the Paste icon and finally
    - click on the background of the graph panel to place the copy.
Paste - To duplicate selected and copied graph object(s) into another graph.
For that aim:
    - select the graph objects,
    - click Copy,
    - choose the favoured graph,
    - click the Paste icon and finally
    - click on the background of the graph panel to place the copy.
Select Nodes of Type - Select all nodes of the current node type.
Select Arcs of Type - Select all edges of the current edge type.
Select All - Select all graph objects.
Deselect All - Deselect all selected objects.
Straighten Edges - All selected edges are straightened.
Identic Rule - An isomorphic rule morphism is created by copying the left graph of the rule to the right side. The previous contents of the right side is deleted. The mapping of one object to another is indicated by the same number.
Identic NAC - An isomorphic NAC morphism is created by copying the left-hand side graph of the rule to the NAC. The previous contents of the NAC is deleted. The mapping of one object to another is indicated by the same number.

Please note: It is also possible to use pop-up menus. The pop-up menu for nodes and edges of a graph appear after pressing the right mouse button when the cursor points to the node or near the middle of the edge.
Mode
Draw - A node is created by clicking the left button on the background. Nodes are filled with foreground color. An edge between two nodes is created by clicking on the source and then on the target of the edge using the left mouse button. An edge can contain one band only. The band can be inserted when creating an edge by clicking at the source, then at the background, and then at the target or by grabbing an edge with the (middle) mouse button at the point near the middle of the edge and dragging it to the desired point.
Select - Objects are selected by pointing with any mouse button at the objects to be selected. Selected nodes and edges turn to green. Clicking at a selected object, it is deselected. Selected objects can be moved, duplicated, deleted, and selected edges with a band can be straightened.
Move - A single node / edge is moved by dragging with the mouse button: press the mouse button when the cursor points to a node / edge, move the pointer and release the button. When a node is moved, incident edges are moved accordingly. Moving leads to the parallel translation of the selected objects.
Attributes - An attribute editor is opened for the picked object.
Map - Toggle mode for interactive creation of the rule / NAC / match morphism. To add a mapping, first click on an object on the left hand side of the rule, then click on the object you want to map it to on the right hand side / in a NAC  / in the host graph. If two objects are type, structure, and attribute compatible, they are labelled by the same number.
Unmap - To delete a mapping, click on a mapped object on the left hand side of the rule; the rule / NAC / match mapping is deleted. If you click on a mapped object on the right hand side of the rule, only the rule mapping is deleted. If you click on an mapped object on the NAC side, the NAC morphism will be deleted. If you click on an mapped object on the graph side, only the match morphism will be deleted.
Image_view - If an image is set for a node type, it will be shown if Image_view is selected.

Please note: It is also possible to use the pop-up menu after pressing the right mouse button on the background of a graph panel.
Transform
Start - Perform an in-place graph transformation:
- The rules given by the graph grammar are applied  non-deterministically: rules to be applied and their matches are chosen randomly;
- a layered  graph transformation is used, if option layered is set.
The host graph is modified to show the result of the rule application.
Stop - Stop the running transformation which was started with Start.
Match - Toggle mode for interactive creation of the match morphism. To add a mapping, first click on an object of the left hand side of the rule, then click on the object you want to map to in the host graph. All match completions are computed automatically by subsequently calling Next Completion.
Next Completion - Find the next match of the current rule into the host graph. If you have specified a partial match before, you can compute all its completions by subsequently calling this command.
Step - Perform an in-place graph transformation step: apply a rule on the host graph. If a match is defined before, this match is used. Otherwise, a new match is computed. The host graph is modified to show the result of the step.
Undo - Undo the last step transformation or transformation started with Start.
Parser
Open - Open a user dialog to initialize the parser and set parser GUI.
Start - Start the parsing process: parsing of a non-layered or layered graph grammar based on critical pair analysis.
Stop - Stop the parsing process.
back - Return to main GUI.
Analyzer
Critical Pair Analysis - Critical Pair Analysis computes all potentially conflicting rule pairs.
Reset - Set the current selected grammar to the grammar of critical pair analysis GUI.
Unlock - Allow edit operations on the critical pair analysis grammar.
Please note: It is necessary to reset the grammar for critical pair analysis, after the allowance for changes of the grammar has been given.
Generate > Conflicts - Change to critical pair analysis GUI, if it is not already done, and generate parallel conflicts of rule pairs.
Generate > Dependencies - Change to critical pair analysis GUI, if it is not already done, and generate sequential dependencies of rule pairs.
After finishing the generation you can select one of rule pairs to see results.
You can also load already saved critical pairs to see results or to generate them newly using other options.
Please note: Up to now it is not possible to edit the grammar after returning to the main GUI. Use Unlock to make the grammar editable. The Unlock is enabled again when the critical pair generation has finished or stopped.
Stop - Stop the generation of critical pairs.
Reduce - The smallest overlapping graph of simmilar critical pairs will be found. The number of CPs migth decrease.
Check Consistency - All overlapping graphs generated during computation of critical pairs will be checked against graph consistency constraints. The number of CPs might decrease due to constraints.
Empty - Empty the container for critical pairs.
Debug - Generate critical pairs step by step.
After selecting one rule pair, the critical pair analysis is started.
Please note: Up to now it is not possible to edit the grammar after returning to main GUI. Use Unlock to make the grammar editable. The Unlock is enabled again when the critical pair generation has finished or stopped.
Save - Save critical pairs.
By first Save and then Debug it is possible to save subsets of critical pairs.
Load > In This Window - Load critical pairs in main window.
Load > In New Window - Load critical pairs in a new window.
Show > Conflicts - Show conflicts table.
Show > Dependencies - Show dependencies table.
Show > CPA Graph - Show a relation graph based on computed conflicts/dependencies critical pairs.
Check Host Graph - Check which of the critical rules are applicable to a concrete input (host) graph. Only parallel conflicts can be checked.
back - Return to main GUI.
Consistency Check - Consistency conditions describe basic properties of graphs as e.g. the existence or uniqueness of certain elements, independent of particular rules. A graph grammar is consistent if the start graph satisfies the consistency conditions and the rules preserve this property.
Check Atomics - Check if the atomic constraints are valid. An atomic constraint is valid, if it is a total injective morphism.
Check Constraints - Check if the start graph satisfies the consistency conditions.
Using rule pop-up menu one can create or delete post-conditions of an individual rule. If you deleted or changed a global atomic consistency constraint or a formula, you have to create   post-conditions   again.
Termination Check - In  AGG  termination criteria are implemented for layered graph transformation systems. These criteria are defined for typed graph transformation with injective rules, injective matches and injective negative application conditions (NACs).
Moreover we define layered graph grammars with deletion and nondeletion layers. Termination criteria are expressed by deletion and nondeletion layer conditions.
The deletion layer conditions ensure that the last creation of an element with a certain label (type) should precede the first deletion of an element with the same label. On the other hands, nondeletion layer conditions ensure that if an element of a certain label occurs in the LHS of a rule then all elements of the same label were already created in previous layers.

A graph grammar is called   layered graph grammar   ( LGG )  if for each rule   r   we have a rule layer   rl (r) = k   and for each label   l   a creation layer   cl (l)   and a deletion layer   dl (l) ,  and a deletion layer and a nondeletion layer satisfying the following conditions for all rules:
(1) Deletion Layer Conditions
------------------------------------------
If   k   is a deletion layer, then
1. each rule r decreases the number of graph items, or
2. each rule r decreases the number of graph items of one special type.

(2) Deletion Layer Conditions
------------------------------------------
If   k   is a deletion layer
1. r   is deleting at least one item
2. 0 <= cl (l) <= dl (l) <= n   for all   l
3. if   r   deletes   l    then   dl (l) <= rl (r)
4. if   r   creates   l    then   cl (l) > rl (r)

(3) Nondeletion Layer Conditions
-------------------------------------------------
If   k   is a nondele
tion layer
1. r   is nondeleting,   i.e.   r : L -> R   is total and injective
2. r   has NAC   n : L -> N   with   n' : N -> R   injective   s.t.   n'   o n = r
3. if   l   occurs in   L    then   cl (l) <= rl (r)
4. if   r   creates   l    then   cl (l) > rl (r)

The termination criteria (2) and (3) are defined for typed graph transformation with injective rules, injective matches and injective negative application conditions (NACs).
The deletion layer conditions  (2)  ensure that the last creation of an element of a certain type should precede the first deletion of an element of the same type.
On the other hand,   nondeletion layer conditions  (3)  ensure that if an element of a certain type occurs in the LHS of a rule then all elements of the same type were already created in this or a previous layer.
A  layered graph grammar  with deletion and nondeletion layers terminates, if for each layer the deletion or nondeletion layer conditions defined above are satisfied.
The rule layers can be set or generated, the creation and deletion type layers will be generated automatically.

Preferences
Options... - Options for graph transformation, critical pair analysis and parsing are shown here.
Transformation
The options for graph transformation include:
- Match (morphism) completion strategy
- Match conditions
- injective / non-injective matching
- dangling condition
- identification condition
( note: dangling and identification conditions realize Double Pushout Approach)
- NACs (Negative Application Conditions)
- Consistency check during transformation :
allows to decide how graph consistency constraints influences the transformation process:
consistency transformation only or
stop after inconsistent transformation.
- layered graph transformation, that means: each rule or a group of rules get a layer number beginning with 0. The rule(s) with smallest layer are applied first as long as possible and then the rule(s) with the next layer, and so on.
- show layer befor transform allows to set the layers again.
- loop over layers allows to continue graph transformation by beginning on the smallest layer again and continuing as long as possible.
- stop current layer only means that the graph transformation on the current layer will be stopped, if menu item Stop of menu Transformation is chosen. Thereafter, rules of the next layer will be applied, etc.
- check rule applicability on the host graph If this option is set, each rule will be checked whether it is applicable in the context of the current state of the host graph. Visually, the name of a non-applicable rule will be gray-colored in the grammar tree view. If the option is not set, you can use menu item Check Rule Applicability of the GraGra pop-up menu to make this check only once. Use Undo button to redisplay the grammar tree view.
- show after step if selected, the altered host graph will be shown after each graph transformation step during the interpretation process; if not selected, the altered host graph will only be shown when transformation finished.
- wait after step means that the transformation process will be paused after each succesful match and step to give the possibility to see the current match and a rule of the application. Entering any key allows to continue the transformation process.
- select new objects after step means that the new graph objects will be selected after each step with aim to improve the visualization of the graph transformation process.
Please note: Rule layers for graph transformation are identical with rule layers for parsing and critical pair analysis. If the option Transformation / layered is set then the option Parser / layered and Critical Pair / layered  is set, too. Also the other options (injective, dangling, NACs)  will be used during parsing or critical pair analysis, too.
Layouter
A new graph layout algorithm "Evolutionary Layout of Graph Transformation Sequences" for transformed graphs is integrated into AGG.

The options for the graph layouter include:
- perform during graph transformation - if selected, the new layout algorithm is used to layout the transformed graphs.
- write to directory - if selected, each graph of the graph transformation sequence is converted to JPEG image (.jpg) and written to a user defined directory. The directory can be chosen before the transformation by a file chooser dialog.
- write to (.log) file - if selected, the layout metrics are written into a .log file in a user defined derectory (see {\em write to directory}).
- iteration count of layout process - is used to set the count of iterations to run. Use RETURN key to accept the changes.
- initial temperature of cooling - is used to set an initial temperature $t(0)$ for the initial layout. Use RETURN key to accept the changes.
- preferred edge length - defines the preferred length for all edges of the transformed graphs. Use RETURN key to accept the changes.
- use layout pattern - enables the Graph Layout Pattern area of this option dialog. If selected, a user can define or change an edge type pattern, that would be used for layout. If this option isn't selected, the only default layout pattern of this algorithm are used, but no user defined pattern.
- Selected Edge Type - defines the type for the edge type layout patterns.
- Edge Type Layout Pattern - it allows to define at most three patterns: one for X-, one for Y-axis and one for edge length.
- preferred length - defines edge length pattern. Use RETURN key to accept the changes.
In general, a similar distance between child nodes is caused by the spring embedder layout and should not be described by a pattern itself.
- Table of Graph Layout Patterns - this table shows all user defined patterns for all edge types.
Parser
The options for parsing include:
- Display settings
- algorithm for parser
- layered The rule layers defined before are used for critical pair analysis and parsing.
Please note: The rule layers are identical with the rule layers for the graph transformation.
Critical Pair
The options for critical pair analysis include:
- Select algorithm for critical pairs
conflicts This algorithm detects parallel conflicts between rule applications
dependensies This algorithm detects sequential dependencies between rule applications
- complete If selected, complete generation (searching all possible matches) of critical pairs will be done, if not selected, searching up to first critical match.
- consistent If selected, all overlapping graphs generated during computation of critical pairs will be checked against graph consistency constraints. The number of critical pairs migth decrease due to constraints.
- reduce If selected, the smallest overlapping graph of simmilar critical pairs will be shown. The number of overlapping graphs of critical pairs migth decrease.
- Display Settings
- layered The rule layers defined before are used for critical pair analysis and parsing.
Please note: The rule layers are identical with the rule layers of the graph transformation.