36#ifndef __ADS_ListGraph
37 #define __ADS_ListGraph
69template<
class W = std::monostate ,
class T = std::monostate >
132 [[nodiscard]]
bool hasEdge(
int u ,
int v )
const;
135 [[nodiscard]] std::optional< W >
weight(
int u ,
int v )
const;
139 [[nodiscard]] std::vector< int >
adj(
int u )
const;
158 [[nodiscard]] std::vector< int >
inAdj(
int u )
const;
178 const auto & L = f_adj[ this->
check( u ) ];
179 return( std::ranges::subrange( It( L.begin() ) , It( L.end() ) ) );
184 bool find(
int u ,
int v )
const;
186 bool set(
int u ,
int v ,
const W & w );
188 bool erase(
int u ,
int v );
192 [[nodiscard]]
bool consistent(
void )
const;
197 [[nodiscard]]
bool consistentAt(
int u ,
int v )
const;
199 std::vector< List< std::pair< int , W > > > f_adj;
211#include "ADS/graph/impl/ListGraph.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The iterators that the containers of the library have in common, beyond the book: they give a contain...
The LIST of the book: a SEQUENCE [see ADT.h] realized as a bidirectional circular list of cells with ...
GraphNodes(int n, bool directed)
int n(void) const
Definition Graph.h:126
bool directed(void) const
Definition Graph.h:123
the member first of what the iterator I reads, with the category of I up to bidirectional
Definition Iterators.h:793
std::optional< W > weight(int u, int v) const
the weight of , nothing if there is no such edge
W Weight
the type of the weights
Definition ListGraph.h:77
void insertEdge(int u, int v, const W &w=W())
the edge , or , of weight ; only the weight changes if it is there, time ( if unoriented) for the s...
T Label
the type of the labels
Definition ListGraph.h:78
std::vector< int > inAdj(int u) const
the nodes with an edge to , in increasing order, by a scan of all the lists, time (the inEdges( i ) ...
void forEachAdj(int u, F &&f) const
on the nodes adjacent to
void deleteNode(int u)
removes the node and its edges, time
void forEachEdge(int u, F &&f) const
on the nodes adjacent to and the weights of the edges
bool hasEdge(int u, int v) const
whether is an edge
auto neighbors(int u) const
the nodes adjacent to , in the order of its list, bidirectional
Definition ListGraph.h:175
ListGraph(int n=0, bool directed=true)
the graph of the nodes , with no edge
void deleteEdge(int u, int v)
removes the edge , or , if it is there
std::vector< int > adj(int u) const
the set of the nodes adjacent to , in the order of insertion
int insertNode(const T &t=T())
a new node, with no edge, and its name
The GRAPH of chapter 9 and its realizations.