34 #ifndef GRAPH_GRAPH_GRAPH_H 35 #define GRAPH_GRAPH_GRAPH_H 43 #ifndef GRAPH_GRAPH_GRAPHOBJECT_H 46 #ifndef GRAPH_GRAPH_VERTEX_H 49 #ifndef GRAPH_GRAPH_EDGE_H 52 #ifndef GRAPH_GRAPH_GFACTORY_H 76 typedef std::set<Vertex*>
VSet;
77 typedef std::set<Edge*>
ESet;
94 Graph(
const std::string& s =
"");
100 Graph(
const FactoryPtr factory,
const std::string& s =
"");
115 template <
class InputIterator>
116 void extract(
Graph& graph, InputIterator iv1, InputIterator iv2);
142 Vertex* addVertex(
const std::string& s =
"");
160 bool hasVertex(
const Vertex* vertex)
const;
168 void removeVertex(
Vertex* vertex);
173 Vertex* randomVertex()
const;
178 const std::set<Vertex*>& vertices()
const;
184 std::set<Vertex*> getVerticesWith(
const std::string& s)
const;
193 std::set<Vertex*> getVerticesWith(
const std::string& s,
240 bool hasEdge(
const Edge* edge)
const;
248 void removeEdge(
Edge* edge);
253 const std::set<Edge*>& edges()
const;
260 std::set<Edge*> edges(
const Vertex* vertex1,
261 const Vertex* vertex2)
const;
267 std::set<Edge*> getEdgesWith(
const std::string& s)
const;
277 std::set<Edge*> getEdgesWith(
const std::string& s,
const T& t)
const;
302 const_iterator begin()
const;
308 const_iterator end()
const;
315 reverse_iterator rbegin();
322 reverse_iterator rend();
329 const_reverse_iterator rbegin()
const;
336 const_reverse_iterator rend()
const;
348 size_t order()
const;
354 __attribute__((__deprecated__("use edgeSize() for "
355 "the number of edges. In a future release, size() will return the "
356 "number properties as it does in GenericObject")));
360 size_t edgesSize() const;
366 virtual
bool isUndirected() const;
372 virtual
bool isDirected() const;
380 std::set<
std::
string>& missing) const;
396 void internalExtract(
Graph& graph, const
std::set<
Vertex*>& vertices);
411 Graph& operator=(const Graph&);
449 #ifndef DOXYGEN_HIDE_INTERNAL_CLASSES 469 #endif // DOXYGEN_HIDE_INTERNAL_CLASSES 477 const std::set<Vertex*>&
489 std::set<Vertex*> vertices;
491 for (VSet::const_iterator v = begin(); v != end(); ++v)
493 if ((*v)->hasProperty(s))
496 if ((*v)->getProperty(s, tmp) && tmp == t)
511 return addUndirectedEdge(vertex1, vertex2, s);
516 const std::set<Edge*>&
528 std::set<Edge*> edges;
530 for (ESet::iterator e = _edges.begin(); e != _edges.end(); ++e)
532 if ((*e)->hasProperty(s))
535 if ((*e)->getProperty(s, tmp) && tmp == t)
546 template <
class InputIterator>
551 internalExtract(graph, std::set<Vertex*>(iv1, iv2));
559 return _vertices.begin();
567 return _vertices.end();
575 return _vertices.begin();
583 return _vertices.end();
591 return _vertices.rbegin();
599 return _vertices.rend();
606 return _vertices.rbegin();
614 return _vertices.rend();
#define DECLARE_GENERIC_OBJECT_TYPE(T)
VSet::pointer pointer
pointer is absent from MS Visual C++ / Intel Win32
VSet::const_reference const_reference
const std::set< Edge * > & edges() const
Return the edges of the graph.
const std::set< Vertex * > & vertices() const
Return the vertices of the graph.
static std::string dataType()
carto::rc_ptr< GraphFactory > FactoryPtr
VSet::const_reverse_iterator const_reverse_iterator
The base class for graphs.
VSet::reference reference
static std::string objectType()
static std::string name()
reverse_iterator rbegin()
Get the beginning of the reversed vertex collection of the graph.
The abstract base class for all types of edges; edges are created and managed by Graphs.
VSet::reverse_iterator reverse_iterator
VSet::value_type value_type
std::set< Vertex * > getVerticesWith(const std::string &s) const
Find the vertices which contain a given semantic attribute.
std::map< std::string, Syntax > SyntaxSet
reverse_iterator rend()
Get the end of the reversed vertex collection of the graph.
Edge * addEdge(Vertex *vertex1, Vertex *vertex2, std::string s="")
A synonym of addUnDirectedEdge - see above.
VSet::const_iterator const_iterator
iterator begin()
Get the beginning of the vertex collection of the graph.
std::set< Vertex * > VSet
The abstract base class for graphs, vertices and edges.
void extract(Graph &graph, InputIterator iv1, InputIterator iv2)
Extract a subgraph.
std::set< Edge * > getEdgesWith(const std::string &s) const
Find the edges which contain a given semantic attribute.
Vertices are created and managed by Graphs.
iterator end()
Get the end of the vertex collection of the graph.