Template Class MatrixGraph
Defined in File MatrixGraph.h
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public ADS::GraphNodes< std::monostate >(Template Class GraphNodes)
Class Documentation
-
template<class W = std::monostate, class T = std::monostate>
class MatrixGraph : public ADS::GraphNodes<std::monostate> a graph with an adjacency matrix
Public Functions
-
explicit MatrixGraph(int n = 0, bool directed = true)
Graph(): the graph of the nodes 0 , … , n - 1, with no edge.
- Pre:
n >= 0
-
void insertEdge(int u, int v, const W &w = W())
- Pre:
u and v are distinct nodes
- Post:
hasEdge( u , v )
-
void deleteEdge(int u, int v)
- Pre:
u and v are distinct nodes
- Post:
! hasEdge( u , v )
-
void deleteNode(int u)
removes the node u and its edges, Theta( n ) time
- Pre:
u is a node
- Post:
! hasNode( u )
-
bool hasEdge(int u, int v) const
O( 1 ) time.
-
std::optional<W> weight(int u, int v) const
the weight of ( u , v ), nothing (the infinity of the book) if there is no such edge
-
std::vector<int> adj(int u) const
the set of the nodes adjacent to u, in increasing order, Theta( n ) time
- Pre:
u is a node
-
inline auto neighbors(int u) const
the nodes adjacent to u in increasing order, bidirectional
- Pre:
u is a node
-
struct Present
the columns of the edges in a row, for SlotIterator
-
explicit MatrixGraph(int n = 0, bool directed = true)