What is mistake in my bfs code....?

hello sir…!
i think my code is correct…but it is failing to pass the testcases. can you please tell where is the mistake in my code.

hello @ramsaicrony
wait i m checking

ur code is not correct.
u r just traversing the input graph.
if u r not familiar with bfs then pls cover that video first.
here is the idea.
To find the shortest path, all you have to do is start from the source and perform a breadth first search and stop when you find your destination Node. The only additional thing you need to do is have an array previous[n] which will store the previous node for every node visited. The previous of source can be null.

implementation->

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.