Q9Data Structures
Question
2 marks
Determine advantages and disadvantages of adjacent matrix representation for graphs.
Answer
Adjacency matrices provide instantaneous edge lookups but suffer from extreme memory waste for sparse graphs.
An Adjacency Matrix offers the supreme advantage of instantaneous time complexity for determining if an edge exists between any two specific vertices. However, its primary, often fatal disadvantage is its extreme memory space consumption, which leads to massive memory waste (storing mostly zeroes) when structurally representing highly sparse graphs with very few connecting edges.