What is the purpose of the adjacency matrix in graph representation?
A. To store the depth-first search order.
B. To list the neighbors of each vertex.
C. To store only the vertices of the graph.
D. To store the edges and their weights between all pairs of vertices.
Answer: Option D
Join The Discussion