UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Private Member Functions | List of all members
MinorOrder Class Reference

This class implements the Hypergraph Minor Ordering, as described in "Applying the Graph Minor Theorem to the Verification of Graph Transformation Systems" (Salil Joshi, Barbara König). More...

#include <MinorOrder.h>

Inheritance diagram for MinorOrder:
Inheritance graph
[legend]
Collaboration diagram for MinorOrder:
Collaboration graph
[legend]

Public Member Functions

 MinorOrder ()
 Creates a new MinorOrder object.
 
virtual ~MinorOrder ()
 Destroys the current MinorOrder object.
 
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. More...
 

Private Member Functions

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. More...
 
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 graphB to node IDs of graphS induced by the edge map (storing it in nodeMap). More...
 
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. More...
 
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 graph to edges of the larger graph. More...
 
bool inc (vector< size_t > &vec, size_t tarCount) const
 Increments the given vector such that it consists of the next sequence of distinct values between 0 and tarCount-1. More...
 
bool inc (vector< basic_types::IDPartitionEnumerator > &enums, size_t pos) const
 Increments the given vector ignoring the first pos indices. More...
 
size_t findFirst (vector< size_t > const &vec, size_t tofind) const
 Finds the occurrence of toFinde with the least index in the vector. More...
 
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. More...
 
bool isIncludedIn (basic_types::IDPartition const &part, graphs::Mapping::Inversion const &mapp) const
 Checks if the given partition is included in the inverse Mapping. More...
 
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. More...
 

Detailed Description

This class implements the Hypergraph Minor Ordering, as described in "Applying the Graph Minor Theorem to the Verification of Graph Transformation Systems" (Salil Joshi, Barbara König).

Author
Jan Stückrath

Member Function Documentation

bool checkContractions ( graphs::Hypergraph const &  graphB,
graphs::Mapping const &  nodeMap,
graphs::Mapping::Inversion const &  invNodeMap,
unordered_set< IDType > const &  preservedEdges,
int  isoNodes 
) const
private

Checks if edges of the given graph can be contracted to obtain a smaller graph.

The smaller graph is implicitly given by the Mapping and Mapping::Inversion parameters.

Parameters
graphBthe graph of which edge contractions are simulated
nodeMapthe map of nodes of graphB to the smaller graph
invNodeMapthe inversion of nodeMap
preservedEdgesthe set of all IDs of edges of graphB which have an image in the smaller graph
isoNodesthe number of isolated nodes, the smaller graph has more than graphB (may be negative)
Returns
true iff the smaller graph can be generated from graphB by contraction of edges
bool enoughIsolated ( basic_types::IDPartition const &  part,
graphs::Mapping const &  mapp,
int  num 
) const
inlineprivate

Checks if the given partition has enough subpartitions to be mapped to isolated nodes.

Such a mapping is possible if all elements of a subpartition do not have an image under the Mapping. The number of subpartitions necessary is given by num.

Parameters
partthe partition to be tested
mappa Mapping of all nodes which are incident to edges which are mapped to the smaller graph
numthe number of isolated nodes the smaller graph has more than the larger graph (may be negative)
Returns
true, iff enough subpartitions exist
size_t findFirst ( vector< size_t > const &  vec,
size_t  tofind 
) const
inlineprivate

Finds the occurrence of toFinde with the least index in the vector.

If none could be found, vec.size() is returned.

Parameters
vecthe vector to be searched
tofindthe element to be found
Returns
the least index of the element of vec.size() if none was found
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
private

Given a mapping of edges of graphS to edges of graphB, this method generates a Mapping of node IDs of graphB to node IDs of graphS induced by the edge map (storing it in nodeMap).

Additionally all edge IDs in graphB used for this Mapping are stored in preservedEdges. If it is not possible to generate a Mapping from the given data, this function returns false.

Parameters
graphSthe smaller graph
graphBthe larger graph
edgeMapSa map where the keys are labels of edges in graphS and values are the collection of edge IDs of graphS with this label
edgeMapBa map where the keys are labels of edges in graphS(!) and values are the collection of edge IDs of graphB with this label
edgesToEdgesa vector of pairs where the first element is a label and the second a vector defining that the i-th edge in edgeMapS with that label is mapped to the edgesToEdges[i]-th edge in edgeMapB with that label
nodeMapthe mapping of nodes to nodes, generated by this method is stored in this parameter
preservedEdgesthe IDs of edges of graphB used to generate the node map are stored in this parameter
Returns
true, iff it is possible to generate a node Mapping
bool inc ( vector< pair< string, vector< size_t >>> &  vec,
map< string, vector< IDType >> &  posTargets 
) const
private

Increments the given vector such that it represents the next possible mapping of edges of the smaller graph to edges of the larger graph.

Parameters
vecthe vector which will be "incremented"
posTargetsa mapping of labels of the larger graph to IDs of edges with this labels
Returns
true, iff the incrementation was possible (false if all possible incrementations have been performed)
bool inc ( vector< size_t > &  vec,
size_t  tarCount 
) const
private

Increments the given vector such that it consists of the next sequence of distinct values between 0 and tarCount-1.

Parameters
vecthe vector which will be "incremented"
tarCountthe vector will only consist of (distinct) values between 0 and tarCount-1
Returns
true, iff the incrementation was possible (false if all possible incrementations have been performed)
bool inc ( vector< basic_types::IDPartitionEnumerator > &  enums,
size_t  pos 
) const
inlineprivate

Increments the given vector ignoring the first pos indices.

The enumerator at the index pos is incremented and possibly also higher indices if the enumerator has ended. Enumerators at indices before pos are reset.

Parameters
enumsthe vector of enumerators which will be incremented
posthe number of indices ignored (beginning from 0)
Returns
true, iff the incrementation was possible (false if all possible incrementations have been performed)
bool isFiner ( basic_types::IDPartition const &  part,
graphs::Mapping const &  mapp 
) const
inlineprivate

Checks if the given partition is finer that the partition induced by the Mapping.

The partition is finer iff, whenever two elements are in the same subpartition, they have the same image under the Mapping. IDs without images under the Mapping are ignored.

Parameters
partthe partition to be tested
mappthe Mapping to be tested
Returns
true iff the partition is finer (or equally fine)
bool isIncludedIn ( basic_types::IDPartition const &  part,
graphs::Mapping::Inversion const &  mapp 
) const
inlineprivate

Checks if the given partition is included in the inverse Mapping.

A partition is included in an inverse Mapping iff, whenever two IDs have the same image under the Mapping, both IDs are in the same subpartition.

Parameters
partthe partition to be tested
mappthe inverse Mapping to be tested
Returns
true, iff the partition is included in the inverse Mapping
bool isLessOrEq ( graphs::Hypergraph const &  smaller,
graphs::Hypergraph const &  bigger 
) const
overridevirtual

Checks whether the first given graph is a minor of the second.

Parameters
smallerthe possible minor
biggerthe possibly larger graph
Returns
true iff the first graph is a minor of the second

Implements Order.

void reset ( vector< size_t > &  vec,
size_t  numCount 
) const
inlineprivate

Clears the given vector and fills it with the numbers from 0 to numCount-1.

Parameters
vecthe vector to be reset
numCountthe number of elements added to the vector

The documentation for this class was generated from the following files: