Adjacency list vs matrix
easyA matrix costs V² whatever the edge count. For a social graph with a million users and fifty friends each, lists win by four orders of magnitude - and nearly every algorithm here wants a list.
Best
O(1) matrix edge testWorst O(V) matrix neighboursSpace O(V²) matrix, O(V + E) listLoading the adjacency list vs matrix engine…