Latest Tech News

Stay updated with the latest in technology, AI, cybersecurity, and more

Filtered by: numvertices Clear Filter

Adjacency Matrix and std:mdspan, C++23

In graph theory, an adjacency matrix is a square matrix used to represent a finite (and usually dense) graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not, and in weighted graphs, they store the edge weights. In many beginner-level tutorials, adjacency matrices are implemented using vector of vectors (nested dynamic arrays), but this approach has inefficiencies due to multiple memory allocations. C++23 introduces std::mdspan , which provides a more efficient