Comparison of Graph Representations
Learn how adjacency matrices and adjacency lists compare.
We'll cover the following...
After studying both adjacency matrices and adjacency lists, let’s see how they compare for common operations that we’ll perform in graph algorithms.
In most applications of graph algorithms, the set of nodes is constant. No nodes are added or removed over time. We can therefore focus on operations that work on the edge set .
Memory usage
The adjacency matrix stores at least one bit for every ordered pair of nodes . Since there are exactly such pairs, the memory footprint is ...