C++ main module for gpm Package  1.0
GPM_Core

GPM_Core package contains classes used to generate port graphs for rewriting. More...

GPM_Core package contains classes used to generate port graphs for rewriting.

This package is based on Boost Graph Library (BGL).

The purpose of the package is to rewrite graph:

The Graph with Ports Module is a module to use graph with vertices & edges whose vertices may be either a node and a port.

A node can only connected to ports by undirected edges whereas ports can only be connected to another port or to a node.

If a port is connected to many nodes, all the nodes are considered to be equals. If a port is connected to many ports, all the ports are considered to be equals. All nodes & ports may have tags.

gpm01.png

Each graph element which can be either a port , an edge or a node have states defined by a variable. A particular variable called "mCoord" describes the coordinates of a vertex (either a node or a port). Each graph element mays also have trigger actions on modiffing variables. The GPM8GraphElement::executeTriggerActions() return false if the trigger actions can not be executed.

The purpose of this module is to rewriting a port graph to another.

gpm02.png

The rewriting of graph consists in replacing all the occurences of a pattern graph by a transformer graph in a large graph. The algorithm needs datas:

A first set of rules consists in managing the way to connect the transformer graph in the large graph thanks to the mapped pattern graph:

Another set of rules consists in modifiing the states of the large graph nodes or edges which are mapped to the pattern graph

The last set of rules consists in setting the states of the vertex or edges for nodes or edges in the added transformer graph into large graph.

The re-writing algorithm is as follow:

The rules is the way to connect the transformer graph in the large graph thanks to the pattern graph. The rules is given by the GPM_PatternFunction. The following methods consist in defining the rules to connect mapped transformed graph into large graph:

To match pattern graph, the following methods consist in setting the id of nodes & ports in order to speed up the pattern graph research:

When a pattern graph is found in the large graph the virtual method GPM_PatternFunction::isMappingValid() enables to reject the mapping if needed.

The GPM_PatternFunction::setIsUpToAutomorphism() method consists innot considering all the permutations of one mapping. The vertices of all mapping are ordered with respect to their internal id. The key is built from this ordered vertices list and this key is registered in a map. If the key already exists, the mapping is rejected, otherwise, the mapping is accepted.

The following virtual methods consist in modifiing the states of the mapped pattern graph to large graph

The mappings of the pattern graph into a large graph are detected by the GPM_Graph::getPatterns() method. Only vertex with same group name can be mapped and only port with same group name can be also mapped. For each detected mapping, a specialized method GPM_Graph::isMappingValid is called to determine if the mapping is valid when using attributtes (coords,tag) unusued in the previous detecting.

The signal GPM_PortGraph::patternsMappingSignalEmit is emitted for special actions to do after mappings detection.

The method GPM_Graph::addSubGraph copies the transformer graph into a large graph.

The method GPM_Graph::executeTriggerActions execute all the marked actions.

The method GPM_PortGraph::reduce transform a general grap into a port graph.

It contains :

The organization of this package is as follow:

gpm_core.jpg