What is an Adjacency Matrix?

What is an Adjacency Matrix?

Approach: Describe a 2D array representation of a graph.

A square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph.

Follow-up: Is it better for sparse or dense graphs?

Key concepts: O(1) lookup, O(V^2) space, edge presence.