adjacencylist
An adjacency list is a data structure used to represent a graph by listing, for each vertex, the vertices to which it is connected. For every vertex v, the adjacency list contains the neighbors that v has an edge to, and, in weighted graphs, the corresponding edge weights. This representation is especially efficient for sparse graphs, where the number of edges E is much smaller than V squared.
In an unweighted graph, each adjacency list stores neighboring vertices. In a weighted graph, each entry typically
Space and time considerations: adjacency lists require O(V + E) space. Traversing all neighbors of a vertex
Variants and notes: adjacency lists can be implemented with arrays, linked lists, or hash maps. We can
Use cases include graph traversal algorithms such as depth-first search and breadth-first search, as well as