Generic Vertex. More...

#include <rgenericvertex.h>

Inheritance diagram for RGenericVertex< V, E >:
[legend]
Collaboration diagram for RGenericVertex< V, E >:
[legend]

Public Member Functions

int Compare (const RGenericVertex &v) const
 
int Compare (const size_t i) const
 
template<bool bOrder>
void GetAdjacentVertices (RContainer< V, false, bOrder > &vertices, bool verify=false) const
 
E * GetEdge (size_t id) const
 
E * GetEdgeFrom (size_t id) const
 
RCursor< E > GetEdges (void) const
 
E * GetEdgeTo (size_t id) const
 
size_t GetId (void) const
 
size_t GetNbEdges (void) const
 
 RGenericVertex (size_t id, size_t nb=10)
 
 RGenericVertex (const RGenericVertex &v)
 
virtual ~RGenericVertex (void)
 

Protected Attributes

RContainer< E, false, false > Edges
 
size_t Id
 

Detailed Description

template<class V, class E>
class R::RGenericVertex< V, E >

Generic Vertex.

The RGenericVertex class provides a representation for a generic vertex.

Template Parameters
VClass representing a vertex. It must inherits from RVertex.
EClass representing an edge. It must inherits from REdge.

Constructor & Destructor Documentation

RGenericVertex ( size_t  id,
size_t  nb = 10 
)

Constructor of the vertex.

Parameters
idIdentifier.
nbSupposed number of edges.
RGenericVertex ( const RGenericVertex< V, E > &  v)

Copy constructor.

Parameters
vVertex used.
virtual ~RGenericVertex ( void  )
virtual

Destruct the vertex. The corresponding pointers of the adjacent edges are set to 0.

Member Function Documentation

int Compare ( const RGenericVertex< V, E > &  v) const

Is used to compare two vertices. The function returns the same type of information than the strcmp function from the standard C library.

Parameters
vVertex 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
iIdentifier used for the comparison.
size_t GetId ( void  ) const

Get the identifier of the vertex.

RCursor<E> GetEdges ( void  ) const

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
idIdentifier 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
idIdentifier 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
idIdentifier 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
verticesContainer that will hold the adjacent vertices.
verifySpecify 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
bOrderSpecify if the vertices are ordered in the container.
Attention
The container is not cleared by the method before vertices are added.

Member Data Documentation

size_t Id
protected

Identifier of the vertex.

RContainer<E,false,false> Edges
protected

All the edges connecting the given vertex.