#include <hyper_graph.h>
Classes | |
class | Edge |
struct | HyperGraphElement |
base hyper graph element, specialized in vertex and edge More... | |
class | Vertex |
abstract Vertex, your types must derive from that one More... | |
Public Types | |
typedef std::set< Edge * > | EdgeSet |
typedef std::tr1::unordered_map< int, Vertex * > | VertexIDMap |
typedef std::set< Vertex * > | VertexSet |
typedef std::vector< Vertex * > | VertexVector |
Public Member Functions | |
Edge * | addEdge (Edge *e) |
adds an edge to the graph. If the edge is already in the graph, it does nothing and returns 0. otherwise it returns e. | |
Vertex * | addVertex (Vertex *v) |
virtual void | clear () |
clears the graph and empties all structures. | |
const EdgeSet & | edges () const |
EdgeSet & | edges () |
HyperGraph () | |
constructs an empty hyper graph | |
virtual bool | removeEdge (Edge *e) |
removes a vertex from the graph. Returns true on success (edge was present) | |
virtual bool | removeVertex (Vertex *v) |
removes a vertex from the graph. Returns true on success (vertex was present) | |
Vertex * | vertex (int id) |
returns a vertex id in the hyper-graph, or 0 if the vertex id is not present | |
const Vertex * | vertex (int id) const |
returns a vertex id in the hyper-graph, or 0 if the vertex id is not present | |
const VertexIDMap & | vertices () const |
VertexIDMap & | vertices () |
virtual | ~HyperGraph () |
destroys the hyper-graph and all the vertices of the graph | |
Protected Attributes | |
EdgeSet | _edges |
VertexIDMap | _vertices |
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 class 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 46 of file hyper_graph.h.
typedef std::set<Edge*> g2o::HyperGraph::EdgeSet |
Definition at line 57 of file hyper_graph.h.
typedef std::tr1::unordered_map<int, Vertex*> g2o::HyperGraph::VertexIDMap |
Definition at line 60 of file hyper_graph.h.
typedef std::set<Vertex*> g2o::HyperGraph::VertexSet |
Definition at line 58 of file hyper_graph.h.
typedef std::vector<Vertex*> g2o::HyperGraph::VertexVector |
Definition at line 61 of file hyper_graph.h.
constructs an empty hyper graph
Definition at line 123 of file hyper_graph.cpp.
g2o::HyperGraph::~HyperGraph | ( | ) | [virtual] |
destroys the hyper-graph and all the vertices of the graph
Definition at line 137 of file hyper_graph.cpp.
HyperGraph::Edge * g2o::HyperGraph::addEdge | ( | Edge * | e | ) |
adds an edge to the graph. If the edge is already in the graph, it does nothing and returns 0. otherwise it returns e.
Definition at line 75 of file hyper_graph.cpp.
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 a poiner to the vertex, on success, or 0 on failure.
Definition at line 66 of file hyper_graph.cpp.
void g2o::HyperGraph::clear | ( | void | ) | [virtual] |
clears the graph and empties all structures.
Reimplemented in g2o::SparseOptimizer.
Definition at line 127 of file hyper_graph.cpp.
const EdgeSet& g2o::HyperGraph::edges | ( | ) | const [inline] |
Definition at line 134 of file hyper_graph.h.
EdgeSet& g2o::HyperGraph::edges | ( | ) | [inline] |
Definition at line 136 of file hyper_graph.h.
bool g2o::HyperGraph::removeEdge | ( | Edge * | e | ) | [virtual] |
removes a vertex from the graph. Returns true on success (edge was present)
Definition at line 105 of file hyper_graph.cpp.
bool g2o::HyperGraph::removeVertex | ( | Vertex * | v | ) | [virtual] |
removes a vertex from the graph. Returns true on success (vertex was present)
Reimplemented in g2o::SparseOptimizer.
Definition at line 87 of file hyper_graph.cpp.
HyperGraph::Vertex * g2o::HyperGraph::vertex | ( | int | id | ) |
returns a vertex id in the hyper-graph, or 0 if the vertex id is not present
Reimplemented in g2o::OptimizableGraph.
Definition at line 50 of file hyper_graph.cpp.
const HyperGraph::Vertex * g2o::HyperGraph::vertex | ( | int | id | ) | const |
returns a vertex id in the hyper-graph, or 0 if the vertex id is not present
Reimplemented in g2o::OptimizableGraph.
Definition at line 58 of file hyper_graph.cpp.
const VertexIDMap& g2o::HyperGraph::vertices | ( | ) | const [inline] |
Definition at line 129 of file hyper_graph.h.
VertexIDMap& g2o::HyperGraph::vertices | ( | ) | [inline] |
Definition at line 131 of file hyper_graph.h.
EdgeSet g2o::HyperGraph::_edges [protected] |
Definition at line 151 of file hyper_graph.h.
VertexIDMap g2o::HyperGraph::_vertices [protected] |
Definition at line 150 of file hyper_graph.h.