StdMatchFinder provides a simple algorithm which takes two arbitrary graphs and calculates all matchings from one to the other.
More...
#include <StdMatchFinder.h>
|
void | mapEdges (graphs::AnonHypergraph const &source, graphs::AnonHypergraph const &target, size_t edgesToGo, unordered_set< IDType > &mappableEdges, graphs::Mapping ¤tMapping, graphs::Mapping &revCurrentMapping, shared_ptr< vector< graphs::Mapping >> foundMappings) const |
| Maps all edges of the target graph recursively to all edges of the source graph, including the induced mapping on the nodes. More...
|
|
bool | isMapPossible (graphs::AnonHypergraph const &source, IDType srcEdge, graphs::AnonHypergraph const &target, IDType tarEdge, graphs::Mapping ¤tMapping, graphs::Mapping &revCurrentMapping) const |
| Checks if a given edge of the source graph can be mapped to a given edge of the target graph. More...
|
|
IDType | getNewEntryPoint (graphs::AnonHypergraph const &source, graphs::Mapping const ¤tMapping) const |
| Searched for an unmapped edge in the source graph according to a simple optimization criterion. More...
|
|
shared_ptr< vector
< graphs::Mapping > > | mapIsolatedNodes (graphs::AnonHypergraph const &source, graphs::AnonHypergraph const &target, shared_ptr< vector< graphs::Mapping >> foundMappings) const |
| Maps all isolated notes of the source graph to the target graph. More...
|
|
void | enumAllIsoNodesInj (vector< IDType > &isolatedNodes, size_t isolatedNodesPos, vector< IDType > &targets, unordered_set< IDType > &noTargets, graphs::Mapping ¤tMapping, shared_ptr< vector< graphs::Mapping >> allMappings) const |
| This method recursively enumerates through all possibilities to map the isolated nodes injectively to the target graph. More...
|
|
void | enumAllIsoNodesNonInj (vector< IDType > &isolatedNodes, vector< IDType > &targets, graphs::Mapping ¤tMapping, shared_ptr< vector< graphs::Mapping >> allMappings) const |
| Enumerates through all possibilities to map the isolated nodes non-injectively to the target graph. More...
|
|
|
bool | matchInjective |
| Stores whether the used matches should injective or not.
|
|
bool | stopOnFirstFind |
| Stores whether the matcher should stop after finding at least one match.
|
|
StdMatchFinder provides a simple algorithm which takes two arbitrary graphs and calculates all matchings from one to the other.
The Matcher can calculate injective as well as non-injective matches and can search for all or just one match. The result is a collection of Mappings.
- Author
- Jan Stückrath
- See Also
- graphs::Hypergraph
-
graphs::Mapping
Generates a new instance of StdMatchFinder.
No further initialization is necessary.
- Parameters
-
injective | set to true, if only injective matches should be returned |
stopFast | set to true, if the computation should be stoped after the first match is found |
void enumAllIsoNodesInj |
( |
vector< IDType > & |
isolatedNodes, |
|
|
size_t |
isolatedNodesPos, |
|
|
vector< IDType > & |
targets, |
|
|
unordered_set< IDType > & |
noTargets, |
|
|
graphs::Mapping & |
currentMapping, |
|
|
shared_ptr< vector< graphs::Mapping >> |
allMappings |
|
) |
| const |
|
protected |
This method recursively enumerates through all possibilities to map the isolated nodes injectively to the target graph.
For each such possibility a new Mapping is added to the collection of all Mappings.
- Parameters
-
isolatedNodes | a vector containing all isolated nodes of the source graph |
isolatedNodesPos | the current position in the list of isolated nodes, a map is searched for; initially has to be 0 |
targets | a collection of all nodes of the target graph, where the isolated nodes can be mapped to; has to be all nodes of the target graph not already mapped to |
noTargets | a set of all targets already used for isolated node mapping; initially has to be an empty set |
currentMapping | the currently worked on (partial) Mapping |
allMappings | a collection, where all resulting Mappings will be stored; should be empty initially |
Enumerates through all possibilities to map the isolated nodes non-injectively to the target graph.
For each such possibility a new Mapping is added to the collection of all Mappings.
- Parameters
-
isolatedNodes | a vector containing all isolated nodes of the source graph |
targets | a collection of all nodes of the target graph, where the isolated nodes can be mapped to; has to be all nodes of the target graph |
currentMapping | the currently worked on (partial) Mapping |
allMappings | a collection, where all resulting Mappings will be stored; should be empty initially |
This method takes two graphs and calculates all matches from the source to the target graph.
According to the parameter it is either searched for injective or non-injective matches. Instead of searching for all possible matches, the procedure can also terminate after the first match is found. In any case a list of the possible matches is returned.
- Parameters
-
source | the source graph, which is mapped to the target graph |
target | the target graph, which is mapped from the source graph |
- Returns
- a collection of all matchings from the source graph to the target graph (an empty collection, if none exist)
Searched for an unmapped edge in the source graph according to a simple optimization criterion.
This criterion is: has the maximal arity.
- Parameters
-
source | the graph to search in |
currentMapping | the currently worked on (partial) Mapping |
- Returns
- the ID of the "best" unmapped edge
Checks if a given edge of the source graph can be mapped to a given edge of the target graph.
This includes checking for label equality and if the result is still a Mapping (and not a relation). If necessary, the injectivity of the Mapping is also checked.
- Parameters
-
source | the source graph |
srcEdge | the source edge ID to check (must be part of the source graph) |
target | the target graph |
tarEdge | the target edge ID to check (must be part of the target graph) |
currentMapping | the currently worked on (partial) Mapping |
revCurrentMapping | the reverse of currentMapping; only used if injective=true |
Maps all edges of the target graph recursively to all edges of the source graph, including the induced mapping on the nodes.
Either searches for one or all Mappings. These Mappings can be restricted to be injective.
- Parameters
-
source | the source graph, the Mapping maps from |
target | the target graph, the Mapping maps to |
edgesToGo | the number of edges of the source graph, which still have to be mapped; initially this has to be the number of edges of the source graph |
mappableEdges | a working set of edges, which are not yet mapped, but attached to already mapped nodes; initially this has to be an empty set |
currentMapping | the currently worked on (partial) Mapping; initially has to be an empty Mapping |
revCurrentMapping | the reverse of currentMapping; only used if injective=true; initially has to be an empty Mapping |
foundMappings | the steadily growing collection of found (total) Mappings; initially has to be an empty vector |
Maps all isolated notes of the source graph to the target graph.
According to the parameters, either one or all Mappings are searched for and these Mappings must be injective or not. The result is returned as a vector of Mappings
- Parameters
-
source | the source graph, mapped from |
target | the target graph, mapped to |
foundMappings | the collection of Mappings found so far, where the isolated nodes still need to be mapped |
- Returns
- a vector containing all Mappings including mapped isolated nodes
bool matchesInjectively |
( |
| ) |
const |
Returns whether this matcher generates injective or non-injective matches.
- Returns
- true, iff this matcher will generate only injective matches
void setInjectivity |
( |
bool |
injective | ) |
|
Sets whether this matcher should generate injective matches or not.
- Parameters
-
injective | 'true' will cause injective matches to be generated |
void setStopOnFirstFind |
( |
bool |
stopFast | ) |
|
Sets whether this matcher should stop after the first matching found.
- Parameters
-
stopFast | 'true' will cause the matcher to stop after finding one match |
bool stopsOnFirstFind |
( |
| ) |
const |
Returns whether the matcher will stop after finding the first match.
return true, iff this matcher stops after finding the first match
The documentation for this class was generated from the following files:
- /home/stueckrath/eclipse_ws/Uncover/src/rule_engine/StdMatchFinder.h
- /home/stueckrath/eclipse_ws/Uncover/src/rule_engine/StdMatchFinder.cpp