What is an adjacency list and how do you code one?
问题 Here is an SO post of an adjacency list. However I see no difference from a single-linked list? Also here is a wikipedia article which says that it is all the edges (of a graph, discrete math type) in a list which is pretty broad, if I have a graph, which is not a path graph. How do I code an adjacency list? 回答1: A simple example: Suppose you have a vertex type Vertex . They your graph consists of a set of vertices, which you can implement as: std::unordered_set<Vertex> vertices; Now for