UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
OldMinorOrder.h
1 /***************************************************************************
2  * Copyright (C) 2009 by Marvin Heumüller *
3  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
19  ***************************************************************************/
20 
21 #ifndef OldMinorOrder_H_
22 #define OldMinorOrder_H_
23 
24 #include <queue>
25 #include <list>
26 #include <set>
27 #include "../graphs/Hypergraph.h"
28 #include "../basic_types/Order.h"
29 
30 namespace uncover {
31  namespace minors {
32 
42  {
43 
44  class PathFinder;
45 
46  public:
47 
51  OldMinorOrder();
52 
56  virtual ~OldMinorOrder();
57 
64  virtual bool isLessOrEq(graphs::Hypergraph const& smaller, graphs::Hypergraph const& bigger) const override;
65 
66  private:
67 
68  typedef struct
69  {
70  vector<IDType> minor;
71  vector<IDType> graph;
72  } twoIDLists ;
73 
81  bool mapping( graphs::Hypergraph const& minor,
82  graphs::Hypergraph const& graph,
83  std::map<string, vector<IDType> >& occurencesG,
84  vector<pair<IDType, string> >& occurencesM,
85  size_t currentI,
86  std::map<IDType, IDType>& mappings) const;
87 
94  bool createEdgeTupels(graphs::Hypergraph const& minor,
95  graphs::Hypergraph const& graph,
96  std::map<IDType, IDType>& mappings) const;
97 
98 
105  bool findPaths(graphs::Hypergraph const& g, std::list<std::set<IDType> >& connV, std::set<IDType> mappedEdges) const;
106 
112  void createCombinations(std::list<PathFinder>& p,
113  std::list<PathFinder>::iterator it,
114  std::list<std::set<IDType> >& result) const;
115 
122  bool combinePaths(std::list<std::list<std::set<IDType> >* >::iterator it0,
123  std::list<std::list<std::set<IDType> >* >::iterator end,
124  std::set<IDType>& nodesUsed) const;
125 
126 
136  {
137 
138  public:
139 
140  PathFinder(graphs::Hypergraph const& graph, IDType start, IDType end, std::set<IDType> forbidden);
141 
142  ~PathFinder() {}
143 
144  const std::set<IDType>* getNextPath();
145 
146  const std::set<IDType>* getNextPath(std::set<IDType> tmpForbidden);
147 
148  const std::set<IDType>* getCurrentPath();
149 
150  void reset();
151 
152  int getPathCount() { return currentPath; }
153 
154  private:
155 
156  typedef struct
157  {
158 
159  IDType position; //Position to search next
160 
161  bool isEdge; //Is element at position an edge?
162 
163  std::set<IDType> innerPath; //All vertices and edges on the path except for start and end nodes
164 
165  } QueueEl;
166 
167  graphs::Hypergraph const& graph; // The graph in which we search for a path
168 
169  IDType start; //Start vertex
170 
171  IDType end; //End vertex
172 
173  vector<std::set<IDType> > ids; //All Paths found so far
174 
175  std::queue<QueueEl> sq; //Current queue for breadth-first search
176 
177  std::set<IDType> forbidden; //forbidden element ids on path
178 
179  int currentPath; //Current Position in ids
180 
181  };
182 
183  };
184 
185  }
186 }
187 
188 #endif
This class is an old implementation of the Hypergraph Minor Ordering based on searching for disjoint ...
Definition: OldMinorOrder.h:41
void createCombinations(std::list< PathFinder > &p, std::list< PathFinder >::iterator it, std::list< std::set< IDType > > &result) const
is called for each edgeTupel.
Definition: OldMinorOrder.cpp:318
bool mapping(graphs::Hypergraph const &minor, graphs::Hypergraph const &graph, std::map< string, vector< IDType > > &occurencesG, vector< pair< IDType, string > > &occurencesM, size_t currentI, std::map< IDType, IDType > &mappings) const
Finds a mapping of an edge in M in G.
Definition: OldMinorOrder.cpp:91
bool combinePaths(std::list< std::list< std::set< IDType > > * >::iterator it0, std::list< std::list< std::set< IDType > > * >::iterator end, std::set< IDType > &nodesUsed) const
Tries all possible combinations of all possible combinations of paths of edgeTupels.
Definition: OldMinorOrder.cpp:287
Definition: OldMinorOrder.h:68
virtual ~OldMinorOrder()
Destroys the current OldMinorOrder object.
Definition: OldMinorOrder.cpp:33
A Hypergraph represents a graph with a unique identifier.
Definition: Hypergraph.h:35
virtual bool isLessOrEq(graphs::Hypergraph const &smaller, graphs::Hypergraph const &bigger) const override
Checks whether the first given graph is a minor of the second.
Definition: OldMinorOrder.cpp:35
Searching for paths between two vertices.
Definition: OldMinorOrder.h:135
bool createEdgeTupels(graphs::Hypergraph const &minor, graphs::Hypergraph const &graph, std::map< IDType, IDType > &mappings) const
creates from the given edge-matches vertex-matches.
Definition: OldMinorOrder.cpp:125
This class presents a generic ordering relation on Hypergraphs.
Definition: Order.h:32
unsigned int IDType
IDType is an (unsigned) integer specifically used as an Identifier of graphs, elements of graphs or a...
Definition: globals.h:53
OldMinorOrder()
Creates a new OldMinorOrder object.
Definition: OldMinorOrder.cpp:31
bool findPaths(graphs::Hypergraph const &g, std::list< std::set< IDType > > &connV, std::set< IDType > mappedEdges) const
Based on the edgeTupels, sets of pathFinders are created for every edgeTupel.
Definition: OldMinorOrder.cpp:234