Questions: Graph Representation: Matrices and Lists

3 questions to test your understanding

Score: 0 / 3
Question 1 Multiple Choice

A sparse graph has 1,000 vertices and 2,000 edges. Approximately how much memory does an adjacency matrix require compared to an adjacency list?

AAbout the same — both scale with edges
BThe adjacency list uses more memory because it stores pointers
CThe adjacency matrix uses about 333 times more memory
DThe adjacency matrix is always preferred because it supports O(1) lookup
Question 2 True / False

For an undirected graph, the adjacency matrix is always symmetric (A[i][j] = A[j][i] for all i, j).

TTrue
FFalse
Question 3 Short Answer

You compute A², where A is the adjacency matrix of a graph. What does the entry (A²)[i][j] count, and why?

Think about your answer, then reveal below.