SMT-RAT
24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
|
This class implements a forward hypergraph. More...
#include <ForwardHyperGraph.h>
Data Structures | |
struct | Edge |
Internal type of an edge. More... | |
Public Types | |
using | Vertex = std::size_t |
Internal type of a vertex. More... | |
Public Member Functions | |
Vertex | newVertex (const VertexProperty &vp) |
Returns a new vertex that is labeled with the given vertex property. More... | |
Edge & | newEdge (Vertex source, const EdgeProperty &ep) |
Creates a new edge where the given vertex is the incoming vertex that is labeled with the given edge property. More... | |
Edge & | newEdge (const VertexProperty &source, const EdgeProperty &ep) |
Creates a new edge where the given vertex is the incoming vertex that is labeled with the given edge property. More... | |
const VertexProperty & | operator[] (Vertex v) const |
Retrieves the vertex property for the given vertex. More... | |
VertexProperty & | operator[] (Vertex v) |
Retrieves the vertex property for the given vertex. More... | |
const std::vector< Edge > & | out (Vertex v) const |
Retrieves all outgoing edges for the given vertex. More... | |
const std::vector< Edge > & | out (const VertexProperty &v) const |
Retrieves all outgoing edges for the given vertex. More... | |
Vertex | begin () const |
Returns the first vertex. More... | |
Vertex | end () const |
Returns the past-the-last vertex. More... | |
std::size_t | size () const |
Returns the number of vertices. More... | |
void | toDot (const std::string &filename) const |
Writes a representation of this graph to the given file. More... | |
Private Attributes | |
std::vector< VertexProperty > | mVertexProperties |
Storage for all vertex properties. More... | |
std::vector< std::vector< Edge > > | mEdges |
Mapping from vertices to outgoing edges. More... | |
std::map< VertexProperty, Vertex > | mVertexMap |
Mapping from vertex properties to vertices to ensure uniqueness. More... | |
Friends | |
template<typename VP , typename EP > | |
std::ostream & | operator<< (std::ostream &os, const ForwardHyperGraph< VP, EP > &fhg) |
Writes a textual representation of this graph to the given stream. More... | |
This class implements a forward hypergraph.
We define a hypergraph to be a graph structure $(V,E)$ where $V$ is a set of vertices and $E \subseteq 2^V$ a set of hyperedges. A hyperedge can connect an arbitrary number of vertices.
If a hypergraph is directed if every edge $e \in E$ is partitioned into $I(e)$ and $O(e)$ that are sets of incoming vertices and outgoing vertices, respectively. A forward hypergraph is directed and every edge has only a single incoming vertices, that is $|I(e)| = 1$. Note that we store edges as a mapping from the incoming vertex to a set of outgoing vertices and thus do not have an explicit incoming vertex in our edge representation.
This implementation of a forward hypergraph accepts arbitrary labels (called properties) for both vertices and edges. It relies on a dense list of vertices that are internally labeled starting from zero. Therefore, removal of vertices is not supported.
If the third template parameter UniqueVertices is set to true (being the default), we make sure that every vertex is unique with respect to its property. To make this possible, a vertex property may not be changed in this case which is enforced using a static assertion. No requirements are imposed on the edge properties.
This class supports both printing a simple text representation and writing a description to a dot file.
Definition at line 31 of file ForwardHyperGraph.h.
using smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::Vertex = std::size_t |
Internal type of a vertex.
Definition at line 34 of file ForwardHyperGraph.h.
|
inline |
Returns the first vertex.
Definition at line 122 of file ForwardHyperGraph.h.
|
inline |
Returns the past-the-last vertex.
Definition at line 126 of file ForwardHyperGraph.h.
|
inline |
Creates a new edge where the given vertex is the incoming vertex that is labeled with the given edge property.
Definition at line 98 of file ForwardHyperGraph.h.
|
inline |
Creates a new edge where the given vertex is the incoming vertex that is labeled with the given edge property.
Definition at line 92 of file ForwardHyperGraph.h.
|
inline |
Returns a new vertex that is labeled with the given vertex property.
If UniqueVertices is set to true and a vector with the given property already exists, this vector is returned.
Definition at line 81 of file ForwardHyperGraph.h.
|
inline |
Retrieves the vertex property for the given vertex.
This method is disabled if UniqueVertices is set to true.
Definition at line 108 of file ForwardHyperGraph.h.
|
inline |
Retrieves the vertex property for the given vertex.
Definition at line 103 of file ForwardHyperGraph.h.
|
inline |
Retrieves all outgoing edges for the given vertex.
Definition at line 118 of file ForwardHyperGraph.h.
|
inline |
Retrieves all outgoing edges for the given vertex.
Definition at line 114 of file ForwardHyperGraph.h.
|
inline |
Returns the number of vertices.
Definition at line 130 of file ForwardHyperGraph.h.
void smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::toDot | ( | const std::string & | filename | ) | const |
Writes a representation of this graph to the given file.
|
friend |
Writes a textual representation of this graph to the given stream.
|
private |
Mapping from vertices to outgoing edges.
Definition at line 75 of file ForwardHyperGraph.h.
|
private |
Mapping from vertex properties to vertices to ensure uniqueness.
Definition at line 77 of file ForwardHyperGraph.h.
|
private |
Storage for all vertex properties.
Definition at line 73 of file ForwardHyperGraph.h.