Graph Representation in Memory
Jump to navigation
Jump to search
Internal
TODO CLRS page 589, DDIA location 1392.
Adjacency Lists
Applies to directed and undirected graphs.
An adjacency list representation provides a memory-efficient way of representing sparse graphs, so it is usually the method of choice.
Continue CLRS page 590.
Adjacency Matrices
Applies to directed and undirected graphs.
Cases when adjacency matrix representation is preferred:
- dense graphs.
- When we need to tell quickly if there is an edge connecting two given vertices.
Continue CLRS page 590.