ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
MatrixGraph.h File Reference

The GRAPH with an adjacency matrix of section 9.3 [see Graph.h]: the weight of \( ( u , v ) \), or nothing, the infinity of the book, in place \( ( u , v ) \); \( \Theta( n^2 ) \) space, hasEdge() in \( O( 1 ) \), adj( u ) in \( \Theta( n ) \), insertNode() and deleteNode() in \( \Theta( n ) \). More...

#include "ADS/Contract.h"
#include "ADS/Iterators.h"
#include "ADS/graph/Graph.h"
#include <cstddef>
#include <optional>
#include <ranges>
#include <variant>
#include <vector>
#include "ADS/graph/impl/MatrixGraph.tpp"

Go to the source code of this file.

Classes

class  ADS::MatrixGraph< W, T >
 a graph with an adjacency matrix More...
struct  ADS::MatrixGraph< W, T >::Present
 the columns of the edges in a row, for SlotIterator More...

Namespaces

namespace  ADS

Detailed description

The GRAPH with an adjacency matrix of section 9.3 [see Graph.h]: the weight of \( ( u , v ) \), or nothing, the infinity of the book, in place \( ( u , v ) \); \( \Theta( n^2 ) \) space, hasEdge() in \( O( 1 ) \), adj( u ) in \( \Theta( n ) \), insertNode() and deleteNode() in \( \Theta( n ) \).

The contracts [see Contract.h]: insertEdge() and deleteEdge() need two distinct nodes, deleteNode(), adj(), forEachAdj() and forEachEdge() a node; the invariant is that the matrix is n x n with no entry on the diagonal nor in the rows and columns of the names not in use, m() entries in all, and symmetric for an unoriented graph. The operations check it on the rows and the columns they touch, in \( O( n ) \). The operations are defined in MatrixGraph.tpp.

See also
A. Montresor, Algoritmi e Strutture Dati, 2025, section 9.3, https://algoritmicamente.it/materiali/libro/capitoli/cap09.pdf
P. Morin, Open Data Structures (in C++), Edition 0.1G, 2013, https://opendatastructures.org/ods-cpp.pdf, section 12.1
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa