Skip to content
Snippets Groups Projects

Add feature/graph regex/query resolution

Merged vincent lorrain requested to merge addFeature/graphRegex/queryResolution into main
3 files
+ 109
12
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -11,6 +11,11 @@
@@ -11,6 +11,11 @@
namespace Aidge{
namespace Aidge{
 
/**
 
* type for recipes function use in query and resolve
 
*/
 
using RecipesFunctionType = std::function<void(std::shared_ptr<MatchSolution>)>;
 
/**
/**
* @brief class which is the hight level interface for graph matching, used to simplify match definition
* @brief class which is the hight level interface for graph matching, used to simplify match definition
*
*
@@ -19,9 +24,10 @@ class GraphRegex{
@@ -19,9 +24,10 @@ class GraphRegex{
private:
private:
std::vector<std::string> mQuery;
//std::vector<std::string> mQuery;
std::vector<std::shared_ptr<ConditionalInterpreter>> mAllTest;
std::vector<std::shared_ptr<ConditionalInterpreter>> mAllTest;
std::map<std::string, std::function<bool(NodePtr)>> mAllLambda;
std::map<std::string, std::function<bool(NodePtr)>> mAllLambda;
 
std::map<std::string,RecipesFunctionType> mQueryRecipe;
public:
public:
GraphRegex(){};
GraphRegex(){};
@@ -31,7 +37,15 @@ class GraphRegex{
@@ -31,7 +37,15 @@ class GraphRegex{
* @brief add a topology query to the match
* @brief add a topology query to the match
* @param query the topology query to find
* @param query the topology query to find
**/
**/
void addQuery(const std::string query);
//void addQuery(const std::string query);
 
 
/**
 
* @brief add a topology query to the match and a function for recipe
 
* @param query the topology query to find
 
* @param f the funct
 
**/
 
void addQuery(const std::string query,RecipesFunctionType f = nullptr);
 
/**
/**
* @brief get all the types of a graph and set it as type key in the query
* @brief get all the types of a graph and set it as type key in the query
@@ -53,13 +67,19 @@ class GraphRegex{
@@ -53,13 +67,19 @@ class GraphRegex{
**/
**/
void setNodeKey(const std::string key,std::function<bool(NodePtr)> f);
void setNodeKey(const std::string key,std::function<bool(NodePtr)> f);
/***
/**
* @brief brief match the queries in the graph
* @brief brief match the queries in the graph
* @param Reference the graph were the querys in search
* @param ref the graph were the querys in search
* @return the result
* @return the result
*/
*/
std::set<std::shared_ptr<MatchSolution>> match(std::shared_ptr<GraphView> ref);
std::set<std::shared_ptr<MatchSolution>> match(std::shared_ptr<GraphView> ref);
 
/***
 
* @brief match the queries in the graph and applied the recipes fuction
 
* @param ref the graph were the querys in search
 
*/
 
void appliedRecipes(std::shared_ptr<GraphView> ref);
 
private:
private:
void _generateCombinationsStart(const std::set<NodePtr>& elements, std::size_t n, std::size_t index,
void _generateCombinationsStart(const std::set<NodePtr>& elements, std::size_t n, std::size_t index,
Loading