Generic Vertex.
More...
#include <rgenericvertex.h>
template<class V, class E>
class R::RGenericVertex< V, E >
Generic Vertex.
The RGenericVertex class provides a representation for a generic vertex.
- Template Parameters
-
V | Class representing a vertex. It must inherits from RVertex. |
E | Class representing an edge. It must inherits from REdge. |
Constructor of the vertex.
- Parameters
-
id | Identifier. |
nb | Supposed number of edges. |
Copy constructor.
- Parameters
-
Destruct the vertex. The corresponding pointers of the adjacent edges are set to 0.
Is used to compare two vertices. The function returns the same type of information than the strcmp function from the standard C library.
- Parameters
-
v | Vertex used for the comparison. |
int Compare |
( |
const size_t |
i | ) |
const |
Is used to compare a vertex and an identifier. The function returns the same type of information than the strcmp function from the standard C library.
- Parameters
-
i | Identifier used for the comparison. |
size_t GetId |
( |
void |
| ) |
const |
Get the identifier of the vertex.
Get a cursor over the edges of the graph.
size_t GetNbEdges |
( |
void |
| ) |
const |
Get the number of edges to which the vertex is connected.
- Returns
- the number of adjacent edges.
E* GetEdge |
( |
size_t |
id | ) |
const |
- Returns
- Pointer to the edge that connects the current node with a node given by the identifier. If no edge is found, the method returns 0.
- Note
- This methods supposes an undirected graph.
- Parameters
-
id | Identifier of the node. |
E* GetEdgeTo |
( |
size_t |
id | ) |
const |
- Returns
- Pointer to the edge that connects the current node to a node given by the identifier. If no edge is found, the method returns 0.
- Note
- This methods supposes an directed graph.
- Parameters
-
id | Identifier of the node. |
E* GetEdgeFrom |
( |
size_t |
id | ) |
const |
- Returns
- Pointer to the edge that connects a node given by the identifier to the current node. If no edge is found, the method returns 0.
- Note
- This methods supposes an directed graph.
- Parameters
-
id | Identifier of the node. |
void GetAdjacentVertices |
( |
RContainer< V, false, bOrder > & |
vertices, |
|
|
bool |
verify = false |
|
) |
| const |
Find all the adjacent vertices from the current one. In practice, it parses the edges and add the other vertex to the container.
- Parameters
-
vertices | Container that will hold the adjacent vertices. |
verify | Specify if the method should verify that that a given vertex is not stored twice. If true, it is better to pass an ordered container. |
- Template Parameters
-
bOrder | Specify if the vertices are ordered in the container. |
- Attention
- The container is not cleared by the method before vertices are added.
Identifier of the vertex.
All the edges connecting the given vertex.