Shortest Cycle in Undirected Graph

In the video, the mentioned condition is

dist[neighbor] >= dist[current]

I am not able to understand how will it work?

If there is an edge between the current and a sibling of parent(now neighbor), won’t it be a back edge?

Please point out if I am wrong somewhere.

hey try to think opposite if dist[neig] < dist[cur] so this means neighbour must be parent of current so you can’t go there so we are checking.
hope its cleared if yes don’t forget to hit like and mark resolved :smiley:

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.