|  | graph
    5.0.5
    Graph: generic attributed relational graphs | 
The base class for graphs. More...
#include <graph/graph/graph.h>


| Public Types | |
| typedef std::set< Vertex * > | VSet | 
| typedef std::set< Edge * > | ESet | 
| typedef carto::rc_ptr< GraphFactory > | FactoryPtr | 
| typedef VSet::value_type | value_type | 
| typedef VSet::pointer | pointer | 
| pointer is absent from MS Visual C++ / Intel Win32  More... | |
| typedef VSet::reference | reference | 
| typedef VSet::const_reference | const_reference | 
| typedef VSet::iterator | iterator | 
| typedef VSet::const_iterator | const_iterator | 
| typedef VSet::reverse_iterator | reverse_iterator | 
| typedef VSet::const_reverse_iterator | const_reverse_iterator | 
|  Public Types inherited from carto::SyntaxedObject< T > | |
| typedef internal::SyntaxedObjectSwitch< T, SUPERSUBCLASS(Interface, T)>::ContentType | ContentType | 
| Public Member Functions | |
| Graph (const std::string &s="") | |
| Graph (const FactoryPtr factory, const std::string &s="") | |
| virtual | ~Graph () | 
| The destructor is responsible for releasing the memory allocated by the addVertex and addEdge methods.  More... | |
| template<class InputIterator > | |
| void | extract (Graph &graph, InputIterator iv1, InputIterator iv2) | 
| Extract a subgraph.  More... | |
| Clean up | |
| void | clear () | 
| Delete vertices and edges.  More... | |
| Vertex handling | |
| Vertex * | addVertex (const std::string &s="") | 
| Allocate and add a vertex to the graph.  More... | |
| Vertex * | cloneVertex (const Vertex *vertex) | 
| Clone a vertex of the graph, without attaching it to any edge.  More... | |
| bool | hasVertex (const Vertex *vertex) const | 
| Does the graph contain a given vertex?  More... | |
| void | removeVertex (Vertex *vertex) | 
| Delete and remove a vertex from the graph.  More... | |
| Vertex * | randomVertex () const | 
| Return a random vertex (CAUTION: not perfectly random!)  More... | |
| const std::set< Vertex * > & | vertices () const | 
| Return the vertices of the graph.  More... | |
| std::set< Vertex * > | getVerticesWith (const std::string &s) const | 
| Find the vertices which contain a given semantic attribute.  More... | |
| template<class T > | |
| std::set< Vertex * > | getVerticesWith (const std::string &s, const T &t) const | 
| Find the vertices which contain a given semantic attribute/value pair.  More... | |
| Edge handling | |
| Edge * | addUndirectedEdge (Vertex *vertex1, Vertex *vertex2, std::string s) | 
| Allocate and add to the graph an undirected edge containing the given vertices.  More... | |
| Edge * | addEdge (Vertex *vertex1, Vertex *vertex2, std::string s="") | 
| A synonym of addUnDirectedEdge - see above.  More... | |
| Edge * | addDirectedEdge (Vertex *vertex1, Vertex *vertex2, std::string s) | 
| Allocate and add to the graph a directed edge containing the given vertices.  More... | |
| bool | hasEdge (const Edge *edge) const | 
| Does the graph contain a particular edge?  More... | |
| void | removeEdge (Edge *edge) | 
| Delete and remove an edge from the graph.  More... | |
| const std::set< Edge * > & | edges () const | 
| Return the edges of the graph.  More... | |
| std::set< Edge * > | edges (const Vertex *vertex1, const Vertex *vertex2) const | 
| Return the set of edges linking two given vertices.  More... | |
| std::set< Edge * > | getEdgesWith (const std::string &s) const | 
| Find the edges which contain a given semantic attribute.  More... | |
| template<class T > | |
| std::set< Edge * > | getEdgesWith (const std::string &s, const T &t) const | 
| Find the edges which contain a given pair semantic attribute/value.  More... | |
| Iterators iterate on the vertices | |
| iterator | begin () | 
| Get the beginning of the vertex collection of the graph.  More... | |
| iterator | end () | 
| Get the end of the vertex collection of the graph.  More... | |
| const_iterator | begin () const | 
| Get the beginning of the vertex collection of the graph.  More... | |
| const_iterator | end () const | 
| Get the end of the vertex collection of the graph.  More... | |
| reverse_iterator | rbegin () | 
| Get the beginning of the reversed vertex collection of the graph.  More... | |
| reverse_iterator | rend () | 
| Get the end of the reversed vertex collection of the graph.  More... | |
| const_reverse_iterator | rbegin () const | 
| Get the beginning of the reversed vertex collection of the graph.  More... | |
| const_reverse_iterator | rend () const | 
| Get the end of the reversed vertex collection of the graph.  More... | |
| Property querying methods | |
| size_t | order () const | 
| The order of a graph is the number of its vertices.  More... | |
| size_t | size () const __attribute__((__deprecated__("use edgeSize() for " "the number of edges. In a future release | 
| size_t | size () will return the " "number properties as it does in GenericObject"))) | 
| size_t | edgesSize () const | 
| The edgesSize of a graph is the number of its edges.  More... | |
| virtual bool | isUndirected () const | 
| Does the graph contain only undirected edges?  More... | |
| virtual bool | isDirected () const | 
| Does the graph contain only directed edges?  More... | |
| virtual bool | check (const carto::SyntaxSet &syntax, std::set< std::string > &missing) const | 
| Reimplemented to check children recursively.  More... | |
|  Public Member Functions inherited from GraphObject | |
| virtual | ~GraphObject () | 
|  Public Member Functions inherited from carto::SyntaxedObject< T > | |
| SyntaxedObject (const std::string &s) | |
| SyntaxedObject (const SyntaxedObject &x) | |
| SyntaxedObject (const SyntaxedObject< PropertySet > &x) | |
| Protected Attributes | |
| FactoryPtr | _factory | 
| Abstract factory used to create vertices and edges.  More... | |
| Additional Inherited Members | |
|  Protected Member Functions inherited from GraphObject | |
| GraphObject (const std::string &s) | |
| The programmer should not call the constructor of an abstract base class.  More... | |
| GraphObject (const GraphObject &x) | |
| typedef VSet::const_iterator Graph::const_iterator | 
| typedef VSet::const_reference Graph::const_reference | 
| typedef VSet::const_reverse_iterator Graph::const_reverse_iterator | 
| typedef std::set<Edge*> Graph::ESet | 
| typedef carto::rc_ptr<GraphFactory> Graph::FactoryPtr | 
| typedef VSet::iterator Graph::iterator | 
| typedef VSet::pointer Graph::pointer | 
| typedef VSet::reference Graph::reference | 
| typedef VSet::reverse_iterator Graph::reverse_iterator | 
| typedef VSet::value_type Graph::value_type | 
| typedef std::set<Vertex*> Graph::VSet | 
| Graph::Graph | ( | const std::string & | s = "" | ) | 
| s | syntactic attribute of the new graph | 
| Graph::Graph | ( | const FactoryPtr | factory, | 
| const std::string & | s = "" | ||
| ) | 
| factory | abstract factory used instead of the default factory | 
| s | syntactic attribute of the new graph | 
| 
 | virtual | 
The destructor is responsible for releasing the memory allocated by the addVertex and addEdge methods.
The programmer should never delete vertex and edge objects; they are managed by the graph.
Allocate and add to the graph a directed edge containing the given vertices.
Note that the pointer returned by this method is to be seen as a simple identifier for the new edge; the programmer should never delete it. It is the responsability of the graph which creates the edge to delete it.
| vertex1 | first vertex | 
| vertex2 | second vertex | 
| s | syntactic attribute of the new edge | 
| range_error | if a vertex is not in the graph | 
Allocate and add to the graph an undirected edge containing the given vertices.
Note that the pointer returned by this method is to be seen as a simple identifier for the new edge; the programmer should never delete it. It is the responsability of the graph which creates the edge to delete it.
| vertex1 | first vertex | 
| vertex2 | second vertex | 
| s | syntactic attribute of the new edge | 
| range_error | if a vertex is not in the graph | 
| Vertex* Graph::addVertex | ( | const std::string & | s = "" | ) | 
Allocate and add a vertex to the graph.
Note that the pointer returned by this method is to be seen as a simple identifier for the new vertex; the programmer should never delete it. It is the responsability of the graph which creates the vertex to delete it.
| s | syntactic attribute of the new vertex | 
| 
 | inline | 
| 
 | inline | 
| 
 | virtual | 
Reimplemented to check children recursively.
| syntax | syntax to check against | 
| missing | completed with the names of missing attributes | 
| void Graph::clear | ( | ) | 
Delete vertices and edges.
Clone a vertex of the graph, without attaching it to any edge.
This a commodity method for copying the attributes, not the topology of the graph! Note that the pointer returned by this method is to be seen as a simple identifier for the new vertex; the programmer should never delete it. It is the responsability of the graph which creates the vertex to delete it.
| vertex | pointer to the vertex to clone | 
| 
 | inline | 
Return the set of edges linking two given vertices.
| vertex1 | is the source vertex | 
| vertex2 | is the sink vertex | 
| size_t Graph::edgesSize | ( | ) | const | 
The edgesSize of a graph is the number of its edges.
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
| std::set<Edge*> Graph::getEdgesWith | ( | const std::string & | s | ) | const | 
Find the edges which contain a given semantic attribute.
| s | semantic attribute to look for | 
| 
 | inline | 
| std::set<Vertex*> Graph::getVerticesWith | ( | const std::string & | s | ) | const | 
Find the vertices which contain a given semantic attribute.
| s | semantic attribute to look for | 
| 
 | inline | 
| bool Graph::hasEdge | ( | const Edge * | edge | ) | const | 
Does the graph contain a particular edge?
| edge | pointer to the edge to check | 
| bool Graph::hasVertex | ( | const Vertex * | vertex | ) | const | 
Does the graph contain a given vertex?
| vertex | pointer to the vertex to check | 
| 
 | virtual | 
Does the graph contain only directed edges?
| 
 | virtual | 
Does the graph contain only undirected edges?
| size_t Graph::order | ( | ) | const | 
The order of a graph is the number of its vertices.
| Vertex* Graph::randomVertex | ( | ) | const | 
Return a random vertex (CAUTION: not perfectly random!)
| 
 | inline | 
| 
 | inline | 
| void Graph::removeEdge | ( | Edge * | edge | ) | 
Delete and remove an edge from the graph.
The pointer becomes invalid and should not be used afterwards.
| edge | pointer to the edge to remove | 
| range_error | if edgeis not in the graph | 
| void Graph::removeVertex | ( | Vertex * | vertex | ) | 
Delete and remove a vertex from the graph.
The pointer becomes invalid and should not be used afterwards.
| vertex | pointer to the vertex to remove | 
| range_error | if vertex is not in the graph | 
| 
 | inline | 
| 
 | inline | 
Get the end of the reversed vertex collection of the graph.
Definition at line 615 of file graph.h.
References DECLARE_GENERIC_OBJECT_TYPE.
| size_t Graph::size | ( | ) | const | 
In a future release, size() will return the number properties as it does in GenericObject}
| size_t Graph::size | ( | ) | 
| 
 | inline | 
| 
 | protected |