I've been learning about graphs in class and we've just been over the the adjacency matrix structure and the adjacency list structure.
I'm a little confused about this question which required us to recommend the list or the matrix structure:
The graph has 10,000 vertices and 20,000,000 edges, and it is important to use as little space as possible. Which structure would you recommend?
My answer was that an adjacency matrix will use less space. We were given that an adjacency list uses j + k space and an adjacency matrix uses j2 space where j is the number of vertices and k is the number of edges in the graph. I used the prior formulas and found that the matrix gave me a smaller number.
However, the answer seemed to be
In general, both structures work well in this case. Regarding the space requirement, there is no clear winner.
Can someone please explain why this is the answer and where I'm falling short?