UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
MinorOrder.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef MINORORDER_H_
21 #define MINORORDER_H_
22 
23 #include "../graphs/Hypergraph.h"
24 #include "../graphs/Mapping.h"
25 #include "../basic_types/Order.h"
26 #include "../basic_types/IDPartitionEnumerator.h"
27 
28 namespace uncover {
29  namespace minors {
30 
37  {
38 
39  public:
40 
44  MinorOrder();
45 
49  virtual ~MinorOrder();
50 
57  virtual bool isLessOrEq(graphs::Hypergraph const& smaller, graphs::Hypergraph const& bigger) const override;
58 
59  private:
60 
71  bool checkContractions(
72  graphs::Hypergraph const& graphB,
73  graphs::Mapping const& nodeMap,
74  graphs::Mapping::Inversion const& invNodeMap,
75  unordered_set<IDType> const& preservedEdges,
76  int isoNodes) const;
77 
97  bool generateMapp(
98  graphs::Hypergraph const& graphS,
99  graphs::Hypergraph const& graphB,
100  map<string, vector<IDType>> const& edgeMapS,
101  map<string, vector<IDType>> const& edgeMapB,
102  vector<pair<string,vector<size_t>>> const& edgesToEdges,
103  graphs::Mapping& nodeMap,
104  unordered_set<IDType>& preservedEdges) const;
105 
111  void reset(vector<size_t>& vec, size_t numCount) const;
112 
121  bool inc(vector<pair<string,vector<size_t>>>& vec, map<string, vector<IDType>>& posTargets) const;
122 
131  bool inc(vector<size_t>& vec, size_t tarCount) const;
132 
142  bool inc(vector<basic_types::IDPartitionEnumerator>& enums, size_t pos) const;
143 
151  size_t findFirst(vector<size_t> const& vec, size_t tofind) const;
152 
161  bool isFiner(basic_types::IDPartition const& part, graphs::Mapping const& mapp) const;
162 
170  bool isIncludedIn(basic_types::IDPartition const& part, graphs::Mapping::Inversion const& mapp) const;
171 
181  bool enoughIsolated(basic_types::IDPartition const& part, graphs::Mapping const& mapp, int num) const;
182 
183  };
184 
185  }
186 }
187 
188 #endif
size_t findFirst(vector< size_t > const &vec, size_t tofind) const
Finds the occurrence of toFinde with the least index in the vector.
Definition: MinorOrder.cpp:357
bool enoughIsolated(basic_types::IDPartition const &part, graphs::Mapping const &mapp, int num) const
Checks if the given partition has enough subpartitions to be mapped to isolated nodes.
Definition: MinorOrder.cpp:161
This is the data structure representing a morphism mapping from a graph to another graph...
Definition: Mapping.h:36
bool isIncludedIn(basic_types::IDPartition const &part, graphs::Mapping::Inversion const &mapp) const
Checks if the given partition is included in the inverse Mapping.
Definition: MinorOrder.cpp:193
bool isFiner(basic_types::IDPartition const &part, graphs::Mapping const &mapp) const
Checks if the given partition is finer that the partition induced by the Mapping. ...
Definition: MinorOrder.cpp:366
This class implements the Hypergraph Minor Ordering, as described in "Applying the Graph Minor Theore...
Definition: MinorOrder.h:36
bool generateMapp(graphs::Hypergraph const &graphS, graphs::Hypergraph const &graphB, map< string, vector< IDType >> const &edgeMapS, map< string, vector< IDType >> const &edgeMapB, vector< pair< string, vector< size_t >>> const &edgesToEdges, graphs::Mapping &nodeMap, unordered_set< IDType > &preservedEdges) const
Given a mapping of edges of graphS to edges of graphB, this method generates a Mapping of node IDs of...
Definition: MinorOrder.cpp:226
A Hypergraph represents a graph with a unique identifier.
Definition: Hypergraph.h:35
unordered_map< IDType, unordered_set< IDType > > Inversion
Alias for an inverse Mapping, mapping IDs to collections of IDs.
Definition: Mapping.h:55
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: MinorOrder.cpp:33
MinorOrder()
Creates a new MinorOrder object.
Definition: MinorOrder.cpp:29
void reset(vector< size_t > &vec, size_t numCount) const
Clears the given vector and fills it with the numbers from 0 to numCount-1.
Definition: MinorOrder.cpp:266
This class presents a generic ordering relation on Hypergraphs.
Definition: Order.h:32
unordered_set< SubIDPartition > IDPartition
An IDPartition is a set of sets of IDs (which is effectively a set of equivalence classes)...
Definition: IDPartition.h:37
virtual ~MinorOrder()
Destroys the current MinorOrder object.
Definition: MinorOrder.cpp:31
bool inc(vector< pair< string, vector< size_t >>> &vec, map< string, vector< IDType >> &posTargets) const
Increments the given vector such that it represents the next possible mapping of edges of the smaller...
Definition: MinorOrder.cpp:292
bool checkContractions(graphs::Hypergraph const &graphB, graphs::Mapping const &nodeMap, graphs::Mapping::Inversion const &invNodeMap, unordered_set< IDType > const &preservedEdges, int isoNodes) const
Checks if edges of the given graph can be contracted to obtain a smaller graph.
Definition: MinorOrder.cpp:107