Python, Graph, Algorithms.
edge between vertices i and j, and 0 otherwise. So, for our example, the adjacency matrix would be: In an adjacency list representation, we would have an array of 4 lists (since there are 4 vertices), where the ith list contains the vertices that are adjacent to the ith vertex. So, for our example,