Review: Representing Graphs
l Assume V = {1, 2, , n}
l An adjacency matrix represents the graph as a
n x n matrix A:
n A[i, j] = 1 if edge (i, j) E (or weight of edge)
= 0 if edge (i, j) E
n Storage requirements: O(V2)
u A dense representation
n But, can be very efficient for small graphs
u Especially if store just one bit/edge
u Undirected graph: only need one diagonal of matrix