About graph class implementation

I am not able to understand when to apply adjacency list implementation and when to apply the edgelist implementation in the graph class. how to understand when to apply what?

hello @Senjuti256
it will mostly depend on algorithm u r going to use.
these r some point that u can keep in mind
if in ur algorithm u want to know about neighbours very frequency then u should use adjacency list.
if in ur algorithm u want to traverse ur graph (i,e u want to use dfs/bfs) then u can use adjacency list.

in algorithm like kruskals use edge list becuase it will be easy to implement.

also u can do time complexity analysis using both data structure and pick the one with less complexity.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.