How does the adjacency matrix structure store a graph, and what is it good and bad at?
Each vertex gets an index from 0 to $n-1$, and an $n \times n$ array holds in cell $[i][j]$ a reference to the edge between vertices $i$ and $j$, or null. areAdjacent is a single lookup, $O(1)$. But the matrix takes $n^2$ space however few edges there are, incidentEdges(v) must scan a whole row, $O(n)$, and adding or removing a vertex means building a new array, $O(n^2)$.
* One look answers whether u and w are adjacent; listing w's edges means reading its whole row. *
For an undirected graph the matrix is symmetric: cells $[i][j]$ and $[j][i]$ refer to the same edge. For a directed graph row $i$ holds the edges leaving vertex $i$ and column $i$ those arriving at it. One cell per pair of vertices also means the matrix cannot hold parallel edges.
The structure still keeps the edge list's two sequences, so edges can carry elements and edges() stays cheap; in total it takes $n + m + n^2$ space, and $n^2$ dominates. A vertex's integer index plays the role of its position reference: with an array behind the structure, the index is how the vertex finds its row and column without a search.
Its vertex updates are expensive because the array has a fixed size: a new vertex needs a new row and a new column, which means copying all $n^2$ cells into a bigger array, and removeVertex shrinks it again, much as an ArrayList grows and shrinks or a hash table rehashes. Reserving spare rows and columns in advance makes most insertions cheaper, but the cost table assumes the worst case, the version that copies every time.
Go deeper:
Adjacency matrix โ the matrix in graph theory, including what its powers and eigenvalues reveal.