Adjacency list¶
The most common format for storing a graph. A method of representing a graph as a collection of vertex lists. Each vertex in the graph corresponds to a list consisting of the "neighbors" of that vertex.
Variations: • using a hash table to associate each vertex with a list of adjacent vertices; • vertices are represented by a numeric index in an array, each array cell references a singly linked list of neighboring vertices; • special classes for vertices and edges, where each vertex object contains a reference to a collection of edges, and each edge object contains references to its source and destination vertices.