NDEVR
API Documentation
HyperGraph

Class that models a directed Hyper-Graph. More...

Inheritance diagram for HyperGraph:
[legend]
Collaboration diagram for HyperGraph:
[legend]

Classes

class  HGEdge
 Abstract Edge class. More...
class  HGVertex
 abstract Vertex, your types must derive from that one More...

Public Member Functions

 HyperGraph ()
 constructs an empty hyper graph
virtual ~HyperGraph ()
 destroys the hyper-graph and all the vertices of the graph
virtual bool addEdge (HGEdge *e)
 Adds an edge to the graph.
virtual bool addVertex (HGVertex &v)
 adds a vertex to the graph.
virtual void clear ()
 removes a vertex from the graph. Returns true on success (vertex was present)
Buffer< HGEdge * > & edges ()
const Buffer< HGEdge * > & edges () const
HGVertexvertex (int id)
 returns a vertex id in the hyper-graph, or 0 if the vertex id is not present
const HGVertexvertex (int id) const
 returns a vertex id in the hyper-graph, or 0 if the vertex id is not present
Dictionary< int, HGVertex * > & vertices ()
const Dictionary< int, HGVertex * > & vertices () const

Protected Attributes

Buffer< HGEdge * > _edges
 Collection of all edges in the graph.
Dictionary< int, HGVertex * > _vertices
 Map from vertex id to vertex pointer.

Detailed Description

Class that models a directed Hyper-Graph.

An hyper graph is a graph where an edge can connect one or more nodes. Both Vertices and Edges of an hyoper graph derive from the same HyperGraphElement, thus one can implement generic algorithms that operate transparently on edges or vertices (see HyperGraphAction).

The vertices are uniquely identified by an int id, while the edges are identfied by their pointers.

Definition at line 19 of file hyper_graph.h.

Member Function Documentation

◆ addEdge()

virtual bool HyperGraph::addEdge ( HGEdge * e)
inlinevirtual

Adds an edge to the graph.

If the edge is already in the graph, it does nothing and returns false. Otherwise it returns true.

Reimplemented in OptimizableGraph.

Definition at line 173 of file hyper_graph.h.

References _edges, HyperGraph::HGEdge::vertex(), and HyperGraph::HGEdge::vertexCount().

Referenced by OptimizableGraph::addEdge().

◆ addVertex()

virtual bool HyperGraph::addVertex ( HGVertex & v)
inlinevirtual

adds a vertex to the graph.

The id of the vertex should be set before invoking this function. the function fails if another vertex with the same id is already in the graph. returns true, on success, or false on failure.

Reimplemented in OptimizableGraph.

Definition at line 162 of file hyper_graph.h.

References _vertices, and HyperGraph::HGVertex::id().

Referenced by OptimizableGraph::addVertex().

◆ clear()

virtual void HyperGraph::clear ( )
inlinevirtual

removes a vertex from the graph. Returns true on success (vertex was present)

removes a vertex from the graph. Returns true on success (edge was present) clears the graph and empties all structures.

Reimplemented in SparseOptimizer.

Definition at line 140 of file hyper_graph.h.

References _edges, and _vertices.

Referenced by SparseOptimizer::clear().

◆ edges() [1/2]

Buffer< HGEdge * > & HyperGraph::edges ( )
inline
Returns
the set of edges of the hyper graph

Definition at line 154 of file hyper_graph.h.

References _edges.

◆ edges() [2/2]

const Buffer< HGEdge * > & HyperGraph::edges ( ) const
inline
Returns
the set of edges of the hyper graph

Definition at line 152 of file hyper_graph.h.

References _edges.

Referenced by OptimizableGraph::chi2(), and SparseOptimizer::initializeOptimization().

◆ vertices() [1/2]

Dictionary< int, HGVertex * > & HyperGraph::vertices ( )
inline
Returns
the map id -> vertex where the vertices are stored

Definition at line 149 of file hyper_graph.h.

References _vertices.

◆ vertices() [2/2]

const Dictionary< int, HGVertex * > & HyperGraph::vertices ( ) const
inline
Returns
the map id -> vertex where the vertices are stored

Definition at line 147 of file hyper_graph.h.

References _vertices.

Referenced by OptimizableGraph::dimensions(), SparseOptimizer::findGauge(), SparseOptimizer::gaugeFreedom(), SparseOptimizer::initializeOptimization(), and OptimizableGraph::maxDimension().


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