search-algorithms icon indicating copy to clipboard operation
search-algorithms copied to clipboard

bfs.lua not correct on starting node other than 1

Open nczempin opened this issue 9 years ago • 0 comments

I tried your bfs.lua code (it is high on google search for "bfs lua"). however, I'm not sure if it is entirely correct. While your test gives the expected result when the starting node is 1, just using a random other starting node doesn't give me the expected results: Replacing 1 by 7 in your test case, I get this output 7, 4, 11, 12, 7, 8, 7, 7, 11, 12, 11, 12, 11, 12 Nodes missing (anything smaller than 7 it seems), many being duplicated; pretty sure this is not correct.

nczempin avatar May 19 '16 10:05 nczempin