Template Class ArrayGraph
Defined in File ArrayGraph.h
Class Documentation
-
template<class W = std::monostate>
class ArrayGraph a static graph with vectors of adjacency, all in one vector
Public Functions
-
ArrayGraph(int n, const std::vector<std::tuple<int, int, W>> &E, bool directed = true)
the graph of the nodes 0 , … , n - 1 and of the given edges; an unoriented edge [ u , v ] is given once
- Pre:
n >= 0, and each edge joins two distinct nodes
-
template<Graph G>
explicit ArrayGraph(const G &g) the copy of any graph, with the nodes 0 , … , g.bound() - 1: the names that are not nodes of g, deleted ones, become isolated nodes, so that each node keeps its name
-
inline bool directed(void) const
-
inline int n(void) const
-
inline int m(void) const
-
inline int bound(void) const
-
bool hasNode(int u) const
-
std::vector<int> V(void) const
-
std::vector<int> adj(int u) const
- Pre:
u is a node
-
inline auto nodes(void) const
the nodes, 0 , … , n - 1, random access
-
std::span<const int> neighbors(int u) const
the nodes adjacent to u, contiguous in the array of the edges
- Pre:
u is a node
-
ArrayGraph(int n, const std::vector<std::tuple<int, int, W>> &E, bool directed = true)