Why do we need to write AddEdge(36,36)?

Why do we write addEdge(36,36) when someone of the vertices before would’ve added an edge with 36 and a vertex 36 would already be present in the graph ??

@mehulbhandari358 all the edges are directed, and 36 will always be added as a neighbor for some node in the for loop, but we also need it in the list for nodes, not just as a neighbor. So that is done separately (as it cannot be done in the loop).

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.