why we are using adjacency list to represent graph… what not vectors or any other linear data structure?
Graphs adjacency list
there are several ways to represent graphs, most common are
vector of vector
map<int, list<>>
however if you find any other suitable way of representing it and in accordance with the question you can do it
even an arr[][] could be used as adjacency matrix
there is no one way but some questions are solved using one particular way
my thumb rule is
when the vertices are numbered 0-n-1 I use vectors
otherwise maps
since I am comfortable with that, although it is entirely upto you, how you wanna do it
okay thanks a lot…
and what is the stl we are using… is this linked link or specifically doubly lined list?
like in 3rd video of graph implementation sir is using list.
so is that linked list stl?
Yes , list is stl for singly linked list
okay thanks a lot for this