Graph Breadth FIrst Search

However you input the edges in the graph ( 0, 1, 3 , 2, 4, 5
) goes into the queue then
0-1-3-2-4-5 should pop out,
But why in the final program output
0-1-2-3-4-5 is getting printed?

@Rhinorox at 4.12 output of bfs is 0 1 3 2 4 5 whats the problem

see carefully the tree built in the program is straight line 0 and 3 is not connected so the tree is like 0 - 1-2-3-4-5 thats why it is the output @Rhinorox