5 questions to test your understanding
You are implementing BFS on a social network graph with 1 million users (V = 10⁶) and 10 million friendships (E = 10⁷). Which representation gives better BFS performance, and why?
What is the time complexity of checking whether a directed edge from vertex u to vertex v exists in an adjacency list representation?
In an undirected graph stored as an adjacency list, each edge (u, v) is represented twice — once in u's list and once in v's list — so the total storage for edges is 2E entries.
An adjacency matrix usually uses less memory than an adjacency list because it avoids the pointer overhead of linked lists.
Why does the choice between adjacency list and adjacency matrix affect the time complexity of BFS and DFS, not just memory usage?