42#ifndef __ADS_GraphBuilder
43 #define __ADS_GraphBuilder
72template<
class W = std::monostate >
81 using Edge = std::tuple< int , int , W >;
88 [[nodiscard]]
bool directed(
void )
const {
return( f_directed ); }
91 [[nodiscard]]
int n(
void )
const {
return( f_n ); }
94 [[nodiscard]]
int m(
void )
const {
return(
int( f_E.size() ) ); }
97 [[nodiscard]]
const std::vector< Edge > &
edges(
void )
const {
111 void addEdge(
int u ,
int v ,
const W & w = W() );
142 std::vector< Edge > f_E;
154#include "ADS/graph/impl/GraphBuilder.tpp"
The static GRAPH with vectors of adjacency of section 9.4 [see Graph.h]: the adjacent nodes of all th...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
A static GRAPH for the engineered algorithms, beyond the book [see Graph.h]: the compressed sparse ro...
a static graph with vectors of adjacency, all in one vector
Definition ArrayGraph.h:62
W Weight
the type of the weights
Definition GraphBuilder.h:78
GraphBuilder(int n=0, bool directed=true)
the builder of the nodes and of no edge
int addNode(void)
a new node, the next name
Definition GraphBuilder.h:105
int m(void) const
the number of edges, an unoriented one counted once
Definition GraphBuilder.h:94
int n(void) const
the number of nodes
Definition GraphBuilder.h:91
void reserve(std::size_t m)
room for edges, so that the next insertions do not move them
Definition GraphBuilder.h:102
void addEdge(int u, int v, const W &w=W())
the edge , or if unoriented, of weight , after those already there, even if parallel to one of them
bool directed(void) const
whether the graph is oriented
Definition GraphBuilder.h:88
const std::vector< Edge > & edges(void) const
the edges, in the order in which they were added
Definition GraphBuilder.h:97
ArrayGraph< W > toArrayGraph(void) const
the graph in compressed rows, each row in the order of insertion
std::tuple< int, int, W > Edge
an edge of weight
Definition GraphBuilder.h:81
StaticGraph< W > toStaticGraph(void) const
the graph in compressed rows, each row sorted by head
a static graph in compressed sparse rows, the arcs of each node sorted by head, their heads and their...
Definition StaticGraph.h:275