|
ADS
Algorithms and Data Structures
|
The step from a graph built one edge at a time to the static GRAPHs in compressed rows, beyond the book [see StaticGraph.h and ArrayGraph.h]: a GraphBuilder collects the nodes and the weighted edges as they come, with no row to keep, and freezes them into a StaticGraph or an ArrayGraph in \( \Theta( n + a ) \) time, \( a \) the number of arcs, by the counting sort by tail of their constructors. More...
#include "ADS/Contract.h"#include "ADS/graph/ArrayGraph.h"#include "ADS/graph/StaticGraph.h"#include <cstddef>#include <tuple>#include <variant>#include <vector>#include "ADS/graph/impl/GraphBuilder.tpp"Go to the source code of this file.
Classes | |
| class | ADS::GraphBuilder< W > |
| the nodes and the edges of a graph collected one at a time, then frozen into a StaticGraph or an ArrayGraph More... | |
Namespaces | |
| namespace | ADS |
The step from a graph built one edge at a time to the static GRAPHs in compressed rows, beyond the book [see StaticGraph.h and ArrayGraph.h]: a GraphBuilder collects the nodes and the weighted edges as they come, with no row to keep, and freezes them into a StaticGraph or an ArrayGraph in \( \Theta( n + a ) \) time, \( a \) the number of arcs, by the counting sort by tail of their constructors.
The two forms keep a different order of the arcs of a node: ArrayGraph the order in which the edges were added (its counting sort by tail is stable, and an unoriented edge \( [ u , v ] \) puts \( v \) in the row of \( u \) and \( u \) in that of \( v \) at its place in the input), while StaticGraph sorts each row by head, the invariant on which its visits and its search of an arc rest. The builder adds nothing that the constructors from a list of edges do not already do but the growing of the nodes and the checks at each insertion, where the error is made: a graph whose number of nodes is known and whose edges are already in a vector goes to the constructors directly.
The contracts [see Contract.h]: the builder has n >= 0 nodes, and an edge joins two distinct nodes of it (no loop, as in every GRAPH of the library); parallel edges are kept. The operations are defined in GraphBuilder.tpp.