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 = 
"");
 
  115     template <
class InputIterator>
 
  116     void extract(
Graph& graph, InputIterator iv1, InputIterator iv2);
 
  178     const std::set<Vertex*>& vertices() 
const;
 
  193     std::set<Vertex*> getVerticesWith(
const std::string& s,
 
  253     const std::set<Edge*>& edges() 
const;
 
  261                   const Vertex* vertex2) 
const;
 
  277     std::set<Edge*> getEdgesWith(
const std::string& s, 
const T& t) 
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")))
 
  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 
  480 const std::set<Vertex*>&
 
  494     for (VSet::const_iterator v = 
begin(); v != 
end(); ++v)
 
  496         if ((*v)->hasProperty(s))
 
  499             if ((*v)->getProperty(s, tmp) && tmp == t)
 
  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 __deprecated__(msg)
The abstract base class for all types of edges; edges are created and managed by Graphs.
The abstract base class for graphs, vertices and edges.
The base class for graphs.
bool hasVertex(const Vertex *vertex) const
Does the graph contain a given vertex?
reverse_iterator rbegin()
Get the beginning of the reversed vertex collection of the graph.
void removeEdge(Edge *edge)
Delete and remove an edge from the graph.
virtual bool check(const carto::SyntaxSet &syntax, std::set< std::string > &missing) const
Reimplemented to check children recursively.
virtual ~Graph()
The destructor is responsible for releasing the memory allocated by the addVertex and addEdge methods...
size_t order() const
The order of a graph is the number of its vertices.
size_t size() const __attribute__((__deprecated__("use edgeSize() for " "the number of edges. In a future release
iterator end()
Get the end of the vertex collection of the graph.
VSet::reference reference
virtual bool isDirected() const
Does the graph contain only directed edges?
VSet::value_type value_type
Vertex * addVertex(const std::string &s="")
Allocate and add a vertex to the graph.
VSet::reverse_iterator reverse_iterator
virtual bool isUndirected() const
Does the graph contain only undirected edges?
iterator begin()
Get the beginning of the vertex collection of the graph.
std::set< Vertex * > VSet
bool hasEdge(const Edge *edge) const
Does the graph contain a particular edge?
Edge * addDirectedEdge(Vertex *vertex1, Vertex *vertex2, std::string s)
Allocate and add to the graph a directed edge containing the given vertices.
const std::set< Vertex * > & vertices() const
Return the vertices of the graph.
const std::set< Edge * > & edges() const
Return the edges of the graph.
Graph(const std::string &s="")
Vertex * randomVertex() const
Return a random vertex (CAUTION: not perfectly random!)
VSet::const_reverse_iterator const_reverse_iterator
VSet::const_reference const_reference
std::set< Edge * > edges(const Vertex *vertex1, const Vertex *vertex2) const
Return the set of edges linking two given vertices.
VSet::pointer pointer
pointer is absent from MS Visual C++ / Intel Win32
void removeVertex(Vertex *vertex)
Delete and remove a vertex from the graph.
Graph(const FactoryPtr factory, const std::string &s="")
Edge * addUndirectedEdge(Vertex *vertex1, Vertex *vertex2, std::string s)
Allocate and add to the graph an undirected edge containing the given vertices.
FactoryPtr _factory
Abstract factory used to create vertices and edges.
void extract(Graph &graph, InputIterator iv1, InputIterator iv2)
Extract a subgraph.
std::set< Vertex * > getVerticesWith(const std::string &s) const
Find the vertices which contain a given semantic attribute.
void clear()
Delete vertices and edges.
size_t edgesSize() const
The edgesSize of a graph is the number of its edges.
Vertex * cloneVertex(const Vertex *vertex)
Clone a vertex of the graph, without attaching it to any edge.
VSet::const_iterator const_iterator
std::set< Edge * > getEdgesWith(const std::string &s) const
Find the edges which contain a given semantic attribute.
Edge * addEdge(Vertex *vertex1, Vertex *vertex2, std::string s="")
A synonym of addUnDirectedEdge - see above.
carto::rc_ptr< GraphFactory > FactoryPtr
reverse_iterator rend()
Get the end of the reversed vertex collection of the graph.
Vertices are created and managed by Graphs.
static std::string name()
static std::string dataType()
static std::string objectType()
std::map< std::string, Syntax > SyntaxSet
#define DECLARE_GENERIC_OBJECT_TYPE(T)