Output is Not coming
for which input???
this code is running fine and also giving output
check again
but the output is wrong
no according to your graph output is correct
check the graph you have made
i think you miss some edge
your graph
1-2-3-4 -5
so output is correct
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask