andres::graph
|
Directed graph, implemented as an adjacency list. More...
#include <digraph.hxx>
Classes | |
struct | Vertex |
Public Types | |
typedef VISITOR | Visitor |
typedef detail::VertexIterator | VertexIterator |
typedef detail::EdgeIterator | EdgeIterator |
typedef detail::Adjacencies::const_iterator | AdjacencyIterator |
typedef AdjacencyIterator::value_type | AdjacencyType |
Public Member Functions | |
Digraph (const Visitor &=Visitor()) | |
Construct a directed graph. | |
Digraph (const std::size_t, const Visitor &=Visitor()) | |
Construct a directed graph with an initial number of vertices. | |
void | assign (const Visitor &=Visitor()) |
Clear a directed graph. | |
void | assign (const std::size_t, const Visitor &=Visitor()) |
Clear a directed graph with an initial number of vertices. | |
void | reserveVertices (const std::size_t) |
Reserve memory for at least the given total number of vertices. | |
void | reserveEdges (const std::size_t) |
Reserve memory for at least the given total number of edges. | |
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. | |
const AdjacencyType & | adjacencyFromVertex (const std::size_t, const std::size_t) const |
Get the j-th adjacency from a vertex. | |
const 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 logarithmic time). | |
bool | multipleEdgesEnabled () const |
Indicate if multiple edges are enabled. | |
std::size_t | insertVertex () |
Insert an additional vertex. | |
std::size_t | insertVertices (const std::size_t) |
Insert additional vertices. | |
std::size_t | insertEdge (const std::size_t, const std::size_t) |
Insert an additional edge. | |
void | eraseVertex (const std::size_t) |
Erase a vertex and all edges connecting this vertex. | |
void | eraseEdge (const std::size_t) |
Erase an edge. | |
bool & | multipleEdgesEnabled () |
Indicate if multiple edges are enabled. |
Directed graph, implemented as an adjacency list.
Definition at line 24 of file digraph.hxx.
typedef detail::Adjacencies::const_iterator andres::graph::Digraph< VISITOR >::AdjacencyIterator |
Definition at line 29 of file digraph.hxx.
typedef AdjacencyIterator::value_type andres::graph::Digraph< VISITOR >::AdjacencyType |
Definition at line 31 of file digraph.hxx.
typedef detail::EdgeIterator andres::graph::Digraph< VISITOR >::EdgeIterator |
Definition at line 28 of file digraph.hxx.
typedef detail::VertexIterator andres::graph::Digraph< VISITOR >::VertexIterator |
Definition at line 27 of file digraph.hxx.
typedef VISITOR andres::graph::Digraph< VISITOR >::Visitor |
Definition at line 26 of file digraph.hxx.
|
inline |
Construct a directed graph.
visitor | Visitor to follow changes of integer indices of vertices and edges. |
Definition at line 106 of file digraph.hxx.
|
inline |
Construct a directed graph with an initial number of vertices.
numberOfVertices | Number of vertices. |
visitor | Visitor to follow changes of integer indices of vertices and edges. |
Definition at line 122 of file digraph.hxx.
|
inline |
Get an iterator to the beginning of the sequence of adjacencies that originate from a given vertex.
vertex | Integer index of the vertex. |
Definition at line 581 of file digraph.hxx.
|
inline |
Get an iterator to the end of the sequence of adjacencies that originate from a given vertex.
vertex | Integer index of the vertex. |
Definition at line 596 of file digraph.hxx.
|
inline |
Get an iterator to the beginning of the sequence of adjacencies incident to a given vertex.
vertex | Integer index of the vertex. |
Definition at line 611 of file digraph.hxx.
|
inline |
Get an iterator to the end of the sequence of adjacencies incident to a given vertex.
vertex | Integer index of the vertex. |
Definition at line 626 of file digraph.hxx.
|
inline |
Get the j-th adjacency from a vertex.
vertex | Vertex. |
j | Number of the adjacency. |
Definition at line 663 of file digraph.hxx.
|
inline |
Get the j-th adjacency to a vertex.
vertex | Vertex. |
j | Number of the adjacency. |
Definition at line 677 of file digraph.hxx.
|
inline |
Clear a directed graph.
visitor | Visitor to follow changes of integer indices of vertices and edges. |
Definition at line 140 of file digraph.hxx.
|
inline |
Clear a directed graph with an initial number of vertices.
numberOfVertices | Number of vertices. |
visitor | Visitor to follow changes of integer indices of vertices and edges. |
Definition at line 156 of file digraph.hxx.
|
inline |
Get the integer index of an edge that originates from a given vertex.
vertex | Integer index of a vertex. |
j | Number of the edge; between 0 and numberOfEdgesFromVertex(vertex) - 1. |
Definition at line 237 of file digraph.hxx.
|
inline |
Get an iterator to the beginning of the sequence of edges that originate from a given vertex.
vertex | Integer index of the vertex. |
Definition at line 521 of file digraph.hxx.
|
inline |
Get an iterator to the end of the sequence of edges that originate from a given vertex.
vertex | Integer index of the vertex. |
Definition at line 536 of file digraph.hxx.
|
inline |
Get an iterator to the beginning of the sequence of edges that are incident to a given vertex.
vertex | Integer index of the vertex. |
Definition at line 551 of file digraph.hxx.
|
inline |
Get an iterator to the end of the sequence of edges that are incident to a given vertex.
vertex | Integer index of the vertex. |
Definition at line 566 of file digraph.hxx.
|
inline |
Get the integer index of an edge that is incident to a given vertex.
vertex | Integer index of a vertex. |
j | Number of the edge; between 0 and numberOfEdgesFromVertex(vertex) - 1. |
Definition at line 253 of file digraph.hxx.
|
inline |
Erase an edge.
edgeIndex | Integer index of the edge to be erased. |
Definition at line 431 of file digraph.hxx.
void andres::graph::Digraph< VISITOR >::eraseVertex | ( | const std::size_t | vertexIndex | ) |
Erase a vertex and all edges connecting this vertex.
vertexIndex | Integer index of the vertex to be erased. |
Definition at line 364 of file digraph.hxx.
|
inline |
Search for an edge (in logarithmic time).
vertex0 | first vertex of the edge. |
vertex1 | second vertex of the edge. |
Definition at line 694 of file digraph.hxx.
|
inline |
Insert an additional edge.
vertexIndex0 | Integer index of the first vertex (source) of the edge. |
vertexIndex1 | Integer index of the second vertex (target) of the edge. |
Definition at line 332 of file digraph.hxx.
|
inline |
Insert an additional vertex.
Definition at line 300 of file digraph.hxx.
|
inline |
Insert additional vertices.
number | Number of new vertices to be inserted. |
Definition at line 315 of file digraph.hxx.
|
inline |
Indicate if multiple edges are enabled.
Definition at line 722 of file digraph.hxx.
|
inline |
Indicate if multiple edges are enabled.
Enable multiple edges like this: graph.multipleEdgesEnabled() = true;
Definition at line 734 of file digraph.hxx.
|
inline |
Get the number of edges.
Definition at line 180 of file digraph.hxx.
|
inline |
Get the number of edges that originate from a given vertex.
vertex | Integer index of a vertex. |
Definition at line 192 of file digraph.hxx.
|
inline |
Get the number of edges that are incident to a given vertex.
vertex | Integer index of a vertex. |
Definition at line 206 of file digraph.hxx.
|
inline |
Get the number of vertices.
Definition at line 172 of file digraph.hxx.
|
inline |
Reserve memory for at least the given total number of edges.
number | Total number of edges. |
Definition at line 650 of file digraph.hxx.
|
inline |
Reserve memory for at least the given total number of vertices.
number | Total number of vertices. |
Definition at line 638 of file digraph.hxx.
|
inline |
Get the integer index of a vertex reachable from a given vertex via a single edge.
vertex | Integer index of a vertex. |
j | Number of the vertex; between 0 and numberOfEdgesFromVertex(vertex) - 1. |
Definition at line 269 of file digraph.hxx.
|
inline |
Get the integer index of a vertex of an edge.
edge | Integer index of an edge. |
j | Number of the vertex in the edge; either 0 or 1. |
Definition at line 219 of file digraph.hxx.
|
inline |
Get the integer index of a vertex from which a given vertex is reachable via a single edge.
vertex | Integer index of a vertex. |
j | Number of the vertex; between 0 and numberOfEdgesFromVertex(vertex) - 1. |
Definition at line 285 of file digraph.hxx.
|
inline |
Get an iterator to the beginning of the sequence of vertices reachable from a given vertex via a single edge.
vertex | Integer index of the vertex. |
Definition at line 461 of file digraph.hxx.
|
inline |
Get an iterator to the end of the sequence of vertices reachable from a given vertex via a single edge.
vertex | Integer index of the vertex. |
Definition at line 476 of file digraph.hxx.
|
inline |
Get an iterator to the beginning of the sequence of vertices from which a given vertex is reachable via a single edge.
vertex | Integer index of the vertex. |
Definition at line 491 of file digraph.hxx.
|
inline |
Get an iterator to the end of the sequence of vertices from which a given vertex is reachable via a single edge.
vertex | Integer index of the vertex. |
Definition at line 506 of file digraph.hxx.