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 #ifndef AIMS_GRAPH_SIZE_NO_DEPREC_WARNING 356 "the number of edges. In a future release, size() will return the " 357 "number properties as it does in GenericObject")))
363 size_t edgesSize()
const;
369 virtual bool isUndirected()
const;
375 virtual bool isDirected()
const;
383 std::set<std::string>& missing)
const;
399 void internalExtract(
Graph& graph,
const std::set<Vertex*>& vertices);
425 std::set<Vertex*> _vertices;
440 std::set<Edge*> _edges;
452 #ifndef DOXYGEN_HIDE_INTERNAL_CLASSES 472 #endif // DOXYGEN_HIDE_INTERNAL_CLASSES 480 const std::set<Vertex*>&
492 std::set<Vertex*> vertices;
494 for (VSet::const_iterator v = begin(); v != end(); ++v)
496 if ((*v)->hasProperty(s))
499 if ((*v)->getProperty(s, tmp) && tmp == t)
514 return addUndirectedEdge(vertex1, vertex2, s);
519 const std::set<Edge*>&
531 std::set<Edge*> edges;
533 for (ESet::iterator e = _edges.begin(); e != _edges.end(); ++e)
535 if ((*e)->hasProperty(s))
538 if ((*e)->getProperty(s, tmp) && tmp == t)
549 template <
class InputIterator>
554 internalExtract(graph, std::set<Vertex*>(iv1, iv2));
562 return _vertices.begin();
570 return _vertices.end();
578 return _vertices.begin();
586 return _vertices.end();
594 return _vertices.rbegin();
602 return _vertices.rend();
609 return _vertices.rbegin();
617 return _vertices.rend();
#define DECLARE_GENERIC_OBJECT_TYPE(T)
VSet::pointer pointer
pointer is absent from MS Visual C++ / Intel Win32
#define __deprecated__(msg)
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.
FactoryPtr _factory
Abstract factory used to create vertices and edges.
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.