|
ADS
Algorithms and Data Structures
|
The oriented graph on its matrix of incidence, exercise 12.2 of Morin's book, beyond the book: the \( n \times m \) matrix \( A \) with \( A_{i,j} = -1 \) if the node \( i \) is the source of the edge \( j \), \( +1 \) if it is its target, and 0 otherwise, a GRAPH [see Graph.h] whose nodes are \( 0 , \ldots , n - 1 \), on which the visits of Visit.h run as on the others. More...
#include "ADS/Contract.h"#include <algorithm>#include <cstddef>#include <cstdint>#include <vector>#include "ADS/graph/impl/IncidenceGraph.tpp"Go to the source code of this file.
Classes | |
| class | ADS::IncidenceGraph |
| an oriented graph on its matrix of incidence, kept by columns More... | |
Namespaces | |
| namespace | ADS |
The oriented graph on its matrix of incidence, exercise 12.2 of Morin's book, beyond the book: the \( n \times m \) matrix \( A \) with \( A_{i,j} = -1 \) if the node \( i \) is the source of the edge \( j \), \( +1 \) if it is its target, and 0 otherwise, a GRAPH [see Graph.h] whose nodes are \( 0 , \ldots , n - 1 \), on which the visits of Visit.h run as on the others.
The matrix is kept by columns, one column of \( n \) bytes per edge, so that the space is \( n m \) bytes, \( \Theta( n m ) \), more than the \( \Theta( n^2 ) \) of the adjacency matrix as soon as \( m > n \), and the costs of the operations of Morin's interface are
so that no operation is faster than on the adjacency matrix or on the lists, and the matrix of incidence is a representation for the algebra of the graph (its rank, its cycles and cuts, the flows as the solutions of \( A x = b \) [see incidence() in Graph.h]), not for its visits. A loop has no column (its \( -1 \) and \( +1 \) would be in the same place), and two parallel edges have two equal columns.
The contracts [see Contract.h]: the nodes are in \( [ 0 , n ) \), an edge joins two distinct nodes; the invariant (one \( -1 \) and one \( +1 \) per column) is checked on the columns that an operation writes. The operations are defined in IncidenceGraph.tpp.