Just started learning about graph and it's various representations (matrix and adjacency list). Now I found that the adjacency list representation can be implemented in various ways:
- Array of arrays (where we have one index in main array for each vertices and adjacent vertices are in subarrays at each of this index)
- Array of linked lists (most common implementation I have seen)
- Map of array (same as array of arrays, except that outer array is now a Map)
Was wondering why would I prefer one of these implementation over the other. Is one implementation more common or efficient in any way or they all the same?