SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices > Class Template Reference

This class implements a forward hypergraph. More...

#include <ForwardHyperGraph.h>

Collaboration diagram for smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >:

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...
 
EdgenewEdge (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...
 
EdgenewEdge (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, VertexmVertexMap
 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...
 

Detailed Description

template<typename VertexProperty, typename EdgeProperty, bool UniqueVertices = true>
class smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >

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.

Member Typedef Documentation

◆ Vertex

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
using smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::Vertex = std::size_t

Internal type of a vertex.

Definition at line 34 of file ForwardHyperGraph.h.

Member Function Documentation

◆ begin()

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
Vertex smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::begin ( ) const
inline

Returns the first vertex.

Definition at line 122 of file ForwardHyperGraph.h.

◆ end()

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
Vertex smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::end ( ) const
inline

Returns the past-the-last vertex.

Definition at line 126 of file ForwardHyperGraph.h.

◆ newEdge() [1/2]

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
Edge& smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::newEdge ( const VertexProperty &  source,
const EdgeProperty &  ep 
)
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.

Here is the call graph for this function:

◆ newEdge() [2/2]

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
Edge& smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::newEdge ( Vertex  source,
const EdgeProperty &  ep 
)
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.

Here is the caller graph for this function:

◆ newVertex()

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
Vertex smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::newVertex ( const VertexProperty &  vp)
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.

◆ operator[]() [1/2]

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
VertexProperty& smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::operator[] ( Vertex  v)
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.

◆ operator[]() [2/2]

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
const VertexProperty& smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::operator[] ( Vertex  v) const
inline

Retrieves the vertex property for the given vertex.

Definition at line 103 of file ForwardHyperGraph.h.

◆ out() [1/2]

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
const std::vector<Edge>& smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::out ( const VertexProperty &  v) const
inline

Retrieves all outgoing edges for the given vertex.

Definition at line 118 of file ForwardHyperGraph.h.

◆ out() [2/2]

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
const std::vector<Edge>& smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::out ( Vertex  v) const
inline

Retrieves all outgoing edges for the given vertex.

Definition at line 114 of file ForwardHyperGraph.h.

◆ size()

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
std::size_t smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::size ( ) const
inline

Returns the number of vertices.

Definition at line 130 of file ForwardHyperGraph.h.

◆ toDot()

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
void smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::toDot ( const std::string &  filename) const

Writes a representation of this graph to the given file.

Friends And Related Function Documentation

◆ operator<<

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
template<typename VP , typename EP >
std::ostream& operator<< ( std::ostream &  os,
const ForwardHyperGraph< VP, EP > &  fhg 
)
friend

Writes a textual representation of this graph to the given stream.

Field Documentation

◆ mEdges

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
std::vector<std::vector<Edge> > smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::mEdges
private

Mapping from vertices to outgoing edges.

Definition at line 75 of file ForwardHyperGraph.h.

◆ mVertexMap

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
std::map<VertexProperty,Vertex> smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::mVertexMap
private

Mapping from vertex properties to vertices to ensure uniqueness.

Definition at line 77 of file ForwardHyperGraph.h.

◆ mVertexProperties

template<typename VertexProperty , typename EdgeProperty , bool UniqueVertices = true>
std::vector<VertexProperty> smtrat::ForwardHyperGraph< VertexProperty, EdgeProperty, UniqueVertices >::mVertexProperties
private

Storage for all vertex properties.

Definition at line 73 of file ForwardHyperGraph.h.


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