t instead, which could bring us down to O(n) space. In the case of a very <strong>dense</strong> graph, we might as well use an adjacency matrix because the space complexity of the adjacency list would be just as bad, but the adjacency matrix at least offers O(1) runtimes for edge insertion and lookup.</li>
</ul>
</ul>
<ul>
<ul>
<li>An adjacency matrix is also somewhat wasteful if our graph is undirected, as each edge ends up getting represented twice in the matrix. The matrix ends up being symmetrical abou