Implementing a graph using a two-dimensional linked list