|
ADS
Algorithms and Data Structures
|
The GRAPH of chapter 9 and its realizations. More...
Files | |
| file | ADS/graph/Graph.h |
| The GRAPH of chapter 9 and its realizations. | |
Concepts | |
| concept | ADS::Graph |
| GRAPH (section 9.2), as far as the visits need it: the nodes, the adjacent nodes of a node, the range \( [ 0 , \mathrm{bound}() ) \) of the names. | |
| concept | ADS::DynamicGraph |
| a GRAPH with the insertions and the deletions of its specification | |
Classes | |
| class | ADS::GraphNodes< T > |
| the nodes, their labels and the counts shared by the realizations More... | |
Functions | |
| template<Graph G> | |
| std::vector< std::vector< int > > | ADS::incidence (const G &g) |
| the matrix of incidence nodes-edges, the edges in the order of V() and of adj(), an unoriented one when met from its smaller end | |
| std::vector< int > | ADS::adjFromIncidence (const std::vector< std::vector< int > > &B, int u, bool directed) |
| the adjacent nodes of \( u \) from the matrix of incidence \( B \) of a graph, oriented or not, in the order of the columns | |
The GRAPH of chapter 9 and its realizations.
The definitions, the invariants and the costs of the area are in Theory of graphs.
|
inline |
the adjacent nodes of \( u \) from the matrix of incidence \( B \) of a graph, oriented or not, in the order of the columns
In pseudocode (section 9.3):
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{adjFromIncidence}( B , u ) \cr 2 & \quad A \gets ()\quad \triangleright\ \text{the edges that leave } u \text{ have } -1 \text{ in its row, } 1 \text{ if unoriented} \cr 3 & \quad \textbf{foreach}\ \text{column } k \text{ of such an edge} \ \textbf{do}\ \text{append to } A \text{ the row } v \ne u \text{ with } B[ v ][ k ] \ne 0 \cr 4 & \quad \textbf{return}\ A \end{array}} \]
| std::vector< std::vector< int > > ADS::incidence | ( | const G & | g | ) |
the matrix of incidence nodes-edges, the edges in the order of V() and of adj(), an unoriented one when met from its smaller end
In pseudocode (section 9.3):
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{incidence}( G )\quad \triangleright \ \text{a column for each edge} \cr 2 & \quad B \gets \text{an } n \times m \text{ matrix of zeros};\ k \gets 0 \cr 3 & \quad \textbf{foreach}\ \text{edge } ( u , v ) \text{, each unoriented one once with } u < v\ \textbf{do} \cr 4 & \qquad ( B[ u ][ k ] , B[ v ][ k ] ) \gets ( -1 , +1 ) \text{ if } G \text{ is oriented, else } ( 1 , 1 );\ k \gets k + 1 \cr 5 & \quad \textbf{return}\ B \end{array}} \]