andres::graph
Public Types | Public Member Functions | List of all members
andres::graph::CompleteGraph< VISITOR > Class Template Reference

Complete graph. More...

#include <complete-graph.hxx>

Public Types

typedef VISITOR Visitor
typedef Adjacency AdjacencyType

Public Member Functions

 CompleteGraph (const Visitor &=Visitor())
 Construct a complete graph.
 CompleteGraph (const std::size_t, const Visitor &=Visitor())
 Construct a complete graph with an initial number of vertices.
void assign (const Visitor &=Visitor())
 Clear a complete graph.
void assign (const std::size_t, const Visitor &=Visitor())
 Clear a complete graph with an initial number of vertices.
VertexIterator verticesFromVertexBegin (const std::size_t) const
 Get an iterator to the beginning of the sequence of vertices reachable from a given vertex via a single edge.
VertexIterator verticesFromVertexEnd (const std::size_t) const
 Get an iterator to the end of the sequence of vertices reachable from a given vertex via a single edge.
VertexIterator verticesToVertexBegin (const std::size_t) const
 Get an iterator to the beginning of the sequence of vertices from which a given vertex is reachable via a single edge.
VertexIterator verticesToVertexEnd (const std::size_t) const
 Get an iterator to the end of the sequence of vertices from which a given vertex is reachable via a single edge.
EdgeIterator edgesFromVertexBegin (const std::size_t) const
 Get an iterator to the beginning of the sequence of edges that originate from a given vertex.
EdgeIterator edgesFromVertexEnd (const std::size_t) const
 Get an iterator to the end of the sequence of edges that originate from a given vertex.
EdgeIterator edgesToVertexBegin (const std::size_t) const
 Get an iterator to the beginning of the sequence of edges that are incident to a given vertex.
EdgeIterator edgesToVertexEnd (const std::size_t) const
 Get an iterator to the end of the sequence of edges that are incident to a given vertex.
AdjacencyIterator adjacenciesFromVertexBegin (const std::size_t) const
 Get an iterator to the beginning of the sequence of adjacencies that originate from a given vertex.
AdjacencyIterator adjacenciesFromVertexEnd (const std::size_t) const
 Get an iterator to the end of the sequence of adjacencies that originate from a given vertex.
AdjacencyIterator adjacenciesToVertexBegin (const std::size_t) const
 Get an iterator to the beginning of the sequence of adjacencies incident to a given vertex.
AdjacencyIterator adjacenciesToVertexEnd (const std::size_t) const
 Get an iterator to the end of the sequence of adjacencies incident to a given vertex.
std::size_t numberOfVertices () const
 Get the number of vertices.
std::size_t numberOfEdges () const
 Get the number of edges.
std::size_t numberOfEdgesFromVertex (const std::size_t) const
 Get the number of edges that originate from a given vertex.
std::size_t numberOfEdgesToVertex (const std::size_t) const
 Get the number of edges that are incident to a given vertex.
std::size_t vertexOfEdge (const std::size_t, const std::size_t) const
 Get the integer index of a vertex of an edge.
std::size_t edgeFromVertex (const std::size_t, const std::size_t) const
 Get the integer index of an edge that originates from a given vertex.
std::size_t edgeToVertex (const std::size_t, const std::size_t) const
 Get the integer index of an edge that is incident to a given vertex.
std::size_t vertexFromVertex (const std::size_t, const std::size_t) const
 Get the integer index of a vertex reachable from a given vertex via a single edge.
std::size_t vertexToVertex (const std::size_t, const std::size_t) const
 Get the integer index of a vertex from which a given vertex is reachable via a single edge.
AdjacencyType adjacencyFromVertex (const std::size_t, const std::size_t) const
 Get the j-th adjacency from a vertex.
AdjacencyType adjacencyToVertex (const std::size_t, const std::size_t) const
 Get the j-th adjacency to a vertex.
std::pair< bool, std::size_t > findEdge (const std::size_t, const std::size_t) const
 Search for an edge (in constant time).
bool multipleEdgesEnabled () const
 Indicate if multiple edges are enabled.

Detailed Description

template<typename VISITOR = IdleGraphVisitor<std::size_t>>
class andres::graph::CompleteGraph< VISITOR >

Complete graph.

Definition at line 18 of file complete-graph.hxx.

Member Typedef Documentation

template<typename VISITOR = IdleGraphVisitor<std::size_t>>
typedef Adjacency andres::graph::CompleteGraph< VISITOR >::AdjacencyType

Definition at line 21 of file complete-graph.hxx.

template<typename VISITOR = IdleGraphVisitor<std::size_t>>
typedef VISITOR andres::graph::CompleteGraph< VISITOR >::Visitor

Definition at line 20 of file complete-graph.hxx.

Constructor & Destructor Documentation

template<typename VISITOR >
andres::graph::CompleteGraph< VISITOR >::CompleteGraph ( const Visitor visitor = Visitor())
inline

Construct a complete graph.

Parameters
visitorVisitor to follow changes of integer indices of vertices and edges.

Definition at line 176 of file complete-graph.hxx.

template<typename VISITOR >
andres::graph::CompleteGraph< VISITOR >::CompleteGraph ( const std::size_t  numberOfVertices,
const Visitor visitor = Visitor() 
)
inline

Construct a complete graph with an initial number of vertices.

Parameters
numberOfVerticesNumber of vertices.
visitorVisitor to follow changes of integer indices of vertices and edges.

Definition at line 190 of file complete-graph.hxx.

Member Function Documentation

template<typename VISITOR >
CompleteGraph< VISITOR >::AdjacencyIterator andres::graph::CompleteGraph< VISITOR >::adjacenciesFromVertexBegin ( const std::size_t  vertex) const
inline

Get an iterator to the beginning of the sequence of adjacencies that originate from a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
AdjacencyIterator.
See Also
adjacenciesFromVertexEnd()

Definition at line 355 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::AdjacencyIterator andres::graph::CompleteGraph< VISITOR >::adjacenciesFromVertexEnd ( const std::size_t  vertex) const
inline

Get an iterator to the end of the sequence of adjacencies that originate from a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
AdjacencyIterator.
See Also
adjacenciesFromVertexBegin()

Definition at line 370 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::AdjacencyIterator andres::graph::CompleteGraph< VISITOR >::adjacenciesToVertexBegin ( const std::size_t  vertex) const
inline

Get an iterator to the beginning of the sequence of adjacencies incident to a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
AdjacencyIterator.
See Also
adjacenciesToVertexEnd()

Definition at line 385 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::AdjacencyIterator andres::graph::CompleteGraph< VISITOR >::adjacenciesToVertexEnd ( const std::size_t  vertex) const
inline

Get an iterator to the end of the sequence of adjacencies incident to a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
AdjacencyIterator.
See Also
adjacenciesToVertexBegin()

Definition at line 400 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::AdjacencyType andres::graph::CompleteGraph< VISITOR >::adjacencyFromVertex ( const std::size_t  vertex,
const std::size_t  j 
) const
inline

Get the j-th adjacency from a vertex.

Parameters
vertexVertex.
jNumber of the adjacency.

Definition at line 565 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::AdjacencyType andres::graph::CompleteGraph< VISITOR >::adjacencyToVertex ( const std::size_t  vertex,
const std::size_t  j 
) const
inline

Get the j-th adjacency to a vertex.

Parameters
vertexVertex.
jNumber of the adjacency.

Definition at line 589 of file complete-graph.hxx.

template<typename VISITOR >
void andres::graph::CompleteGraph< VISITOR >::assign ( const Visitor visitor = Visitor())
inline

Clear a complete graph.

Parameters
visitorVisitor to follow changes of integer indices of vertices and edges.

Definition at line 204 of file complete-graph.hxx.

template<typename VISITOR >
void andres::graph::CompleteGraph< VISITOR >::assign ( const std::size_t  numberOfVertices,
const Visitor visitor = Visitor() 
)
inline

Clear a complete graph with an initial number of vertices.

Parameters
numberOfVerticesNumber of vertices.
visitorVisitor to follow changes of integer indices of vertices and edges.

Definition at line 218 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::edgeFromVertex ( const std::size_t  vertex,
const std::size_t  j 
) const
inline

Get the integer index of an edge that originates from a given vertex.

Parameters
vertexInteger index of a vertex.
jNumber of the edge; between 0 and numberOfEdgesFromVertex(vertex) - 1.
See Also
numberOfEdgesFromVertex()

Definition at line 485 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::EdgeIterator andres::graph::CompleteGraph< VISITOR >::edgesFromVertexBegin ( const std::size_t  vertex) const
inline

Get an iterator to the beginning of the sequence of edges that originate from a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
EdgeIterator.
See Also
edgesFromVertexEnd()

Definition at line 295 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::EdgeIterator andres::graph::CompleteGraph< VISITOR >::edgesFromVertexEnd ( const std::size_t  vertex) const
inline

Get an iterator to the end of the sequence of edges that originate from a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
EdgeIterator.
See Also
edgesFromVertexBegin()

Definition at line 310 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::EdgeIterator andres::graph::CompleteGraph< VISITOR >::edgesToVertexBegin ( const std::size_t  vertex) const
inline

Get an iterator to the beginning of the sequence of edges that are incident to a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
EdgeIterator.
See Also
edgesToVertexEnd()

Definition at line 325 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::EdgeIterator andres::graph::CompleteGraph< VISITOR >::edgesToVertexEnd ( const std::size_t  vertex) const
inline

Get an iterator to the end of the sequence of edges that are incident to a given vertex.

Parameters
vertexInteger index of the vertex.
Returns
EdgeIterator.
See Also
edgesToVertexBegin()

Definition at line 340 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::edgeToVertex ( const std::size_t  vertex,
const std::size_t  j 
) const
inline

Get the integer index of an edge that is incident to a given vertex.

Parameters
vertexInteger index of a vertex.
jNumber of the edge; between 0 and numberOfEdgesFromVertex(vertex) - 1.
See Also
numberOfEdgesToVertex()

Definition at line 511 of file complete-graph.hxx.

template<typename VISITOR >
std::pair< bool, std::size_t > andres::graph::CompleteGraph< VISITOR >::findEdge ( const std::size_t  vertex0,
const std::size_t  vertex1 
) const
inline

Search for an edge (in constant time).

Indexing: findEdge(vertex0, vertex1)

  • 0 1 2 0 - 3 4 1 3 - 5 2 4 5 -
Parameters
vertex0first vertex of the edge.
vertex1second vertex of the edge.
Returns
if an edge from vertex0 to vertex1 exists, pair.first is true and pair.second is the index of such an edge. if no edge from vertex0 to vertex1 exists, pair.first is false and pair.second is undefined.

Definition at line 612 of file complete-graph.hxx.

template<typename VISITOR >
bool andres::graph::CompleteGraph< VISITOR >::multipleEdgesEnabled ( ) const
inline

Indicate if multiple edges are enabled.

Returns
false

Definition at line 635 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::numberOfEdges ( ) const
inline

Get the number of edges.

Definition at line 418 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::numberOfEdgesFromVertex ( const std::size_t  vertex) const
inline

Get the number of edges that originate from a given vertex.

Parameters
vertexInteger index of a vertex.
See Also
edgeFromVertex()

Definition at line 430 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::numberOfEdgesToVertex ( const std::size_t  vertex) const
inline

Get the number of edges that are incident to a given vertex.

Parameters
vertexInteger index of a vertex.
See Also
edgeToVertex()

Definition at line 445 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::numberOfVertices ( ) const
inline

Get the number of vertices.

Definition at line 410 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::vertexFromVertex ( const std::size_t  vertex,
const std::size_t  j 
) const
inline

Get the integer index of a vertex reachable from a given vertex via a single edge.

Parameters
vertexInteger index of a vertex.
jNumber of the vertex; between 0 and numberOfEdgesFromVertex(vertex) - 1.
See Also
numberOfEdgesFromVertex()

Definition at line 528 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::vertexOfEdge ( const std::size_t  edge,
const std::size_t  j 
) const
inline

Get the integer index of a vertex of an edge.

Parameters
edgeInteger index of an edge.
jNumber of the vertex in the edge; either 0 or 1.

Definition at line 459 of file complete-graph.hxx.

template<typename VISITOR >
std::size_t andres::graph::CompleteGraph< VISITOR >::vertexToVertex ( const std::size_t  vertex,
const std::size_t  j 
) const
inline

Get the integer index of a vertex from which a given vertex is reachable via a single edge.

Parameters
vertexInteger index of a vertex.
jNumber of the vertex; between 0 and numberOfEdgesFromVertex(vertex) - 1.
See Also
numberOfEdgesFromVertex()

Definition at line 550 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::VertexIterator andres::graph::CompleteGraph< VISITOR >::verticesFromVertexBegin ( const std::size_t  vertex) const
inline

Get an iterator to the beginning of the sequence of vertices reachable from a given vertex via a single edge.

Parameters
vertexInteger index of the vertex.
Returns
VertexIterator.
See Also
verticesFromVertexEnd()

Definition at line 235 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::VertexIterator andres::graph::CompleteGraph< VISITOR >::verticesFromVertexEnd ( const std::size_t  vertex) const
inline

Get an iterator to the end of the sequence of vertices reachable from a given vertex via a single edge.

Parameters
vertexInteger index of the vertex.
Returns
VertexIterator.
See Also
verticesFromVertexBegin()

Definition at line 250 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::VertexIterator andres::graph::CompleteGraph< VISITOR >::verticesToVertexBegin ( const std::size_t  vertex) const
inline

Get an iterator to the beginning of the sequence of vertices from which a given vertex is reachable via a single edge.

Parameters
vertexInteger index of the vertex.
Returns
VertexIterator.
See Also
verticesToVertexEnd()

Definition at line 265 of file complete-graph.hxx.

template<typename VISITOR >
CompleteGraph< VISITOR >::VertexIterator andres::graph::CompleteGraph< VISITOR >::verticesToVertexEnd ( const std::size_t  vertex) const
inline

Get an iterator to the end of the sequence of vertices from which a given vertex is reachable via a single edge.

Parameters
vertexInteger index of the vertex.
Returns
VertexIterator.
See Also
verticesToVertexBegin()

Definition at line 280 of file complete-graph.hxx.